@sonicjs-cms/core 3.0.0-beta.23 → 3.0.0-beta.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{chunk-IS54FPB7.cjs → chunk-37V3RET3.cjs} +18 -34
  2. package/dist/chunk-37V3RET3.cjs.map +1 -0
  3. package/dist/{chunk-VGHEKIJL.cjs → chunk-A2SN3RVL.cjs} +2 -2
  4. package/dist/{chunk-VGHEKIJL.cjs.map → chunk-A2SN3RVL.cjs.map} +1 -1
  5. package/dist/{chunk-4WMZGHIC.cjs → chunk-BP52BFIV.cjs} +4 -4
  6. package/dist/{chunk-4WMZGHIC.cjs.map → chunk-BP52BFIV.cjs.map} +1 -1
  7. package/dist/{chunk-DIBCKCUE.js → chunk-FHPEM77Y.js} +8 -24
  8. package/dist/chunk-FHPEM77Y.js.map +1 -0
  9. package/dist/{chunk-CTYLCWMO.cjs → chunk-I767LVN7.cjs} +252 -217
  10. package/dist/chunk-I767LVN7.cjs.map +1 -0
  11. package/dist/{chunk-C3ZQP5NW.cjs → chunk-KKNEYIZJ.cjs} +3 -3
  12. package/dist/{chunk-C3ZQP5NW.cjs.map → chunk-KKNEYIZJ.cjs.map} +1 -1
  13. package/dist/{chunk-DPLJYTHE.js → chunk-LNI3FYSI.js} +3 -3
  14. package/dist/{chunk-DPLJYTHE.js.map → chunk-LNI3FYSI.js.map} +1 -1
  15. package/dist/{chunk-AT4ZQGEZ.cjs → chunk-QCJHCSOK.cjs} +21 -2
  16. package/dist/chunk-QCJHCSOK.cjs.map +1 -0
  17. package/dist/{chunk-RFBW5RRH.cjs → chunk-QJUJNTIU.cjs} +11 -11
  18. package/dist/{chunk-RFBW5RRH.cjs.map → chunk-QJUJNTIU.cjs.map} +1 -1
  19. package/dist/{chunk-KS24NPPL.js → chunk-RJ2O5IIE.js} +21 -2
  20. package/dist/chunk-RJ2O5IIE.js.map +1 -0
  21. package/dist/{chunk-A46IRC5A.js → chunk-UIHIXTIS.js} +2 -2
  22. package/dist/{chunk-A46IRC5A.js.map → chunk-UIHIXTIS.js.map} +1 -1
  23. package/dist/{chunk-SK5CHFJP.js → chunk-VC5XVPLM.js} +52 -20
  24. package/dist/chunk-VC5XVPLM.js.map +1 -0
  25. package/dist/{chunk-2MIYYAO4.js → chunk-VGEZNFWH.js} +3 -3
  26. package/dist/{chunk-2MIYYAO4.js.map → chunk-VGEZNFWH.js.map} +1 -1
  27. package/dist/{chunk-XXRR54AB.js → chunk-VYQVDL2M.js} +4 -4
  28. package/dist/{chunk-XXRR54AB.js.map → chunk-VYQVDL2M.js.map} +1 -1
  29. package/dist/index.cjs +1093 -264
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +28 -1
  32. package/dist/index.d.ts +28 -1
  33. package/dist/index.js +841 -14
  34. package/dist/index.js.map +1 -1
  35. package/dist/middleware.cjs +33 -33
  36. package/dist/middleware.js +4 -4
  37. package/dist/migrations-FGXZPKDC.cjs +13 -0
  38. package/dist/{migrations-ZD7Y5NUC.cjs.map → migrations-FGXZPKDC.cjs.map} +1 -1
  39. package/dist/migrations-Z6D27NAW.js +4 -0
  40. package/dist/{migrations-XQ6EX6HX.js.map → migrations-Z6D27NAW.js.map} +1 -1
  41. package/dist/plugins.cjs +40 -40
  42. package/dist/plugins.js +3 -3
  43. package/dist/routes.cjs +26 -26
  44. package/dist/routes.js +6 -6
  45. package/dist/services.cjs +18 -18
  46. package/dist/services.js +2 -2
  47. package/dist/utils.cjs +3 -3
  48. package/dist/utils.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-AT4ZQGEZ.cjs.map +0 -1
  51. package/dist/chunk-CTYLCWMO.cjs.map +0 -1
  52. package/dist/chunk-DIBCKCUE.js.map +0 -1
  53. package/dist/chunk-IS54FPB7.cjs.map +0 -1
  54. package/dist/chunk-KS24NPPL.js.map +0 -1
  55. package/dist/chunk-SK5CHFJP.js.map +0 -1
  56. package/dist/migrations-XQ6EX6HX.js +0 -4
  57. package/dist/migrations-ZD7Y5NUC.cjs +0 -13
@@ -3,18 +3,18 @@
3
3
  var chunkXWVDSM2L_cjs = require('./chunk-XWVDSM2L.cjs');
4
4
  var chunkJMJM7DMM_cjs = require('./chunk-JMJM7DMM.cjs');
5
5
  var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
6
- var chunkIS54FPB7_cjs = require('./chunk-IS54FPB7.cjs');
6
+ var chunk37V3RET3_cjs = require('./chunk-37V3RET3.cjs');
7
7
  var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
8
8
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
9
- var chunkAT4ZQGEZ_cjs = require('./chunk-AT4ZQGEZ.cjs');
10
- var chunkVGHEKIJL_cjs = require('./chunk-VGHEKIJL.cjs');
9
+ var chunkQCJHCSOK_cjs = require('./chunk-QCJHCSOK.cjs');
10
+ var chunkA2SN3RVL_cjs = require('./chunk-A2SN3RVL.cjs');
11
11
  var chunkE66UVONV_cjs = require('./chunk-E66UVONV.cjs');
12
12
  var chunkUYJQDDEE_cjs = require('./chunk-UYJQDDEE.cjs');
13
- var chunk4WMZGHIC_cjs = require('./chunk-4WMZGHIC.cjs');
13
+ var chunkBP52BFIV_cjs = require('./chunk-BP52BFIV.cjs');
14
14
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
15
15
  var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
16
16
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
17
- var chunkC3ZQP5NW_cjs = require('./chunk-C3ZQP5NW.cjs');
17
+ var chunkKKNEYIZJ_cjs = require('./chunk-KKNEYIZJ.cjs');
18
18
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
19
19
  var hono = require('hono');
20
20
  var zod = require('zod');
@@ -151,6 +151,18 @@ var DocumentRepository = class {
151
151
  const row = await this.db.prepare("SELECT * FROM documents WHERE root_id = ? AND tenant_id = ? AND is_published = 1").bind(rootId, this.tenantId).first();
152
152
  return row ? rowToDocument(row) : null;
153
153
  }
154
+ // Slug lookup for a single doc. Prefer the published row; fall back to the current
155
+ // draft so a never-published doc is still reachable by slug (matches getById, which
156
+ // resolves drafts too). ORDER BY makes the preference deterministic when both exist.
157
+ async getBySlug(typeId, slug) {
158
+ const row = await this.db.prepare(
159
+ `SELECT * FROM documents
160
+ WHERE tenant_id = ? AND type_id = ? AND slug = ? AND deleted_at IS NULL
161
+ AND (is_published = 1 OR is_current_draft = 1)
162
+ ORDER BY is_published DESC LIMIT 1`
163
+ ).bind(this.tenantId, typeId, slug).first();
164
+ return row ? rowToDocument(row) : null;
165
+ }
154
166
  // Unified, tenant-scoped list with optional generated-column / facet filters and sort. This is the
155
167
  // single place document list SQL is built — route handlers must call this, never inline SQL (R4).
156
168
  async list(opts = {}) {
@@ -259,7 +271,7 @@ function getDocumentRequestContext(c) {
259
271
 
260
272
  // src/routes/api-documents.ts
261
273
  async function aclAllowsRead(db, tenantId, principalSet, row, preloadedType) {
262
- const docType = preloadedType ?? await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
274
+ const docType = preloadedType ?? await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(row.type_id);
263
275
  if (!docType) return false;
264
276
  return new DocumentRepository(db, tenantId).isAllowed(principalSet, row.root_id, "read", docType.settings);
265
277
  }
@@ -277,7 +289,7 @@ apiDocumentsRoutes.get("/", async (c) => {
277
289
  if (!typeId) {
278
290
  return c.json({ error: "type query parameter is required" }, 400);
279
291
  }
280
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
292
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
281
293
  const docType = await registry.findById(typeId);
282
294
  if (!docType || !docType.isActive) {
283
295
  return c.json({ error: "Unknown document type" }, 400);
@@ -359,7 +371,7 @@ apiDocumentsRoutes.get("/root/:rootId", async (c) => {
359
371
  AND (expires_at IS NULL OR expires_at > ?) LIMIT 1`
360
372
  ).bind(rootId, now, now).first();
361
373
  if (!row) return c.json({ error: "Not found" }, 404);
362
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
374
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(row.type_id);
363
375
  const effTenant = effectiveTenantForType(tenantId, docType?.settings);
364
376
  if (row.tenant_id !== effTenant) return c.json({ error: "Not found" }, 404);
365
377
  if (!await aclAllowsRead(db, effTenant, principalSet, row, docType)) {
@@ -395,7 +407,7 @@ apiDocumentsRoutes.get("/:id", async (c) => {
395
407
  AND (expires_at IS NULL OR expires_at > ?) LIMIT 1`
396
408
  ).bind(id, now, now).first();
397
409
  if (!row) return c.json({ error: "Not found" }, 404);
398
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
410
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(row.type_id);
399
411
  const effTenant = effectiveTenantForType(tenantId, docType?.settings);
400
412
  if (row.tenant_id !== effTenant) return c.json({ error: "Not found" }, 404);
401
413
  if (!await aclAllowsRead(db, effTenant, principalSet, row, docType)) {
@@ -465,17 +477,17 @@ async function resolveDocScope(c, db, by, opts = {}) {
465
477
  const draft = opts.currentDraftOnly ? " AND is_current_draft = 1" : "";
466
478
  const row = await db.prepare(`SELECT type_id, root_id, tenant_id FROM documents WHERE ${col} = ?${draft} LIMIT 1`).bind(val).first();
467
479
  if (!row) return null;
468
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(row.type_id);
480
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(row.type_id);
469
481
  const tenantId = effectiveTenantForType(getRequestTenant(c), docType?.settings);
470
482
  if (row.tenant_id !== tenantId) return null;
471
483
  return { typeId: row.type_id, rootId: row.root_id, tenantId, docType };
472
484
  }
473
485
  var adminDocumentsRoutes = new hono.Hono();
474
- adminDocumentsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
475
- adminDocumentsRoutes.use("*", chunkIS54FPB7_cjs.requireRole(["admin", "editor"]));
486
+ adminDocumentsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
487
+ adminDocumentsRoutes.use("*", chunk37V3RET3_cjs.requireRole(["admin", "editor"]));
476
488
  adminDocumentsRoutes.get("/types", async (c) => {
477
489
  try {
478
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
490
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(c.env.DB);
479
491
  const types = await registry.findAll();
480
492
  return c.json({ data: types });
481
493
  } catch (error) {
@@ -503,7 +515,7 @@ adminDocumentsRoutes.get("/", async (c) => {
503
515
  if (!typeId) {
504
516
  return c.json({ error: "type query parameter is required" }, 400);
505
517
  }
506
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
518
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
507
519
  const docType = await registry.findById(typeId);
508
520
  if (!docType || !docType.isActive) {
509
521
  return c.json({ error: "Unknown document type" }, 400);
@@ -614,7 +626,7 @@ adminDocumentsRoutes.post("/", async (c) => {
614
626
  const input = validation.data;
615
627
  const db = c.env.DB;
616
628
  const user = c.get("user");
617
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
629
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
618
630
  const docType = await registry.findById(input.typeId);
619
631
  if (!docType || !docType.isActive) {
620
632
  return c.json({ error: "Unknown document type" }, 400);
@@ -746,7 +758,7 @@ adminDocumentsRoutes.post("/types/:typeId/reindex", async (c) => {
746
758
  try {
747
759
  const { typeId } = c.req.param();
748
760
  const db = c.env.DB;
749
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
761
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
750
762
  const docType = await registry.findById(typeId);
751
763
  if (!docType) return c.json({ error: "Unknown document type" }, 400);
752
764
  const reindexTenant = effectiveTenantForType(getRequestTenant(c), docType.settings);
@@ -900,13 +912,13 @@ async function resolveContentVariables(contentData, db) {
900
912
  // src/routes/api-content-crud.ts
901
913
  var apiContentCrudRoutes = new hono.Hono();
902
914
  async function resolveDocBacking(db, collectionIdOrName) {
903
- const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
915
+ const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
904
916
  const record = registry.getBySlugOrName(collectionIdOrName) ?? registry.getById(collectionIdOrName);
905
917
  if (record) {
906
- const docType2 = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(record.name);
918
+ const docType2 = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(record.name);
907
919
  return docType2 ? { coll: { id: record.id, name: record.name }, docType: docType2 } : null;
908
920
  }
909
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(collectionIdOrName);
921
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(collectionIdOrName);
910
922
  if (docType) {
911
923
  return { coll: { id: collectionIdOrName, name: collectionIdOrName }, docType };
912
924
  }
@@ -949,7 +961,7 @@ apiContentCrudRoutes.get("/check-slug", async (c) => {
949
961
  }, 500);
950
962
  }
951
963
  });
952
- apiContentCrudRoutes.get("/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
964
+ apiContentCrudRoutes.get("/:id", chunk37V3RET3_cjs.optionalAuth(), async (c) => {
953
965
  try {
954
966
  const id = c.req.param("id");
955
967
  const db = c.env.DB;
@@ -959,7 +971,7 @@ apiContentCrudRoutes.get("/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) =>
959
971
  ).bind(id, getRequestTenant(c)).first();
960
972
  let transformedContent;
961
973
  if (docRow) {
962
- const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
974
+ const coll = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(docRow.type_id);
963
975
  transformedContent = {
964
976
  id: docRow.root_id,
965
977
  title: docRow.title,
@@ -993,7 +1005,7 @@ apiContentCrudRoutes.get("/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) =>
993
1005
  }, 500);
994
1006
  }
995
1007
  });
996
- apiContentCrudRoutes.post("/", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1008
+ apiContentCrudRoutes.post("/", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
997
1009
  try {
998
1010
  const db = c.env.DB;
999
1011
  const user = c.get("user");
@@ -1068,7 +1080,7 @@ apiContentCrudRoutes.post("/", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cj
1068
1080
  }, 500);
1069
1081
  }
1070
1082
  });
1071
- apiContentCrudRoutes.put("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1083
+ apiContentCrudRoutes.put("/:id", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1072
1084
  try {
1073
1085
  const id = c.req.param("id");
1074
1086
  const db = c.env.DB;
@@ -1090,7 +1102,7 @@ apiContentCrudRoutes.put("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_
1090
1102
  } catch (err) {
1091
1103
  return c.json({ error: "Write cancelled by plugin", details: String(err) }, 400);
1092
1104
  }
1093
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
1105
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
1094
1106
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
1095
1107
  queryableFields: docType?.queryableFields ?? [],
1096
1108
  typeSchemaVersion: docType?.schemaVersion ?? 1,
@@ -1113,7 +1125,7 @@ apiContentCrudRoutes.put("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_
1113
1125
  const cache = chunk36Z3AKX3_cjs.getCacheService(chunk36Z3AKX3_cjs.CACHE_CONFIGS.api);
1114
1126
  await cache.invalidate("content-filtered:*");
1115
1127
  await cache.invalidate("collection-content-filtered:*");
1116
- const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
1128
+ const coll = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(docRow.type_id);
1117
1129
  const saved = await db.prepare("SELECT * FROM documents WHERE id = ?").bind(newDraft.id).first();
1118
1130
  const savedData = saved?.data ? JSON.parse(saved.data) : {};
1119
1131
  dispatchHookEvent(c, "content:after:update", { collection: docRow.type_id, id, data: savedData, user: actor }, "fire-and-forget");
@@ -1134,7 +1146,7 @@ apiContentCrudRoutes.put("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_
1134
1146
  }, 500);
1135
1147
  }
1136
1148
  });
1137
- apiContentCrudRoutes.delete("/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1149
+ apiContentCrudRoutes.delete("/:id", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
1138
1150
  try {
1139
1151
  const id = c.req.param("id");
1140
1152
  const db = c.env.DB;
@@ -1260,7 +1272,7 @@ apiRoutes.use("*", async (c, next) => {
1260
1272
  c.header("X-Response-Time", `${totalTime}ms`);
1261
1273
  });
1262
1274
  apiRoutes.use("*", async (c, next) => {
1263
- const cacheEnabled = await chunkIS54FPB7_cjs.isPluginActive(c.env.DB, "core-cache");
1275
+ const cacheEnabled = await chunk37V3RET3_cjs.isPluginActive(c.env.DB, "core-cache");
1264
1276
  c.set("cacheEnabled", cacheEnabled);
1265
1277
  await next();
1266
1278
  });
@@ -1283,7 +1295,7 @@ apiRoutes.get("/", (c) => {
1283
1295
  openapi: "3.0.0",
1284
1296
  info: {
1285
1297
  title: "SonicJS AI API",
1286
- version: chunkC3ZQP5NW_cjs.getCoreVersion(),
1298
+ version: chunkKKNEYIZJ_cjs.getCoreVersion(),
1287
1299
  description: "RESTful API for SonicJS headless CMS - a modern, AI-powered content management system built on Cloudflare Workers",
1288
1300
  contact: {
1289
1301
  name: "SonicJS Support",
@@ -1713,8 +1725,8 @@ apiRoutes.get("/collections", async (c) => {
1713
1725
  }
1714
1726
  c.header("X-Cache-Status", "MISS");
1715
1727
  c.header("X-Cache-Source", "registry");
1716
- const records = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
1717
- const transformedResults = records.map(chunkAT4ZQGEZ_cjs.collectionRecordToRow);
1728
+ const records = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
1729
+ const transformedResults = records.map(chunkQCJHCSOK_cjs.collectionRecordToRow);
1718
1730
  const responseData = {
1719
1731
  data: transformedResults,
1720
1732
  meta: addTimingMeta(c, {
@@ -1735,7 +1747,7 @@ apiRoutes.get("/collections", async (c) => {
1735
1747
  return c.json({ error: "Failed to fetch collections" }, 500);
1736
1748
  }
1737
1749
  });
1738
- apiRoutes.get("/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1750
+ apiRoutes.get("/content", chunk37V3RET3_cjs.optionalAuth(), async (c) => {
1739
1751
  const executionStart = Date.now();
1740
1752
  try {
1741
1753
  const db = c.env.DB;
@@ -1744,7 +1756,7 @@ apiRoutes.get("/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1744
1756
  const collIdByName = /* @__PURE__ */ new Map();
1745
1757
  let typeId;
1746
1758
  let typeIds;
1747
- const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
1759
+ const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
1748
1760
  if (queryParams.collection) {
1749
1761
  const collectionName = queryParams.collection;
1750
1762
  const record = registry.getByName(collectionName);
@@ -1843,13 +1855,13 @@ apiRoutes.get("/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1843
1855
  }, 500);
1844
1856
  }
1845
1857
  });
1846
- apiRoutes.get("/collections/:collection/content", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1858
+ apiRoutes.get("/collections/:collection/content", chunk37V3RET3_cjs.optionalAuth(), async (c) => {
1847
1859
  const executionStart = Date.now();
1848
1860
  try {
1849
1861
  const collection = c.req.param("collection");
1850
1862
  const db = c.env.DB;
1851
1863
  const queryParams = c.req.query();
1852
- const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
1864
+ const record = chunkQCJHCSOK_cjs.getCollectionRegistry().getBySlugOrName(collection);
1853
1865
  if (!record || record.isActive === false) {
1854
1866
  return c.json({ error: "Collection not found" }, 404);
1855
1867
  }
@@ -1905,7 +1917,7 @@ apiRoutes.get("/collections/:collection/content", chunkIS54FPB7_cjs.optionalAuth
1905
1917
  const responseData = {
1906
1918
  data: transformedResults,
1907
1919
  meta: addTimingMeta(c, {
1908
- ...includeCollection ? { collection: chunkAT4ZQGEZ_cjs.collectionRecordToRow(record) } : {},
1920
+ ...includeCollection ? { collection: chunkQCJHCSOK_cjs.collectionRecordToRow(record) } : {},
1909
1921
  count: results.length,
1910
1922
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1911
1923
  // D44: echo the caller's filter with the access policy applied (status=published forced for
@@ -1930,13 +1942,13 @@ apiRoutes.get("/collections/:collection/content", chunkIS54FPB7_cjs.optionalAuth
1930
1942
  }
1931
1943
  });
1932
1944
  apiRoutes.route("/content", api_content_crud_default);
1933
- apiRoutes.get("/:collection", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1945
+ apiRoutes.get("/:collection", chunk37V3RET3_cjs.optionalAuth(), async (c) => {
1934
1946
  const executionStart = Date.now();
1935
1947
  try {
1936
1948
  const collection = c.req.param("collection");
1937
1949
  const db = c.env.DB;
1938
1950
  const queryParams = c.req.query();
1939
- const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
1951
+ const record = chunkQCJHCSOK_cjs.getCollectionRegistry().getBySlugOrName(collection);
1940
1952
  if (!record || record.isActive === false) {
1941
1953
  return c.json({ error: "Collection not found" }, 404);
1942
1954
  }
@@ -1976,7 +1988,7 @@ apiRoutes.get("/:collection", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1976
1988
  const responseData = {
1977
1989
  data: transformedResults,
1978
1990
  meta: addTimingMeta(c, {
1979
- ...includeCollection ? { collection: chunkAT4ZQGEZ_cjs.collectionRecordToRow(record) } : {},
1991
+ ...includeCollection ? { collection: chunkQCJHCSOK_cjs.collectionRecordToRow(record) } : {},
1980
1992
  count: results.length,
1981
1993
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1982
1994
  filter: normalizePublicContentFilter(filter, role),
@@ -1994,12 +2006,12 @@ apiRoutes.get("/:collection", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
1994
2006
  return c.json({ error: "Failed to fetch content", details: error instanceof Error ? error.message : String(error) }, 500);
1995
2007
  }
1996
2008
  });
1997
- apiRoutes.get("/:collection/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) => {
2009
+ apiRoutes.get("/:collection/:id", chunk37V3RET3_cjs.optionalAuth(), async (c) => {
1998
2010
  try {
1999
2011
  const collection = c.req.param("collection");
2000
2012
  const id = c.req.param("id");
2001
2013
  const db = c.env.DB;
2002
- const record = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2014
+ const record = chunkQCJHCSOK_cjs.getCollectionRegistry().getBySlugOrName(collection);
2003
2015
  if (!record || record.isActive === false) {
2004
2016
  return c.json({ error: "Collection not found" }, 404);
2005
2017
  }
@@ -2008,7 +2020,7 @@ apiRoutes.get("/:collection/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) =>
2008
2020
  privileged ? "SELECT * FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_current_draft = 1 AND deleted_at IS NULL" : "SELECT * FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_published = 1 AND deleted_at IS NULL"
2009
2021
  ).bind(id, record.name).first();
2010
2022
  if (!docRow) return c.json({ error: "Content not found" }, 404);
2011
- const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
2023
+ const coll = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(docRow.type_id);
2012
2024
  const transformedContent = {
2013
2025
  id: docRow.root_id,
2014
2026
  title: docRow.title,
@@ -2026,7 +2038,7 @@ apiRoutes.get("/:collection/:id", chunkIS54FPB7_cjs.optionalAuth(), async (c) =>
2026
2038
  return c.json({ error: "Failed to fetch content", details: error instanceof Error ? error.message : String(error) }, 500);
2027
2039
  }
2028
2040
  });
2029
- apiRoutes.post("/:collection", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2041
+ apiRoutes.post("/:collection", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2030
2042
  try {
2031
2043
  const collection = c.req.param("collection");
2032
2044
  const db = c.env.DB;
@@ -2059,14 +2071,14 @@ apiRoutes.post("/:collection", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cj
2059
2071
  return c.json({ error: "Failed to create content", details: error instanceof Error ? error.message : String(error) }, 500);
2060
2072
  }
2061
2073
  });
2062
- apiRoutes.put("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2074
+ apiRoutes.put("/:collection/:id", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2063
2075
  try {
2064
2076
  const collection = c.req.param("collection");
2065
2077
  const id = c.req.param("id");
2066
2078
  const db = c.env.DB;
2067
2079
  const user = c.get("user");
2068
2080
  const body = await c.req.json();
2069
- const collRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2081
+ const collRecord = chunkQCJHCSOK_cjs.getCollectionRegistry().getBySlugOrName(collection);
2070
2082
  const typeName = collRecord?.name ?? collection;
2071
2083
  const docRow = await db.prepare("SELECT root_id, type_id FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND is_current_draft = 1 AND deleted_at IS NULL").bind(id, typeName).first();
2072
2084
  if (!docRow) return c.json({ error: "Content not found" }, 404);
@@ -2078,7 +2090,7 @@ apiRoutes.put("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7
2078
2090
  } catch (err) {
2079
2091
  return c.json({ error: "Write cancelled by plugin", details: String(err) }, 400);
2080
2092
  }
2081
- const docType = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
2093
+ const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(docRow.type_id);
2082
2094
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, { queryableFields: docType?.queryableFields ?? [], typeSchemaVersion: docType?.schemaVersion ?? 1, maxVersionsPerRoot: docType?.settings?.maxVersionsPerRoot ?? 50, tenantId: "default", versioning: docType?.settings?.versioning ?? false });
2083
2095
  const input = {};
2084
2096
  if (body.title !== void 0) input.title = body.title;
@@ -2095,7 +2107,7 @@ apiRoutes.put("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7
2095
2107
  const cache = chunk36Z3AKX3_cjs.getCacheService(chunk36Z3AKX3_cjs.CACHE_CONFIGS.api);
2096
2108
  await cache.invalidate("content-filtered:*");
2097
2109
  await cache.invalidate("collection-content-filtered:*");
2098
- const coll = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(docRow.type_id);
2110
+ const coll = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(docRow.type_id);
2099
2111
  const saved = await db.prepare("SELECT * FROM documents WHERE id = ?").bind(newDraft.id).first();
2100
2112
  const savedData = saved?.data ? JSON.parse(saved.data) : {};
2101
2113
  dispatchHookEvent(c, "content:after:update", { collection: docRow.type_id, id, data: savedData, user: actor }, "fire-and-forget");
@@ -2107,13 +2119,13 @@ apiRoutes.put("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7
2107
2119
  return c.json({ error: "Failed to update content", details: error instanceof Error ? error.message : String(error) }, 500);
2108
2120
  }
2109
2121
  });
2110
- apiRoutes.delete("/:collection/:id", chunkIS54FPB7_cjs.requireAuth(), chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2122
+ apiRoutes.delete("/:collection/:id", chunk37V3RET3_cjs.requireAuth(), chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
2111
2123
  try {
2112
2124
  const collection = c.req.param("collection");
2113
2125
  const id = c.req.param("id");
2114
2126
  const db = c.env.DB;
2115
2127
  const user = c.get("user");
2116
- const collRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getBySlugOrName(collection);
2128
+ const collRecord = chunkQCJHCSOK_cjs.getCollectionRegistry().getBySlugOrName(collection);
2117
2129
  const typeName = collRecord?.name ?? collection;
2118
2130
  const docRow = await db.prepare("SELECT type_id FROM documents WHERE root_id = ? AND type_id = ? AND tenant_id = 'default' AND deleted_at IS NULL LIMIT 1").bind(id, typeName).first();
2119
2131
  if (!docRow) return c.json({ error: "Content not found" }, 404);
@@ -2335,7 +2347,7 @@ var fileValidationSchema = zod.z.object({
2335
2347
  // 50MB max
2336
2348
  });
2337
2349
  var apiMediaRoutes = new hono.Hono();
2338
- apiMediaRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
2350
+ apiMediaRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
2339
2351
  apiMediaRoutes.post("/upload", async (c) => {
2340
2352
  try {
2341
2353
  const user = c.get("user");
@@ -3033,7 +3045,7 @@ apiSystemRoutes.get("/info", (c) => {
3033
3045
  apiSystemRoutes.get("/stats", async (c) => {
3034
3046
  try {
3035
3047
  const db = c.env.DB;
3036
- const typeIds = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => r.name);
3048
+ const typeIds = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => r.name);
3037
3049
  let contentStats = null;
3038
3050
  if (typeIds.length > 0) {
3039
3051
  const placeholders = typeIds.map(() => "?").join(",");
@@ -3108,12 +3120,12 @@ apiSystemRoutes.get("/env", (c) => {
3108
3120
  });
3109
3121
  var api_system_default = apiSystemRoutes;
3110
3122
  var adminApiRoutes = new hono.Hono();
3111
- adminApiRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
3112
- adminApiRoutes.use("*", chunkIS54FPB7_cjs.requireRole(["admin", "editor"]));
3123
+ adminApiRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
3124
+ adminApiRoutes.use("*", chunk37V3RET3_cjs.requireRole(["admin", "editor"]));
3113
3125
  adminApiRoutes.get("/stats", async (c) => {
3114
3126
  try {
3115
3127
  const db = c.env.DB;
3116
- const userCollections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
3128
+ const userCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
3117
3129
  const collectionsCount = userCollections.length;
3118
3130
  let contentCount = 0;
3119
3131
  if (userCollections.length > 0) {
@@ -3204,7 +3216,7 @@ adminApiRoutes.get("/collections", async (c) => {
3204
3216
  try {
3205
3217
  const search = c.req.query("search") || "";
3206
3218
  const includeInactive = c.req.query("includeInactive") === "true";
3207
- let records = chunkAT4ZQGEZ_cjs.getCollectionRegistry().list().filter((r) => !r.internal);
3219
+ let records = chunkQCJHCSOK_cjs.getCollectionRegistry().list().filter((r) => !r.internal);
3208
3220
  if (!includeInactive) records = records.filter((r) => r.isActive !== false);
3209
3221
  if (search) {
3210
3222
  const needle = search.toLowerCase();
@@ -3236,7 +3248,7 @@ adminApiRoutes.get("/collections", async (c) => {
3236
3248
  adminApiRoutes.get("/collections/:id", async (c) => {
3237
3249
  try {
3238
3250
  const id = c.req.param("id");
3239
- const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
3251
+ const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
3240
3252
  const record = registry.getById(id) ?? registry.getByName(id);
3241
3253
  if (!record) {
3242
3254
  return c.json({ error: "Collection not found" }, 404);
@@ -3286,7 +3298,7 @@ adminApiRoutes.get("/references", async (c) => {
3286
3298
  if (collectionParams.length === 0) {
3287
3299
  return c.json({ error: "Collection is required" }, 400);
3288
3300
  }
3289
- const registry = chunkAT4ZQGEZ_cjs.getCollectionRegistry();
3301
+ const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
3290
3302
  const matched = collectionParams.map((param) => registry.getById(param) ?? registry.getByName(param)).filter((r) => !!r);
3291
3303
  const seen = /* @__PURE__ */ new Set();
3292
3304
  const collections = matched.filter((r) => {
@@ -3401,7 +3413,7 @@ adminApiRoutes.patch("/collections/:id", collectionsReadOnly);
3401
3413
  adminApiRoutes.delete("/collections/:id", collectionsReadOnly);
3402
3414
  adminApiRoutes.get("/migrations/status", async (c) => {
3403
3415
  try {
3404
- const { MigrationService: MigrationService2 } = await import('./migrations-ZD7Y5NUC.cjs');
3416
+ const { MigrationService: MigrationService2 } = await import('./migrations-FGXZPKDC.cjs');
3405
3417
  const db = c.env.DB;
3406
3418
  const migrationService = new MigrationService2(db);
3407
3419
  const status = await migrationService.getMigrationStatus();
@@ -3444,7 +3456,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
3444
3456
  });
3445
3457
  adminApiRoutes.get("/migrations/validate", async (c) => {
3446
3458
  try {
3447
- const { MigrationService: MigrationService2 } = await import('./migrations-ZD7Y5NUC.cjs');
3459
+ const { MigrationService: MigrationService2 } = await import('./migrations-FGXZPKDC.cjs');
3448
3460
  const db = c.env.DB;
3449
3461
  const migrationService = new MigrationService2(db);
3450
3462
  const validation = await migrationService.validateSchema();
@@ -3859,7 +3871,7 @@ function renderRegisterPage(data) {
3859
3871
  }
3860
3872
 
3861
3873
  // src/services/email/email-service-singleton.ts
3862
- var singleton = chunk4WMZGHIC_cjs.createServiceSingleton("EmailService");
3874
+ var singleton = chunkBP52BFIV_cjs.createServiceSingleton("EmailService");
3863
3875
  function setEmailService(service2) {
3864
3876
  singleton.set(service2);
3865
3877
  }
@@ -4667,7 +4679,7 @@ function getLexicalInitScript(settings = {}) {
4667
4679
  </script>
4668
4680
  `;
4669
4681
  }
4670
- var lexicalEditorPlugin = chunk4WMZGHIC_cjs.definePlugin({
4682
+ var lexicalEditorPlugin = chunkBP52BFIV_cjs.definePlugin({
4671
4683
  id: "lexical-editor",
4672
4684
  version: "1.0.0",
4673
4685
  name: "Lexical Editor",
@@ -7073,7 +7085,7 @@ api.put("/:userId", async (c) => {
7073
7085
  await saveCustomData(db, userId, sanitized);
7074
7086
  return c.json({ success: true });
7075
7087
  });
7076
- var userProfilesPlugin = chunk4WMZGHIC_cjs.definePlugin({
7088
+ var userProfilesPlugin = chunkBP52BFIV_cjs.definePlugin({
7077
7089
  id: "user-profiles",
7078
7090
  version: "1.0.0",
7079
7091
  name: "User Profiles",
@@ -7111,8 +7123,8 @@ function renderPasswordResetEmail(resetLink, firstName) {
7111
7123
  async function setCsrfCookie(c, maxAge) {
7112
7124
  const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
7113
7125
  const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
7114
- const csrfToken = await chunkIS54FPB7_cjs.generateCsrfToken(secret);
7115
- const cookieMaxAge = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env?.DB, c.env);
7126
+ const csrfToken = await chunk37V3RET3_cjs.generateCsrfToken(secret);
7127
+ const cookieMaxAge = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env?.DB, c.env);
7116
7128
  cookie.setCookie(c, "csrf_token", csrfToken, {
7117
7129
  httpOnly: false,
7118
7130
  secure: !isDev,
@@ -7171,7 +7183,7 @@ var loginSchema = zod.z.object({
7171
7183
  });
7172
7184
  authRoutes.post(
7173
7185
  "/register",
7174
- chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7186
+ chunk37V3RET3_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7175
7187
  async (c) => {
7176
7188
  try {
7177
7189
  const db = c.env.DB;
@@ -7207,7 +7219,7 @@ authRoutes.post(
7207
7219
  if (existingUser) {
7208
7220
  return c.json({ error: "User with this email already exists" }, 400);
7209
7221
  }
7210
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7222
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
7211
7223
  const userId = crypto.randomUUID();
7212
7224
  const now = /* @__PURE__ */ new Date();
7213
7225
  const nowSec = Math.floor(now.getTime() / 1e3);
@@ -7240,8 +7252,8 @@ authRoutes.post(
7240
7252
  { user: { id: userId, email: normalizedEmail, role: "viewer" } },
7241
7253
  "fire-and-forget"
7242
7254
  );
7243
- const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7244
- const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET, tokenTtl);
7255
+ const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7256
+ const token = await chunk37V3RET3_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET, tokenTtl);
7245
7257
  cookie.setCookie(c, "auth_token", token, {
7246
7258
  httpOnly: true,
7247
7259
  secure: true,
@@ -7273,7 +7285,7 @@ authRoutes.post(
7273
7285
  );
7274
7286
  authRoutes.post(
7275
7287
  "/login",
7276
- chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7288
+ chunk37V3RET3_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7277
7289
  async (c) => {
7278
7290
  try {
7279
7291
  const body = await c.req.json();
@@ -7305,8 +7317,8 @@ authRoutes.post(
7305
7317
  await setCsrfCookie(c);
7306
7318
  const baBody = await baRes.json();
7307
7319
  const user = baBody.user ?? {};
7308
- const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7309
- const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(
7320
+ const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7321
+ const token = await chunk37V3RET3_cjs.AuthManager.generateToken(
7310
7322
  user.id,
7311
7323
  user.email,
7312
7324
  user.role ?? "viewer",
@@ -7367,7 +7379,7 @@ authRoutes.get("/logout", async (c) => {
7367
7379
  clearCsrfCookie(c);
7368
7380
  return c.redirect("/auth/login?message=You have been logged out successfully");
7369
7381
  });
7370
- authRoutes.get("/me", chunkIS54FPB7_cjs.requireAuth(), async (c) => {
7382
+ authRoutes.get("/me", chunk37V3RET3_cjs.requireAuth(), async (c) => {
7371
7383
  try {
7372
7384
  const user = c.get("user");
7373
7385
  if (!user) {
@@ -7387,7 +7399,7 @@ authRoutes.get("/me", chunkIS54FPB7_cjs.requireAuth(), async (c) => {
7387
7399
  });
7388
7400
  authRoutes.post(
7389
7401
  "/refresh",
7390
- chunkIS54FPB7_cjs.rateLimit({ max: 60, windowMs: 60 * 1e3, keyPrefix: "refresh" }),
7402
+ chunk37V3RET3_cjs.rateLimit({ max: 60, windowMs: 60 * 1e3, keyPrefix: "refresh" }),
7391
7403
  async (c) => {
7392
7404
  try {
7393
7405
  let token = c.req.header("Authorization")?.replace("Bearer ", "");
@@ -7396,8 +7408,8 @@ authRoutes.post(
7396
7408
  return c.json({ error: "Authentication required" }, 401);
7397
7409
  }
7398
7410
  const db = c.env.DB;
7399
- const grace = await chunkIS54FPB7_cjs.getJwtRefreshGraceSecondsFromDb(db, c.env);
7400
- const payload = await chunkIS54FPB7_cjs.AuthManager.verifyToken(token, c.env.JWT_SECRET, grace);
7411
+ const grace = await chunk37V3RET3_cjs.getJwtRefreshGraceSecondsFromDb(db, c.env);
7412
+ const payload = await chunk37V3RET3_cjs.AuthManager.verifyToken(token, c.env.JWT_SECRET, grace);
7401
7413
  if (!payload) {
7402
7414
  return c.json({ error: "Invalid or expired token" }, 401);
7403
7415
  }
@@ -7405,8 +7417,8 @@ authRoutes.post(
7405
7417
  if (!row || !row.is_active) {
7406
7418
  return c.json({ error: "User is not active" }, 401);
7407
7419
  }
7408
- const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(db, c.env);
7409
- const newToken = await chunkIS54FPB7_cjs.AuthManager.generateToken(row.id, row.email, row.role, c.env.JWT_SECRET, tokenTtl);
7420
+ const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(db, c.env);
7421
+ const newToken = await chunk37V3RET3_cjs.AuthManager.generateToken(row.id, row.email, row.role, c.env.JWT_SECRET, tokenTtl);
7410
7422
  cookie.setCookie(c, "auth_token", newToken, {
7411
7423
  httpOnly: true,
7412
7424
  secure: true,
@@ -7426,7 +7438,7 @@ authRoutes.post(
7426
7438
  );
7427
7439
  authRoutes.post(
7428
7440
  "/register/form",
7429
- chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7441
+ chunk37V3RET3_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
7430
7442
  async (c) => {
7431
7443
  try {
7432
7444
  const db = c.env.DB;
@@ -7471,7 +7483,7 @@ authRoutes.post(
7471
7483
  </div>
7472
7484
  `);
7473
7485
  }
7474
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7486
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
7475
7487
  const role = isFirstUser ? "admin" : "viewer";
7476
7488
  const userId = crypto.randomUUID();
7477
7489
  const now = /* @__PURE__ */ new Date();
@@ -7513,8 +7525,8 @@ authRoutes.post(
7513
7525
  { user: { id: userId, email: normalizedEmail, role } },
7514
7526
  "fire-and-forget"
7515
7527
  );
7516
- const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7517
- const token = await chunkIS54FPB7_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET, tokenTtl);
7528
+ const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7529
+ const token = await chunk37V3RET3_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET, tokenTtl);
7518
7530
  cookie.setCookie(c, "auth_token", token, {
7519
7531
  httpOnly: true,
7520
7532
  secure: false,
@@ -7546,7 +7558,7 @@ authRoutes.post(
7546
7558
  );
7547
7559
  authRoutes.post(
7548
7560
  "/login/form",
7549
- chunkIS54FPB7_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7561
+ chunk37V3RET3_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
7550
7562
  async (c) => {
7551
7563
  try {
7552
7564
  const formData = await c.req.formData();
@@ -7615,14 +7627,14 @@ authRoutes.post(
7615
7627
  );
7616
7628
  authRoutes.post(
7617
7629
  "/seed-admin",
7618
- chunkIS54FPB7_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
7630
+ chunk37V3RET3_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
7619
7631
  async (c) => {
7620
7632
  try {
7621
7633
  const db = c.env.DB;
7622
7634
  const rbac = new chunkLTZ5WYOK_cjs.RbacService(db);
7623
7635
  const results = [];
7624
7636
  const upsertSeedUser = async (opts) => {
7625
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(opts.password);
7637
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(opts.password);
7626
7638
  const nowMs = Date.now();
7627
7639
  const nowSec = Math.floor(nowMs / 1e3);
7628
7640
  const existing = await db.prepare("SELECT id FROM auth_user WHERE email = ?").bind(opts.email).first();
@@ -7847,7 +7859,7 @@ authRoutes.post("/accept-invitation", async (c) => {
7847
7859
  if (invitationAge > maxAge) {
7848
7860
  return c.json({ error: "Invitation has expired" }, 400);
7849
7861
  }
7850
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
7862
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
7851
7863
  const updateStmt = db.prepare(`
7852
7864
  UPDATE auth_user SET
7853
7865
  password_hash = ?,
@@ -7864,8 +7876,8 @@ authRoutes.post("/accept-invitation", async (c) => {
7864
7876
  Date.now(),
7865
7877
  invitedUser.id
7866
7878
  ).run();
7867
- const tokenTtl = await chunkIS54FPB7_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7868
- const authToken = await chunkIS54FPB7_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET, tokenTtl);
7879
+ const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
7880
+ const authToken = await chunk37V3RET3_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET, tokenTtl);
7869
7881
  cookie.setCookie(c, "auth_token", authToken, {
7870
7882
  httpOnly: true,
7871
7883
  secure: true,
@@ -7881,7 +7893,7 @@ authRoutes.post("/accept-invitation", async (c) => {
7881
7893
  });
7882
7894
  authRoutes.post(
7883
7895
  "/request-password-reset",
7884
- chunkIS54FPB7_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
7896
+ chunk37V3RET3_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
7885
7897
  async (c) => {
7886
7898
  try {
7887
7899
  const formData = await c.req.formData();
@@ -8118,7 +8130,7 @@ authRoutes.post("/reset-password", async (c) => {
8118
8130
  if (Date.now() > user.password_reset_expires) {
8119
8131
  return c.json({ error: "Reset token has expired" }, 400);
8120
8132
  }
8121
- const newPasswordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
8133
+ const newPasswordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
8122
8134
  try {
8123
8135
  const historyStmt = db.prepare(`
8124
8136
  INSERT INTO auth_password_history (id, user_id, password_hash, created_at)
@@ -8332,7 +8344,7 @@ app.post("/test-seed-defaults", async (c) => {
8332
8344
  var test_cleanup_default = app;
8333
8345
 
8334
8346
  // src/plugins/available/easy-mdx/index.ts
8335
- chunk4WMZGHIC_cjs.definePlugin({
8347
+ chunkBP52BFIV_cjs.definePlugin({
8336
8348
  id: "easy-mdx",
8337
8349
  version: "1.0.0",
8338
8350
  name: "EasyMDE Markdown Editor",
@@ -8532,7 +8544,7 @@ function getMDXEditorInitScript(config) {
8532
8544
  }
8533
8545
 
8534
8546
  // src/plugins/available/tinymce-plugin/index.ts
8535
- chunk4WMZGHIC_cjs.definePlugin({
8547
+ chunkBP52BFIV_cjs.definePlugin({
8536
8548
  id: "tinymce-plugin",
8537
8549
  version: "1.0.0",
8538
8550
  name: "TinyMCE",
@@ -8802,7 +8814,7 @@ function getQuillCDN(version = "2.0.2") {
8802
8814
  </style>
8803
8815
  `;
8804
8816
  }
8805
- chunk4WMZGHIC_cjs.definePlugin({
8817
+ chunkBP52BFIV_cjs.definePlugin({
8806
8818
  id: "quill-editor",
8807
8819
  version: "1.0.0",
8808
8820
  name: "Quill Editor",
@@ -9010,20 +9022,20 @@ function renderContentFormPage(data, opts) {
9010
9022
  <dl class="space-y-3 text-sm">
9011
9023
  <div>
9012
9024
  <dt class="text-zinc-500 dark:text-zinc-400">Created</dt>
9013
- <dd class="mt-1 text-zinc-950 dark:text-white">${data.created_at ? new Date(data.created_at).toLocaleDateString() : "Unknown"}</dd>
9025
+ <dd class="mt-1 text-zinc-950 dark:text-white">${data.created_at ? new Date(data.created_at * 1e3).toLocaleDateString() : "Unknown"}</dd>
9014
9026
  </div>
9015
9027
  <div>
9016
9028
  <dt class="text-zinc-500 dark:text-zinc-400">Last Modified</dt>
9017
- <dd class="mt-1 text-zinc-950 dark:text-white">${data.updated_at ? new Date(data.updated_at).toLocaleDateString() : "Unknown"}</dd>
9029
+ <dd class="mt-1 text-zinc-950 dark:text-white">${data.updated_at ? new Date(data.updated_at * 1e3).toLocaleDateString() : "Unknown"}</dd>
9018
9030
  </div>
9019
9031
  <div>
9020
9032
  <dt class="text-zinc-500 dark:text-zinc-400">Author</dt>
9021
- <dd class="mt-1 text-zinc-950 dark:text-white">${data.data?.author || "Unknown"}</dd>
9033
+ <dd class="mt-1 text-zinc-950 dark:text-white">${chunkMNWKYY5E_cjs.escapeHtml(String(data.data?.author || data.author_name || "Unknown"))}</dd>
9022
9034
  </div>
9023
9035
  ${data.published_at ? `
9024
9036
  <div>
9025
9037
  <dt class="text-zinc-500 dark:text-zinc-400">Published</dt>
9026
- <dd class="mt-1 text-zinc-950 dark:text-white">${new Date(data.published_at).toLocaleDateString()}</dd>
9038
+ <dd class="mt-1 text-zinc-950 dark:text-white">${new Date(data.published_at * 1e3).toLocaleDateString()}</dd>
9027
9039
  </div>
9028
9040
  ` : ""}
9029
9041
  </dl>
@@ -11376,7 +11388,7 @@ function extractFieldData(fields, formData, options = {}) {
11376
11388
  }
11377
11389
  return { data, errors };
11378
11390
  }
11379
- adminContentRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
11391
+ adminContentRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
11380
11392
  async function getCollectionFields(db, collectionId) {
11381
11393
  console.log(`[getCollectionFields] Loading fields for collection: ${collectionId}`);
11382
11394
  const collectionStmt = db.prepare("SELECT schema, queryable_fields FROM document_types WHERE id = ?");
@@ -11403,7 +11415,7 @@ async function getCollectionFields(db, collectionId) {
11403
11415
  };
11404
11416
  });
11405
11417
  }
11406
- const codeCollections2 = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11418
+ const codeCollections2 = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11407
11419
  const codeMatch = codeCollections2.find((c) => c.name === collectionId);
11408
11420
  if (codeMatch && codeMatch.schema?.properties) {
11409
11421
  console.log(`[getCollectionFields] DB doc type has no properties \u2014 using code collection schema`);
@@ -11435,7 +11447,7 @@ async function getCollectionFields(db, collectionId) {
11435
11447
  }
11436
11448
  }
11437
11449
  console.log(`[getCollectionFields] Not in database, checking code collections`);
11438
- const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11450
+ const codeCollections = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11439
11451
  console.log(`[getCollectionFields] Found ${codeCollections.length} code collections`);
11440
11452
  const codeCollection = codeCollections.find((c) => c.name === collectionId);
11441
11453
  if (codeCollection && codeCollection.schema) {
@@ -11489,7 +11501,7 @@ async function getCollection(db, collectionId) {
11489
11501
  };
11490
11502
  }
11491
11503
  console.log(`[getCollection] Not in database, checking code collections`);
11492
- const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11504
+ const codeCollections = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11493
11505
  const codeCollection = codeCollections.find((c) => c.name === collectionId);
11494
11506
  if (codeCollection) {
11495
11507
  console.log(`[getCollection] Found code collection: ${collectionId}`);
@@ -11508,7 +11520,7 @@ async function getCollection(db, collectionId) {
11508
11520
  }
11509
11521
  async function getDocBackingType(db, collectionName) {
11510
11522
  if (!collectionName) return null;
11511
- const dt = await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db).findById(collectionName);
11523
+ const dt = await new chunk37V3RET3_cjs.DocumentTypeRegistry(db).findById(collectionName);
11512
11524
  return dt && dt.isActive ? dt : null;
11513
11525
  }
11514
11526
  async function getCollectionByName(db, name) {
@@ -11525,7 +11537,7 @@ async function getCollectionByName(db, name) {
11525
11537
  };
11526
11538
  }
11527
11539
  console.log(`[getCollectionByName] Not in database, checking code collections`);
11528
- const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11540
+ const codeCollections = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11529
11541
  const codeCollection = codeCollections.find((c) => c.name === name);
11530
11542
  if (codeCollection) {
11531
11543
  console.log(`[getCollectionByName] Found code collection: ${name}`);
@@ -11541,7 +11553,7 @@ async function getCollectionByName(db, name) {
11541
11553
  return null;
11542
11554
  }
11543
11555
  async function loadContentEditorFlags(db) {
11544
- const flags = { workflowEnabled: await chunkIS54FPB7_cjs.isPluginActive(db, "workflow") };
11556
+ const flags = { workflowEnabled: await chunk37V3RET3_cjs.isPluginActive(db, "workflow") };
11545
11557
  const editors = [
11546
11558
  ["tinymce-plugin", "tinymce"],
11547
11559
  ["quill-editor", "quill"],
@@ -11549,10 +11561,10 @@ async function loadContentEditorFlags(db) {
11549
11561
  ["lexical-editor", "lexical"]
11550
11562
  ];
11551
11563
  for (const [plugin, key] of editors) {
11552
- const enabled = await chunkIS54FPB7_cjs.isPluginActive(db, plugin);
11564
+ const enabled = await chunk37V3RET3_cjs.isPluginActive(db, plugin);
11553
11565
  flags[`${key}Enabled`] = enabled;
11554
11566
  if (enabled) {
11555
- const ps = new chunkAT4ZQGEZ_cjs.PluginService(db);
11567
+ const ps = new chunkQCJHCSOK_cjs.PluginService(db);
11556
11568
  const p = await ps.getPlugin(plugin);
11557
11569
  flags[`${key}Settings`] = p?.settings;
11558
11570
  }
@@ -11588,9 +11600,9 @@ adminContentRoutes.get("/", async (c) => {
11588
11600
  const offset = (page - 1) * limit;
11589
11601
  const collectionsStmt = db.prepare("SELECT id, name, display_name FROM document_types WHERE is_active = 1 ORDER BY display_name");
11590
11602
  const { results: collectionsResults } = await collectionsStmt.all();
11591
- const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11603
+ const codeCollections = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11592
11604
  const codeCollectionMap = new Map(codeCollections.map((c2) => [c2.name, c2]));
11593
- const docTypeRegistry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
11605
+ const docTypeRegistry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
11594
11606
  const docTypes = (await docTypeRegistry.findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth);
11595
11607
  const visibleTypeIds = new Set(docTypes.map((dt) => dt.id));
11596
11608
  const allCollections = [
@@ -11602,7 +11614,7 @@ adminContentRoutes.get("/", async (c) => {
11602
11614
  ...allCollections.map((c2) => ({ name: c2.name, displayName: c2.displayName })),
11603
11615
  ...docTypes.filter((dt) => !collectionNames.has(dt.id)).map((dt) => ({ name: `doc:${dt.id}`, displayName: dt.displayName }))
11604
11616
  ];
11605
- const newContentCollections = await chunkAT4ZQGEZ_cjs.getVisibleCollections(db);
11617
+ const newContentCollections = await chunkQCJHCSOK_cjs.getVisibleCollections(db);
11606
11618
  const docBackedCollection = !modelName.startsWith("doc:") && modelName !== "all" ? docTypes.find((dt) => dt.id === modelName) : void 0;
11607
11619
  const isDocModel = modelName.startsWith("doc:") || !!docBackedCollection;
11608
11620
  if (isDocModel) {
@@ -11625,6 +11637,14 @@ adminContentRoutes.get("/", async (c) => {
11625
11637
  docSql += " ORDER BY updated_at DESC LIMIT ? OFFSET ?";
11626
11638
  docParams.push(limit, offset);
11627
11639
  const { results: docRows } = await db.prepare(docSql).bind(...docParams).all();
11640
+ const docUserIds = [...new Set((docRows ?? []).map((r) => r.created_by).filter(Boolean))];
11641
+ const docAuthorMap = {};
11642
+ for (let i = 0; i < docUserIds.length; i += 99) {
11643
+ const chunk = docUserIds.slice(i, i + 99);
11644
+ const ph = chunk.map(() => "?").join(",");
11645
+ const { results: uRows } = await db.prepare(`SELECT id, email FROM auth_user WHERE id IN (${ph})`).bind(...chunk).all();
11646
+ for (const u of uRows ?? []) docAuthorMap[u.id] = u.email;
11647
+ }
11628
11648
  const statusBadgeCss = {
11629
11649
  published: "bg-green-50 dark:bg-green-500/10 text-green-700 dark:text-green-400 ring-1 ring-inset ring-green-600/20 dark:ring-green-500/20",
11630
11650
  draft: "bg-zinc-50 dark:bg-zinc-500/10 text-zinc-700 dark:text-zinc-400 ring-1 ring-inset ring-zinc-600/20 dark:ring-zinc-500/20"
@@ -11641,7 +11661,7 @@ adminContentRoutes.get("/", async (c) => {
11641
11661
  slug: row.slug || "",
11642
11662
  modelName: docType?.displayName ?? typeId,
11643
11663
  statusBadge: `<span class="inline-flex items-center rounded-md px-2 py-1 text-xs font-medium ${css}">${label}</span>`,
11644
- authorName: row.created_by || "System",
11664
+ authorName: (row.created_by ? docAuthorMap[row.created_by] ?? row.created_by : null) || "System",
11645
11665
  // Document timestamps are stored in SECONDS (documents.ts), unlike legacy content rows which
11646
11666
  // store MILLISECONDS — hence the *1000 here (D23).
11647
11667
  formattedDate: new Date((row.updated_at ?? 0) * 1e3).toLocaleDateString(),
@@ -11689,8 +11709,8 @@ adminContentRoutes.get("/", async (c) => {
11689
11709
  SELECT d.root_id AS id, d.title AS title, d.slug AS slug,
11690
11710
  CASE WHEN d.is_published = 1 THEN 'published' ELSE 'draft' END AS status,
11691
11711
  d.updated_at * 1000 AS updated_at,
11692
- dt.display_name AS cdisplay, COALESCE(d.created_by, 'System') AS author_label
11693
- FROM documents d JOIN document_types dt ON dt.id = d.type_id
11712
+ dt.display_name AS cdisplay, COALESCE(u.email, d.created_by, 'System') AS author_label
11713
+ FROM documents d JOIN document_types dt ON dt.id = d.type_id LEFT JOIN auth_user u ON u.id = d.created_by
11694
11714
  WHERE ${docConds.join(" AND ")}
11695
11715
  ORDER BY updated_at DESC LIMIT ? OFFSET ?`;
11696
11716
  const { results: unionRows } = await db.prepare(unionSql).bind(...docParams, limit, offset).all();
@@ -11879,9 +11899,9 @@ adminContentRoutes.get("/new", async (c) => {
11879
11899
  const collectionsStmt = db2.prepare("SELECT id, name, display_name, description FROM document_types WHERE is_active = 1 ORDER BY display_name");
11880
11900
  const { results } = await collectionsStmt.all();
11881
11901
  const visibleTypeIds = new Set(
11882
- (await new chunkIS54FPB7_cjs.DocumentTypeRegistry(db2).findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth).map((dt) => dt.id)
11902
+ (await new chunk37V3RET3_cjs.DocumentTypeRegistry(db2).findAll()).filter((dt) => !dt.settings?.internal && !dt.isAuth).map((dt) => dt.id)
11883
11903
  );
11884
- const codeCollections = await chunkAT4ZQGEZ_cjs.loadCollectionConfigs();
11904
+ const codeCollections = await chunkQCJHCSOK_cjs.loadCollectionConfigs();
11885
11905
  const dbCollectionNames = new Set((results || []).map((r) => r.name));
11886
11906
  const allCollections = [
11887
11907
  ...codeCollections.filter((c2) => !dbCollectionNames.has(c2.name)).map((c2) => ({
@@ -11947,32 +11967,32 @@ adminContentRoutes.get("/new", async (c) => {
11947
11967
  return c.html(renderContentFormPage(formData2));
11948
11968
  }
11949
11969
  const fields = await getCollectionFields(db, collection.id);
11950
- const workflowEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "workflow");
11951
- const tinymceEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin");
11970
+ const workflowEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "workflow");
11971
+ const tinymceEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "tinymce-plugin");
11952
11972
  let tinymceSettings;
11953
11973
  if (tinymceEnabled) {
11954
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11974
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
11955
11975
  const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
11956
11976
  tinymceSettings = tinymcePlugin2?.settings;
11957
11977
  }
11958
- const quillEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor");
11978
+ const quillEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "quill-editor");
11959
11979
  let quillSettings;
11960
11980
  if (quillEnabled) {
11961
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11981
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
11962
11982
  const quillPlugin = await pluginService.getPlugin("quill-editor");
11963
11983
  quillSettings = quillPlugin?.settings;
11964
11984
  }
11965
- const mdxeditorEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx");
11985
+ const mdxeditorEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "easy-mdx");
11966
11986
  let mdxeditorSettings;
11967
11987
  if (mdxeditorEnabled) {
11968
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11988
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
11969
11989
  const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
11970
11990
  mdxeditorSettings = mdxeditorPlugin?.settings;
11971
11991
  }
11972
- const lexicalEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "lexical-editor");
11992
+ const lexicalEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "lexical-editor");
11973
11993
  let lexicalSettings;
11974
11994
  if (lexicalEnabled) {
11975
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
11995
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
11976
11996
  const lexicalPlugin = await pluginService.getPlugin("lexical-editor");
11977
11997
  lexicalSettings = lexicalPlugin?.settings;
11978
11998
  }
@@ -12031,6 +12051,13 @@ adminContentRoutes.get("/:id/edit", async (c) => {
12031
12051
  if (docType && dcoll) {
12032
12052
  const fields2 = await getCollectionFields(db, dcoll.id);
12033
12053
  const flags = await loadContentEditorFlags(db);
12054
+ let authorName;
12055
+ if (docRow.created_by) {
12056
+ const authorRow = await db.prepare("SELECT name, first_name, last_name, email FROM auth_user WHERE id = ?").bind(docRow.created_by).first();
12057
+ if (authorRow) {
12058
+ authorName = authorRow.name || [authorRow.first_name, authorRow.last_name].filter(Boolean).join(" ") || authorRow.email;
12059
+ }
12060
+ }
12034
12061
  const formData2 = {
12035
12062
  id: docRow.root_id,
12036
12063
  title: docRow.title,
@@ -12045,6 +12072,7 @@ adminContentRoutes.get("/:id/edit", async (c) => {
12045
12072
  isEdit: true,
12046
12073
  referrerParams,
12047
12074
  versioningEnabled: docType?.settings?.versioning === true,
12075
+ author_name: authorName,
12048
12076
  user: user ? { name: user.email, email: user.email, role: user.role } : void 0,
12049
12077
  version: c.get("appVersion"),
12050
12078
  ...flags
@@ -12100,32 +12128,32 @@ adminContentRoutes.get("/:id/edit", async (c) => {
12100
12128
  };
12101
12129
  const fields = await getCollectionFields(db, content.collection_id);
12102
12130
  const contentData = content.data ? JSON.parse(content.data) : {};
12103
- const workflowEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "workflow");
12104
- const tinymceEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin");
12131
+ const workflowEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "workflow");
12132
+ const tinymceEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "tinymce-plugin");
12105
12133
  let tinymceSettings;
12106
12134
  if (tinymceEnabled) {
12107
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12135
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
12108
12136
  const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
12109
12137
  tinymceSettings = tinymcePlugin2?.settings;
12110
12138
  }
12111
- const quillEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor");
12139
+ const quillEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "quill-editor");
12112
12140
  let quillSettings;
12113
12141
  if (quillEnabled) {
12114
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12142
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
12115
12143
  const quillPlugin = await pluginService.getPlugin("quill-editor");
12116
12144
  quillSettings = quillPlugin?.settings;
12117
12145
  }
12118
- const mdxeditorEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx");
12146
+ const mdxeditorEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "easy-mdx");
12119
12147
  let mdxeditorSettings;
12120
12148
  if (mdxeditorEnabled) {
12121
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12149
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
12122
12150
  const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
12123
12151
  mdxeditorSettings = mdxeditorPlugin?.settings;
12124
12152
  }
12125
- const lexicalEnabled = await chunkIS54FPB7_cjs.isPluginActive(db, "lexical-editor");
12153
+ const lexicalEnabled = await chunk37V3RET3_cjs.isPluginActive(db, "lexical-editor");
12126
12154
  let lexicalSettings;
12127
12155
  if (lexicalEnabled) {
12128
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
12156
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
12129
12157
  const lexicalPlugin = await pluginService.getPlugin("lexical-editor");
12130
12158
  lexicalSettings = lexicalPlugin?.settings;
12131
12159
  }
@@ -12204,6 +12232,7 @@ adminContentRoutes.post("/", async (c) => {
12204
12232
  const fields = await getCollectionFields(db, collectionId);
12205
12233
  const { data, errors } = extractFieldData(fields, formData);
12206
12234
  if (Object.keys(errors).length > 0) {
12235
+ const flags = await loadContentEditorFlags(db);
12207
12236
  const formDataWithErrors = {
12208
12237
  collection,
12209
12238
  fields,
@@ -12214,7 +12243,8 @@ adminContentRoutes.post("/", async (c) => {
12214
12243
  name: user.email,
12215
12244
  email: user.email,
12216
12245
  role: user.role
12217
- } : void 0
12246
+ } : void 0,
12247
+ ...flags
12218
12248
  };
12219
12249
  if (c.req.header("HX-Request") === "true") {
12220
12250
  c.header("HX-Retarget", "#content-form-page");
@@ -12395,6 +12425,7 @@ adminContentRoutes.put("/:id", async (c) => {
12395
12425
  const fields = await getCollectionFields(db, existingContent.collection_id);
12396
12426
  const { data, errors } = extractFieldData(fields, formData);
12397
12427
  if (Object.keys(errors).length > 0) {
12428
+ const flags = await loadContentEditorFlags(db);
12398
12429
  const formDataWithErrors = {
12399
12430
  id,
12400
12431
  collection,
@@ -12407,7 +12438,8 @@ adminContentRoutes.put("/:id", async (c) => {
12407
12438
  name: user.email,
12408
12439
  email: user.email,
12409
12440
  role: user.role
12410
- } : void 0
12441
+ } : void 0,
12442
+ ...flags
12411
12443
  };
12412
12444
  if (c.req.header("HX-Request") === "true") {
12413
12445
  c.header("HX-Retarget", "#content-form-page");
@@ -12498,7 +12530,7 @@ adminContentRoutes.put("/:id", async (c) => {
12498
12530
  `);
12499
12531
  }
12500
12532
  });
12501
- adminContentRoutes.post("/preview", chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12533
+ adminContentRoutes.post("/preview", chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12502
12534
  try {
12503
12535
  const formData = await c.req.formData();
12504
12536
  const collectionId = formData.get("collection_id");
@@ -12817,7 +12849,7 @@ adminContentRoutes.delete("/:id", async (c) => {
12817
12849
  return c.json({ success: false, error: "Failed to delete content" }, 500);
12818
12850
  }
12819
12851
  });
12820
- adminContentRoutes.get("/:id/version/:version/preview", chunkIS54FPB7_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12852
+ adminContentRoutes.get("/:id/version/:version/preview", chunk37V3RET3_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
12821
12853
  try {
12822
12854
  const id = c.req.param("id");
12823
12855
  const version = parseInt(c.req.param("version") || "0");
@@ -12913,7 +12945,7 @@ function parseDocFormData(formData, queryableFields = []) {
12913
12945
  return { title, slug, data };
12914
12946
  }
12915
12947
  async function getDocService(db, typeId, tenantId) {
12916
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
12948
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
12917
12949
  const docType = await registry.findById(typeId);
12918
12950
  const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
12919
12951
  queryableFields: docType?.queryableFields ?? [],
@@ -12926,7 +12958,7 @@ async function getDocService(db, typeId, tenantId) {
12926
12958
  }
12927
12959
  adminContentRoutes.get("/documents/:typeId/new", async (c) => {
12928
12960
  const { typeId } = c.req.param();
12929
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
12961
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(c.env.DB);
12930
12962
  const docType = await registry.findById(typeId);
12931
12963
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12932
12964
  return c.html(chunkJMJM7DMM_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c) }));
@@ -12951,7 +12983,7 @@ adminContentRoutes.post("/documents/:typeId/new", async (c) => {
12951
12983
  }), user?.userId);
12952
12984
  return c.redirect(`/admin/content/documents/${typeId}/${doc.rootId}/edit?message=Created+successfully`);
12953
12985
  } catch (err) {
12954
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(c.env.DB);
12986
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(c.env.DB);
12955
12987
  const docType = await registry.findById(typeId);
12956
12988
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12957
12989
  return c.html(chunkJMJM7DMM_cjs.renderDocumentFormPage({ docType, isEdit: false, user: userCtx(c), message: err?.message ?? "Failed to create", messageType: "error" }));
@@ -12961,7 +12993,7 @@ adminContentRoutes.get("/documents/:typeId/:rootId/edit", async (c) => {
12961
12993
  const { typeId, rootId } = c.req.param();
12962
12994
  const db = c.env.DB;
12963
12995
  const message = c.req.query("message");
12964
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
12996
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
12965
12997
  const docType = await registry.findById(typeId);
12966
12998
  if (!docType) return c.html("<p>Unknown document type.</p>", 404);
12967
12999
  const tenantId = reqTenant(c);
@@ -13074,11 +13106,11 @@ adminContentRoutes.get("/documents/:typeId/:rootId/versions", async (c) => {
13074
13106
  const { typeId, rootId } = c.req.param();
13075
13107
  const db = c.env.DB;
13076
13108
  const { renderVersionHistoryFragment } = await import('./admin-documents-form.template-YNAVMJCV.cjs');
13077
- const registry = new chunkIS54FPB7_cjs.DocumentTypeRegistry(db);
13109
+ const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
13078
13110
  const docType = await registry.findById(typeId);
13079
13111
  if (!docType) return c.html("<div>Unknown type.</div>", 404);
13080
13112
  const result = await db.prepare(
13081
- "SELECT id, version_number, is_current_draft, is_published, status, updated_at, created_by FROM documents WHERE root_id = ? AND tenant_id = ? ORDER BY version_number DESC LIMIT 50"
13113
+ "SELECT d.id, d.version_number, d.is_current_draft, d.is_published, d.status, d.updated_at, COALESCE(u.email, d.created_by) AS created_by FROM documents d LEFT JOIN auth_user u ON u.id = d.created_by WHERE d.root_id = ? AND d.tenant_id = ? ORDER BY d.version_number DESC LIMIT 50"
13082
13114
  ).bind(rootId, reqTenant(c)).all();
13083
13115
  const versions = (result.results ?? []).map((r) => ({
13084
13116
  id: r.id,
@@ -15007,7 +15039,7 @@ var TenantService = class {
15007
15039
  SET name = ?, domain = ?, status = ?, notes = ?, updated_at = ?
15008
15040
  WHERE slug = ?
15009
15041
  `).bind(name, domain, status, notes, now, slug).run();
15010
- chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15042
+ chunkQCJHCSOK_cjs.invalidateTenantCache();
15011
15043
  const updated = await this.getTenantBySlug(slug);
15012
15044
  if (!updated) throw new Error("Tenant not found");
15013
15045
  return updated;
@@ -15025,7 +15057,7 @@ var TenantService = class {
15025
15057
  throw new Error(`Tenant '${slug}' still owns ${docCount} document(s). Delete or migrate its content first.`);
15026
15058
  }
15027
15059
  await this.db.prepare(`DELETE FROM auth_tenant WHERE slug = ?`).bind(slug).run();
15028
- chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15060
+ chunkQCJHCSOK_cjs.invalidateTenantCache();
15029
15061
  }
15030
15062
  // ─── Membership (auth_tenant_member) ───────────────────────────────────────
15031
15063
  // Tenant resolution and the admin switcher are gated on membership: an authed user may only
@@ -15269,7 +15301,7 @@ var TenantService = class {
15269
15301
  INSERT INTO auth_tenant (id, name, slug, status, domain, notes, metadata, created_at, updated_at)
15270
15302
  VALUES (?, ?, ?, 'active', ?, ?, '{}', ?, ?)
15271
15303
  `).bind(id, input.name, input.slug, input.domain, input.notes, now, now).run();
15272
- chunkAT4ZQGEZ_cjs.invalidateTenantCache();
15304
+ chunkQCJHCSOK_cjs.invalidateTenantCache();
15273
15305
  const created = await this.getTenantBySlug(input.slug);
15274
15306
  if (!created) throw new Error("Failed to create tenant");
15275
15307
  return created;
@@ -15293,14 +15325,14 @@ function mapRowToTenant(row) {
15293
15325
 
15294
15326
  // src/routes/admin-users.ts
15295
15327
  var userRoutes = new hono.Hono();
15296
- userRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
15297
- userRoutes.use("/users/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15298
- userRoutes.use("/users", chunkIS54FPB7_cjs.requireRole(["admin"]));
15299
- userRoutes.use("/invite-user", chunkIS54FPB7_cjs.requireRole(["admin"]));
15300
- userRoutes.use("/resend-invitation/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15301
- userRoutes.use("/cancel-invitation/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15302
- userRoutes.use("/activity-logs", chunkIS54FPB7_cjs.requireRole(["admin"]));
15303
- userRoutes.use("/activity-logs/*", chunkIS54FPB7_cjs.requireRole(["admin"]));
15328
+ userRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
15329
+ userRoutes.use("/users/*", chunk37V3RET3_cjs.requireRole(["admin"]));
15330
+ userRoutes.use("/users", chunk37V3RET3_cjs.requireRole(["admin"]));
15331
+ userRoutes.use("/invite-user", chunk37V3RET3_cjs.requireRole(["admin"]));
15332
+ userRoutes.use("/resend-invitation/*", chunk37V3RET3_cjs.requireRole(["admin"]));
15333
+ userRoutes.use("/cancel-invitation/*", chunk37V3RET3_cjs.requireRole(["admin"]));
15334
+ userRoutes.use("/activity-logs", chunk37V3RET3_cjs.requireRole(["admin"]));
15335
+ userRoutes.use("/activity-logs/*", chunk37V3RET3_cjs.requireRole(["admin"]));
15304
15336
  userRoutes.get("/", (c) => {
15305
15337
  return c.redirect("/admin/dashboard");
15306
15338
  });
@@ -15467,7 +15499,7 @@ userRoutes.put("/profile", async (c) => {
15467
15499
  }
15468
15500
  await saveCustomData(db, user.userId, sanitized);
15469
15501
  }
15470
- await chunkIS54FPB7_cjs.logActivity(
15502
+ await chunk37V3RET3_cjs.logActivity(
15471
15503
  db,
15472
15504
  user.userId,
15473
15505
  "profile.update",
@@ -15530,7 +15562,7 @@ userRoutes.post("/profile/avatar", async (c) => {
15530
15562
  SELECT first_name, last_name FROM auth_user WHERE id = ?
15531
15563
  `);
15532
15564
  const userData = await userStmt.bind(user.userId).first();
15533
- await chunkIS54FPB7_cjs.logActivity(
15565
+ await chunk37V3RET3_cjs.logActivity(
15534
15566
  db,
15535
15567
  user.userId,
15536
15568
  "profile.avatar_update",
@@ -15601,7 +15633,7 @@ userRoutes.post("/profile/password", async (c) => {
15601
15633
  dismissible: true
15602
15634
  }));
15603
15635
  }
15604
- const validPassword = await chunkIS54FPB7_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
15636
+ const validPassword = await chunk37V3RET3_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
15605
15637
  if (!validPassword) {
15606
15638
  return c.html(chunkJMJM7DMM_cjs.renderAlert({
15607
15639
  type: "error",
@@ -15609,7 +15641,7 @@ userRoutes.post("/profile/password", async (c) => {
15609
15641
  dismissible: true
15610
15642
  }));
15611
15643
  }
15612
- const newPasswordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(newPassword);
15644
+ const newPasswordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(newPassword);
15613
15645
  const historyStmt = db.prepare(`
15614
15646
  INSERT INTO auth_password_history (id, user_id, password_hash, created_at)
15615
15647
  VALUES (?, ?, ?, ?)
@@ -15625,7 +15657,7 @@ userRoutes.post("/profile/password", async (c) => {
15625
15657
  WHERE id = ?
15626
15658
  `);
15627
15659
  await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
15628
- await chunkIS54FPB7_cjs.logActivity(
15660
+ await chunk37V3RET3_cjs.logActivity(
15629
15661
  db,
15630
15662
  user.userId,
15631
15663
  "profile.password_change",
@@ -15692,7 +15724,7 @@ userRoutes.get("/users", async (c) => {
15692
15724
  `);
15693
15725
  const countResult = await countStmt.bind(...params).first();
15694
15726
  const totalUsers = countResult?.total || 0;
15695
- await chunkIS54FPB7_cjs.logActivity(
15727
+ await chunk37V3RET3_cjs.logActivity(
15696
15728
  db,
15697
15729
  user.userId,
15698
15730
  "users.list_view",
@@ -15873,7 +15905,7 @@ userRoutes.post("/users/new", async (c) => {
15873
15905
  dismissible: true
15874
15906
  }));
15875
15907
  }
15876
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(password);
15908
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
15877
15909
  const userId = crypto.randomUUID();
15878
15910
  const createStmt = db.prepare(`
15879
15911
  INSERT INTO auth_user (
@@ -15898,7 +15930,7 @@ userRoutes.post("/users/new", async (c) => {
15898
15930
  if (sanitizedRegistrationCustom !== null && Object.keys(sanitizedRegistrationCustom).length > 0) {
15899
15931
  await writeProfileData(db, userId, { custom: sanitizedRegistrationCustom }, user.userId);
15900
15932
  }
15901
- await chunkIS54FPB7_cjs.logActivity(
15933
+ await chunk37V3RET3_cjs.logActivity(
15902
15934
  db,
15903
15935
  user.userId,
15904
15936
  "user!.create",
@@ -15937,7 +15969,7 @@ userRoutes.get("/users/:id", async (c) => {
15937
15969
  if (!userRecord) {
15938
15970
  return c.json({ error: "User not found" }, 404);
15939
15971
  }
15940
- await chunkIS54FPB7_cjs.logActivity(
15972
+ await chunk37V3RET3_cjs.logActivity(
15941
15973
  db,
15942
15974
  user.userId,
15943
15975
  "user!.view",
@@ -16151,7 +16183,7 @@ userRoutes.put("/users/:id", async (c) => {
16151
16183
  userId
16152
16184
  ).run();
16153
16185
  if (newPassword) {
16154
- const passwordHash = await chunkIS54FPB7_cjs.AuthManager.hashPassword(newPassword);
16186
+ const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(newPassword);
16155
16187
  const updatePasswordStmt = db.prepare(`
16156
16188
  UPDATE auth_user SET password_hash = ?, updated_at = ? WHERE id = ?
16157
16189
  `);
@@ -16164,7 +16196,7 @@ userRoutes.put("/users/:id", async (c) => {
16164
16196
  ...sanitizedCustom !== null ? { custom: sanitizedCustom } : {}
16165
16197
  }, user.userId);
16166
16198
  }
16167
- await chunkIS54FPB7_cjs.logActivity(
16199
+ await chunk37V3RET3_cjs.logActivity(
16168
16200
  db,
16169
16201
  user.userId,
16170
16202
  "user.update",
@@ -16210,7 +16242,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
16210
16242
  UPDATE auth_user SET is_active = ?, updated_at = ? WHERE id = ?
16211
16243
  `);
16212
16244
  await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
16213
- await chunkIS54FPB7_cjs.logActivity(
16245
+ await chunk37V3RET3_cjs.logActivity(
16214
16246
  db,
16215
16247
  user.userId,
16216
16248
  active ? "user.activate" : "user.deactivate",
@@ -16251,7 +16283,7 @@ userRoutes.delete("/users/:id", async (c) => {
16251
16283
  DELETE FROM auth_user WHERE id = ?
16252
16284
  `);
16253
16285
  await deleteStmt.bind(userId).run();
16254
- await chunkIS54FPB7_cjs.logActivity(
16286
+ await chunk37V3RET3_cjs.logActivity(
16255
16287
  db,
16256
16288
  user.userId,
16257
16289
  "user!.hard_delete",
@@ -16270,7 +16302,7 @@ userRoutes.delete("/users/:id", async (c) => {
16270
16302
  UPDATE auth_user SET is_active = 0, updated_at = ? WHERE id = ?
16271
16303
  `);
16272
16304
  await deleteStmt.bind(Date.now(), userId).run();
16273
- await chunkIS54FPB7_cjs.logActivity(
16305
+ await chunk37V3RET3_cjs.logActivity(
16274
16306
  db,
16275
16307
  user.userId,
16276
16308
  "user!.soft_delete",
@@ -16336,7 +16368,7 @@ userRoutes.post("/invite-user", async (c) => {
16336
16368
  Date.now(),
16337
16369
  Date.now()
16338
16370
  ).run();
16339
- await chunkIS54FPB7_cjs.logActivity(
16371
+ await chunk37V3RET3_cjs.logActivity(
16340
16372
  db,
16341
16373
  user.userId,
16342
16374
  "user!.invite_sent",
@@ -16393,7 +16425,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
16393
16425
  Date.now(),
16394
16426
  userId
16395
16427
  ).run();
16396
- await chunkIS54FPB7_cjs.logActivity(
16428
+ await chunk37V3RET3_cjs.logActivity(
16397
16429
  db,
16398
16430
  user.userId,
16399
16431
  "user!.invitation_resent",
@@ -16429,7 +16461,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
16429
16461
  }
16430
16462
  const deleteStmt = db.prepare(`DELETE FROM auth_user WHERE id = ?`);
16431
16463
  await deleteStmt.bind(userId).run();
16432
- await chunkIS54FPB7_cjs.logActivity(
16464
+ await chunk37V3RET3_cjs.logActivity(
16433
16465
  db,
16434
16466
  user.userId,
16435
16467
  "user!.invitation_cancelled",
@@ -17810,7 +17842,7 @@ var fileValidationSchema2 = zod.z.object({
17810
17842
  // 50MB max
17811
17843
  });
17812
17844
  var adminMediaRoutes = new hono.Hono();
17813
- adminMediaRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
17845
+ adminMediaRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
17814
17846
  adminMediaRoutes.get("/", async (c) => {
17815
17847
  try {
17816
17848
  const user = c.get("user");
@@ -17852,7 +17884,7 @@ adminMediaRoutes.get("/selector", async (c) => {
17852
17884
  const { searchParams } = new URL(c.req.url);
17853
17885
  const search = searchParams.get("search") || "";
17854
17886
  const db = c.env.DB;
17855
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
17887
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
17856
17888
  const mediaPlugin = await pluginService.getPlugin("core-media");
17857
17889
  if (!mediaPlugin || mediaPlugin.status !== "active") {
17858
17890
  return c.html(html.html`
@@ -18228,7 +18260,7 @@ adminMediaRoutes.put("/:id", async (c) => {
18228
18260
  `);
18229
18261
  }
18230
18262
  });
18231
- adminMediaRoutes.delete("/cleanup", chunkIS54FPB7_cjs.requireRole("admin"), async (c) => {
18263
+ adminMediaRoutes.delete("/cleanup", chunk37V3RET3_cjs.requireRole("admin"), async (c) => {
18232
18264
  try {
18233
18265
  const db = c.env.DB;
18234
18266
  const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
@@ -19347,7 +19379,7 @@ function escapeHtmlAttr(value) {
19347
19379
  }
19348
19380
  function renderPluginSettingsPage(data) {
19349
19381
  const { plugin, activity = [], user, settingsTabData } = data;
19350
- const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(plugin.id || plugin.name);
19382
+ const pluginDef = chunkBP52BFIV_cjs.getPluginDefinition(plugin.id || plugin.name);
19351
19383
  const hasUserSettings = pluginDef?.settingsTabContent != null || Object.keys(plugin.settings || {}).some((k) => !k.startsWith("_"));
19352
19384
  const defaultTab = hasUserSettings ? "settings" : "info";
19353
19385
  const pageContent = `
@@ -19653,7 +19685,7 @@ function renderSettingsTab(plugin, settingsTabData) {
19653
19685
  const settings = plugin.settings || {};
19654
19686
  const pluginId = plugin.id || plugin.name;
19655
19687
  const hasUserKeys = Object.keys(settings).some((k) => !k.startsWith("_"));
19656
- const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
19688
+ const pluginDef = chunkBP52BFIV_cjs.getPluginDefinition(pluginId);
19657
19689
  if (pluginDef?.settingsTabContent) {
19658
19690
  return pluginDef.settingsTabContent.render({ plugin, settings, data: settingsTabData });
19659
19691
  }
@@ -20843,8 +20875,8 @@ async function fetchActivePluginIds(db) {
20843
20875
  }
20844
20876
  async function reconcileMenuFromPlugins(db) {
20845
20877
  try {
20846
- const singletonEntries = chunk4WMZGHIC_cjs.getPluginMenu();
20847
- const manifestEntries = Object.values(chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY).filter(
20878
+ const singletonEntries = chunkBP52BFIV_cjs.getPluginMenu();
20879
+ const manifestEntries = Object.values(chunkQCJHCSOK_cjs.PLUGIN_REGISTRY).filter(
20848
20880
  (p) => p.adminMenu !== null
20849
20881
  );
20850
20882
  const byPluginId = /* @__PURE__ */ new Map();
@@ -20881,8 +20913,8 @@ async function reconcileMenuFromPlugins(db) {
20881
20913
 
20882
20914
  // src/routes/admin-plugins.ts
20883
20915
  var adminPluginRoutes = new hono.Hono();
20884
- adminPluginRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
20885
- var AVAILABLE_PLUGINS = Object.values(chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY).map((p) => ({
20916
+ adminPluginRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
20917
+ var AVAILABLE_PLUGINS = Object.values(chunkQCJHCSOK_cjs.PLUGIN_REGISTRY).map((p) => ({
20886
20918
  id: p.id,
20887
20919
  name: p.codeName,
20888
20920
  display_name: p.displayName,
@@ -20902,7 +20934,7 @@ adminPluginRoutes.get("/", async (c) => {
20902
20934
  if (user?.role !== "admin") {
20903
20935
  return c.text("Access denied", 403);
20904
20936
  }
20905
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
20937
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
20906
20938
  let installedPlugins = [];
20907
20939
  let stats = { total: 0, active: 0, inactive: 0, errors: 0, uninstalled: 0 };
20908
20940
  try {
@@ -20976,10 +21008,10 @@ adminPluginRoutes.get("/:id", async (c) => {
20976
21008
  if (user?.role !== "admin") {
20977
21009
  return c.redirect("/admin/plugins");
20978
21010
  }
20979
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21011
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
20980
21012
  let plugin = await pluginService.getPlugin(pluginId);
20981
21013
  if (!plugin) {
20982
- const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
21014
+ const def = chunkBP52BFIV_cjs.getPluginDefinition(pluginId);
20983
21015
  if (!def) return c.text("Plugin not found", 404);
20984
21016
  plugin = await pluginService.ensurePlugin(pluginId, {
20985
21017
  displayName: def.displayName ?? pluginId,
@@ -21050,7 +21082,7 @@ adminPluginRoutes.get("/:id", async (c) => {
21050
21082
  timestamp: item.timestamp,
21051
21083
  user: item.userId || null
21052
21084
  }));
21053
- const pluginDef = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
21085
+ const pluginDef = chunkBP52BFIV_cjs.getPluginDefinition(pluginId);
21054
21086
  let settingsTabData = void 0;
21055
21087
  if (pluginDef?.settingsTabContent?.loadData) {
21056
21088
  try {
@@ -21080,14 +21112,14 @@ adminPluginRoutes.get("/:id/configure", async (c) => {
21080
21112
  const user = c.get("user");
21081
21113
  const pluginId = c.req.param("id");
21082
21114
  if (user?.role !== "admin") return c.redirect("/admin/plugins");
21083
- const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
21115
+ const def = chunkBP52BFIV_cjs.getPluginDefinition(pluginId);
21084
21116
  if (!def?.configSchema) return c.text("No schema-driven settings for this plugin", 404);
21085
21117
  const db = c.env.DB;
21086
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21118
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21087
21119
  const plugin = await pluginService.getPlugin(pluginId);
21088
21120
  const stored = plugin?.settings ?? {};
21089
- const values = chunk4WMZGHIC_cjs.applySchemaDefaults(def.configSchema, stored);
21090
- const fieldsHtml = chunk4WMZGHIC_cjs.renderSchemaFields(def.configSchema, values);
21121
+ const values = chunkBP52BFIV_cjs.applySchemaDefaults(def.configSchema, stored);
21122
+ const fieldsHtml = chunkBP52BFIV_cjs.renderSchemaFields(def.configSchema, values);
21091
21123
  const displayName = plugin?.display_name ?? def.displayName ?? def.id;
21092
21124
  return c.html(`<!DOCTYPE html>
21093
21125
  <html lang="en"><head>
@@ -21114,12 +21146,12 @@ adminPluginRoutes.post("/:id/configure", async (c) => {
21114
21146
  const user = c.get("user");
21115
21147
  const pluginId = c.req.param("id");
21116
21148
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
21117
- const def = chunk4WMZGHIC_cjs.getPluginDefinition(pluginId);
21149
+ const def = chunkBP52BFIV_cjs.getPluginDefinition(pluginId);
21118
21150
  if (!def?.configSchema) return c.text("No schema-driven settings for this plugin", 404);
21119
21151
  const form = await c.req.formData();
21120
- const parsed = chunk4WMZGHIC_cjs.parseFormDataToSettings(def.configSchema, form);
21152
+ const parsed = chunkBP52BFIV_cjs.parseFormDataToSettings(def.configSchema, form);
21121
21153
  const db = c.env.DB;
21122
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21154
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21123
21155
  await pluginService.ensurePlugin(pluginId, {
21124
21156
  displayName: def.displayName ?? pluginId,
21125
21157
  version: def.version,
@@ -21143,7 +21175,7 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
21143
21175
  if (user?.role !== "admin") {
21144
21176
  return c.json({ error: "Access denied" }, 403);
21145
21177
  }
21146
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21178
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21147
21179
  await pluginService.activatePlugin(pluginId);
21148
21180
  await reconcileMenuFromPlugins(db);
21149
21181
  return c.json({ success: true });
@@ -21161,7 +21193,7 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
21161
21193
  if (user?.role !== "admin") {
21162
21194
  return c.json({ error: "Access denied" }, 403);
21163
21195
  }
21164
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21196
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21165
21197
  await pluginService.deactivatePlugin(pluginId);
21166
21198
  await reconcileMenuFromPlugins(db);
21167
21199
  return c.json({ success: true });
@@ -21179,8 +21211,8 @@ adminPluginRoutes.post("/install", async (c) => {
21179
21211
  return c.json({ error: "Access denied" }, 403);
21180
21212
  }
21181
21213
  const body = await c.req.json();
21182
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21183
- const registryEntry = chunkAT4ZQGEZ_cjs.findPluginByCodeName(body.name) || chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY[body.name] || chunkAT4ZQGEZ_cjs.PLUGIN_REGISTRY[body.id];
21214
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21215
+ const registryEntry = chunkQCJHCSOK_cjs.findPluginByCodeName(body.name) || chunkQCJHCSOK_cjs.PLUGIN_REGISTRY[body.name] || chunkQCJHCSOK_cjs.PLUGIN_REGISTRY[body.id];
21184
21216
  if (!registryEntry) {
21185
21217
  return c.json({ error: "Plugin not found in registry" }, 404);
21186
21218
  }
@@ -21213,7 +21245,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
21213
21245
  if (user?.role !== "admin") {
21214
21246
  return c.json({ error: "Access denied" }, 403);
21215
21247
  }
21216
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21248
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21217
21249
  await pluginService.uninstallPlugin(pluginId);
21218
21250
  return c.json({ success: true });
21219
21251
  } catch (error) {
@@ -21231,7 +21263,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
21231
21263
  return c.json({ error: "Access denied" }, 403);
21232
21264
  }
21233
21265
  const settings = await c.req.json();
21234
- const pluginService = new chunkAT4ZQGEZ_cjs.PluginService(db);
21266
+ const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
21235
21267
  const existingPlugin = await pluginService.getPlugin(pluginId);
21236
21268
  const existingSettings = existingPlugin?.settings ?? {};
21237
21269
  await pluginService.updatePluginSettings(pluginId, { ...existingSettings, ...settings });
@@ -22041,7 +22073,7 @@ function renderLogConfigPage(data) {
22041
22073
 
22042
22074
  // src/routes/admin-logs.ts
22043
22075
  var adminLogsRoutes = new hono.Hono();
22044
- adminLogsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
22076
+ adminLogsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
22045
22077
  adminLogsRoutes.get("/", async (c) => {
22046
22078
  try {
22047
22079
  const user = c.get("user");
@@ -23033,9 +23065,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
23033
23065
  }
23034
23066
 
23035
23067
  // src/routes/admin-dashboard.ts
23036
- var VERSION = chunkC3ZQP5NW_cjs.getCoreVersion();
23068
+ var VERSION = chunkKKNEYIZJ_cjs.getCoreVersion();
23037
23069
  var router = new hono.Hono();
23038
- router.use("*", chunkIS54FPB7_cjs.requireAuth());
23070
+ router.use("*", chunk37V3RET3_cjs.requireAuth());
23039
23071
  router.get("/", async (c) => {
23040
23072
  const user = c.get("user");
23041
23073
  try {
@@ -25000,7 +25032,7 @@ function renderCollectionFormPage(data) {
25000
25032
  // src/routes/admin-collections.ts
25001
25033
  chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
25002
25034
  var adminCollectionsRoutes = new hono.Hono();
25003
- adminCollectionsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
25035
+ adminCollectionsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
25004
25036
  adminCollectionsRoutes.get("/", async (c) => {
25005
25037
  try {
25006
25038
  const user = c.get("user");
@@ -25017,7 +25049,7 @@ adminCollectionsRoutes.get("/", async (c) => {
25017
25049
  results = queryResults.results ?? [];
25018
25050
  } catch (e) {
25019
25051
  }
25020
- const codeCollections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().list();
25052
+ const codeCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().list();
25021
25053
  const codeCollectionsMap = new Map(
25022
25054
  codeCollections.map((cfg) => {
25023
25055
  const fieldCount = cfg.schema?.properties ? Object.keys(cfg.schema.properties).length : 0;
@@ -25031,7 +25063,7 @@ adminCollectionsRoutes.get("/", async (c) => {
25031
25063
  field_count: fieldCount,
25032
25064
  managed: cfg.managed !== false,
25033
25065
  source_type: "code",
25034
- internal: chunkAT4ZQGEZ_cjs.isCodeCollectionInternal(cfg),
25066
+ internal: chunkQCJHCSOK_cjs.isCodeCollectionInternal(cfg),
25035
25067
  versioning: cfg.versioning === true
25036
25068
  }];
25037
25069
  })
@@ -25070,7 +25102,7 @@ adminCollectionsRoutes.get("/", async (c) => {
25070
25102
  field_count: fieldCount,
25071
25103
  managed: false,
25072
25104
  source_type: row.source === "code" || row.source === "system" || row.source === "plugin" ? "code" : "user",
25073
- internal: chunkAT4ZQGEZ_cjs.isDbDocTypeInternal(row.source),
25105
+ internal: chunkQCJHCSOK_cjs.isDbDocTypeInternal(row.source),
25074
25106
  versioning: dbVersioning
25075
25107
  };
25076
25108
  });
@@ -25231,7 +25263,7 @@ export const myPlugin = definePlugin({
25231
25263
  title: "Add a Collection",
25232
25264
  pageTitle: "Add a Collection",
25233
25265
  currentPath: "/admin/collections",
25234
- version: chunkC3ZQP5NW_cjs.getCoreVersion(),
25266
+ version: chunkKKNEYIZJ_cjs.getCoreVersion(),
25235
25267
  user: u ? { name: u.email ?? "Admin", email: u.email ?? "", role: u.role ?? "admin" } : void 0,
25236
25268
  content
25237
25269
  })
@@ -25248,7 +25280,7 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25248
25280
  collection = await stmt.bind(id).first();
25249
25281
  } catch {
25250
25282
  }
25251
- const registryRecord = chunkAT4ZQGEZ_cjs.getCollectionRegistry().getById(id) ?? chunkAT4ZQGEZ_cjs.getCollectionRegistry().getByName(id);
25283
+ const registryRecord = chunkQCJHCSOK_cjs.getCollectionRegistry().getById(id) ?? chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(id);
25252
25284
  if (!collection && !registryRecord) {
25253
25285
  const formData2 = {
25254
25286
  isEdit: true,
@@ -25295,9 +25327,9 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25295
25327
  isCodeDriven = true;
25296
25328
  }
25297
25329
  const [tinymceActive, quillActive, mdxeditorActive] = await Promise.all([
25298
- chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin"),
25299
- chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor"),
25300
- chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx")
25330
+ chunk37V3RET3_cjs.isPluginActive(db, "tinymce-plugin"),
25331
+ chunk37V3RET3_cjs.isPluginActive(db, "quill-editor"),
25332
+ chunk37V3RET3_cjs.isPluginActive(db, "easy-mdx")
25301
25333
  ]);
25302
25334
  const displayName = collection?.display_name ?? registryRecord?.displayName ?? id;
25303
25335
  const formData = {
@@ -25317,9 +25349,9 @@ adminCollectionsRoutes.get("/:id", async (c) => {
25317
25349
  console.error("Error fetching collection:", error);
25318
25350
  const user = c.get("user");
25319
25351
  const [tinymceActive, quillActive, mdxeditorActive] = await Promise.all([
25320
- chunkIS54FPB7_cjs.isPluginActive(db, "tinymce-plugin"),
25321
- chunkIS54FPB7_cjs.isPluginActive(db, "quill-editor"),
25322
- chunkIS54FPB7_cjs.isPluginActive(db, "easy-mdx")
25352
+ chunk37V3RET3_cjs.isPluginActive(db, "tinymce-plugin"),
25353
+ chunk37V3RET3_cjs.isPluginActive(db, "quill-editor"),
25354
+ chunk37V3RET3_cjs.isPluginActive(db, "easy-mdx")
25323
25355
  ]);
25324
25356
  const formData = {
25325
25357
  isEdit: true,
@@ -26268,7 +26300,7 @@ function renderDatabaseToolsSettings(settings) {
26268
26300
 
26269
26301
  // src/routes/admin-settings.ts
26270
26302
  var adminSettingsRoutes = new hono.Hono();
26271
- adminSettingsRoutes.use("*", chunkIS54FPB7_cjs.requireAuth());
26303
+ adminSettingsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
26272
26304
  function getMockSettings(user) {
26273
26305
  return {
26274
26306
  general: {
@@ -26371,7 +26403,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
26371
26403
  adminSettingsRoutes.get("/api/migrations/status", async (c) => {
26372
26404
  try {
26373
26405
  const db = c.env.DB;
26374
- const migrationService = new chunkVGHEKIJL_cjs.MigrationService(db);
26406
+ const migrationService = new chunkA2SN3RVL_cjs.MigrationService(db);
26375
26407
  const status = await migrationService.getMigrationStatus();
26376
26408
  return c.json({
26377
26409
  success: true,
@@ -26411,7 +26443,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
26411
26443
  adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
26412
26444
  try {
26413
26445
  const db = c.env.DB;
26414
- const migrationService = new chunkVGHEKIJL_cjs.MigrationService(db);
26446
+ const migrationService = new chunkA2SN3RVL_cjs.MigrationService(db);
26415
26447
  const validation = await migrationService.validateSchema();
26416
26448
  return c.json({
26417
26449
  success: true,
@@ -27004,16 +27036,16 @@ function renderAPIReferencePage(data) {
27004
27036
  }
27005
27037
 
27006
27038
  // src/routes/admin-api-reference.ts
27007
- var VERSION2 = chunkC3ZQP5NW_cjs.getCoreVersion();
27039
+ var VERSION2 = chunkKKNEYIZJ_cjs.getCoreVersion();
27008
27040
  var router2 = new hono.Hono();
27009
- router2.use("*", chunkIS54FPB7_cjs.requireAuth());
27041
+ router2.use("*", chunk37V3RET3_cjs.requireAuth());
27010
27042
  router2.get("/", async (c) => {
27011
27043
  const user = c.get("user");
27012
27044
  try {
27013
27045
  const app2 = chunk36Z3AKX3_cjs.getAppInstance();
27014
27046
  const baseEndpoints = chunk36Z3AKX3_cjs.buildRouteList(app2);
27015
27047
  const collectionRoutes = [];
27016
- const collections = chunkAT4ZQGEZ_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
27048
+ const collections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal);
27017
27049
  const methodOrder = { GET: 0, POST: 1, PUT: 2, PATCH: 3, DELETE: 4 };
27018
27050
  for (const col of collections) {
27019
27051
  const displayName = col.displayName || col.name;
@@ -27110,8 +27142,10 @@ exports.createUserProfilesPlugin = createUserProfilesPlugin;
27110
27142
  exports.defineUserProfile = defineUserProfile;
27111
27143
  exports.denyIfNotAllowed = denyIfNotAllowed;
27112
27144
  exports.dispatchHookEvent = dispatchHookEvent;
27145
+ exports.effectiveTenantForType = effectiveTenantForType;
27113
27146
  exports.getConfirmationDialogScript = getConfirmationDialogScript2;
27114
27147
  exports.getCustomData = getCustomData;
27148
+ exports.getDocumentRequestContext = getDocumentRequestContext;
27115
27149
  exports.getEmailService = getEmailService;
27116
27150
  exports.getUserProfileConfig = getUserProfileConfig;
27117
27151
  exports.getVariablesCached = getVariablesCached;
@@ -27129,7 +27163,8 @@ exports.router2 = router2;
27129
27163
  exports.setEmailService = setEmailService;
27130
27164
  exports.setVariablesCache = setVariablesCache;
27131
27165
  exports.test_cleanup_default = test_cleanup_default;
27166
+ exports.updateDocumentSchema = updateDocumentSchema;
27132
27167
  exports.userProfilesPlugin = userProfilesPlugin;
27133
27168
  exports.userRoutes = userRoutes;
27134
- //# sourceMappingURL=chunk-CTYLCWMO.cjs.map
27135
- //# sourceMappingURL=chunk-CTYLCWMO.cjs.map
27169
+ //# sourceMappingURL=chunk-I767LVN7.cjs.map
27170
+ //# sourceMappingURL=chunk-I767LVN7.cjs.map