@sonicjs-cms/core 3.0.0-beta.25 → 3.0.0-beta.26

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 (116) hide show
  1. package/dist/{app-01M0dIwt.d.ts → app-BP5IlK94.d.ts} +7 -7
  2. package/dist/{app-aj39TGHB.d.cts → app-fdq4K3vw.d.cts} +7 -7
  3. package/dist/catalog-56DR6OXI.cjs +41 -0
  4. package/dist/catalog-56DR6OXI.cjs.map +1 -0
  5. package/dist/catalog-6MB37KY7.js +4 -0
  6. package/dist/catalog-6MB37KY7.js.map +1 -0
  7. package/dist/{chunk-YAURVGUK.cjs → chunk-4DHPR7KR.cjs} +77 -17
  8. package/dist/chunk-4DHPR7KR.cjs.map +1 -0
  9. package/dist/{chunk-D7RLBBHE.js → chunk-5YSFQO7X.js} +40 -13
  10. package/dist/chunk-5YSFQO7X.js.map +1 -0
  11. package/dist/{chunk-RSBZITK3.cjs → chunk-6UAI4SGN.cjs} +3 -3
  12. package/dist/{chunk-RSBZITK3.cjs.map → chunk-6UAI4SGN.cjs.map} +1 -1
  13. package/dist/{chunk-2XAQTPAE.js → chunk-6X22VFEV.js} +8 -2
  14. package/dist/chunk-6X22VFEV.js.map +1 -0
  15. package/dist/{chunk-I7MIRRFJ.cjs → chunk-A22RBHO7.cjs} +11 -11
  16. package/dist/{chunk-I7MIRRFJ.cjs.map → chunk-A22RBHO7.cjs.map} +1 -1
  17. package/dist/{chunk-FVAK4C6L.js → chunk-AMP4BSJE.js} +3 -3
  18. package/dist/{chunk-FVAK4C6L.js.map → chunk-AMP4BSJE.js.map} +1 -1
  19. package/dist/{chunk-E7E3NL3Y.cjs → chunk-BRKXMRMB.cjs} +93 -93
  20. package/dist/chunk-BRKXMRMB.cjs.map +1 -0
  21. package/dist/{chunk-36Z3AKX3.cjs → chunk-C5LDQ3SH.cjs} +8 -2
  22. package/dist/chunk-C5LDQ3SH.cjs.map +1 -0
  23. package/dist/{chunk-2OXFMMA3.js → chunk-EEA476CJ.js} +84 -80
  24. package/dist/chunk-EEA476CJ.js.map +1 -0
  25. package/dist/chunk-F6BTBE4S.js +119 -0
  26. package/dist/chunk-F6BTBE4S.js.map +1 -0
  27. package/dist/chunk-FZGIU5AZ.cjs +128 -0
  28. package/dist/chunk-FZGIU5AZ.cjs.map +1 -0
  29. package/dist/{chunk-C54MH5UI.js → chunk-JD7BZU3A.js} +3 -3
  30. package/dist/{chunk-C54MH5UI.js.map → chunk-JD7BZU3A.js.map} +1 -1
  31. package/dist/{chunk-3KGY4IBW.js → chunk-JG5J434C.js} +3 -3
  32. package/dist/{chunk-3KGY4IBW.js.map → chunk-JG5J434C.js.map} +1 -1
  33. package/dist/{chunk-D6FWEYQE.cjs → chunk-KWQNB6UM.cjs} +4 -4
  34. package/dist/{chunk-D6FWEYQE.cjs.map → chunk-KWQNB6UM.cjs.map} +1 -1
  35. package/dist/{chunk-7P5OCUPS.js → chunk-OJFIQGZB.js} +107 -29
  36. package/dist/chunk-OJFIQGZB.js.map +1 -0
  37. package/dist/{chunk-JCBDXEY2.cjs → chunk-OLEOKHDX.cjs} +9 -2
  38. package/dist/chunk-OLEOKHDX.cjs.map +1 -0
  39. package/dist/{chunk-MOGK3U4A.cjs → chunk-PAS7GZBS.cjs} +40 -13
  40. package/dist/chunk-PAS7GZBS.cjs.map +1 -0
  41. package/dist/{chunk-2D3A4X52.js → chunk-RVOX2WH2.js} +74 -18
  42. package/dist/chunk-RVOX2WH2.js.map +1 -0
  43. package/dist/{chunk-BDQ55MWV.js → chunk-RXLI3ADU.js} +9 -2
  44. package/dist/chunk-RXLI3ADU.js.map +1 -0
  45. package/dist/{chunk-6OA77UM7.cjs → chunk-S2QN4LFD.cjs} +386 -306
  46. package/dist/chunk-S2QN4LFD.cjs.map +1 -0
  47. package/dist/{chunk-DLTT7QZU.cjs → chunk-SFGYZUWU.cjs} +3 -3
  48. package/dist/{chunk-DLTT7QZU.cjs.map → chunk-SFGYZUWU.cjs.map} +1 -1
  49. package/dist/{chunk-CWIGQYRR.js → chunk-UB5QSRO7.js} +5 -5
  50. package/dist/chunk-UB5QSRO7.js.map +1 -0
  51. package/dist/{chunk-F26HP3B6.js → chunk-UKIDWRA3.js} +4 -4
  52. package/dist/{chunk-F26HP3B6.js.map → chunk-UKIDWRA3.js.map} +1 -1
  53. package/dist/{chunk-BJ6NJL2E.cjs → chunk-XZUEGFXE.cjs} +5 -5
  54. package/dist/chunk-XZUEGFXE.cjs.map +1 -0
  55. package/dist/{collection-config-BTzAvKt2.d.cts → collection-config-U2dydD_O.d.cts} +14 -0
  56. package/dist/{collection-config-BTzAvKt2.d.ts → collection-config-U2dydD_O.d.ts} +14 -0
  57. package/dist/config-DOAWXZBG.js +6 -0
  58. package/dist/{config-4TIHSNW6.js.map → config-DOAWXZBG.js.map} +1 -1
  59. package/dist/{config-XN2ETAJ3.cjs → config-VLU73ZW7.cjs} +5 -5
  60. package/dist/{config-XN2ETAJ3.cjs.map → config-VLU73ZW7.cjs.map} +1 -1
  61. package/dist/index.cjs +600 -332
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.cts +17 -10
  64. package/dist/index.d.ts +17 -10
  65. package/dist/index.js +292 -25
  66. package/dist/index.js.map +1 -1
  67. package/dist/middleware.cjs +46 -46
  68. package/dist/middleware.d.cts +6 -9
  69. package/dist/middleware.d.ts +6 -9
  70. package/dist/middleware.js +5 -5
  71. package/dist/migrations-6M6772UC.cjs +13 -0
  72. package/dist/{migrations-KU4V6T73.cjs.map → migrations-6M6772UC.cjs.map} +1 -1
  73. package/dist/migrations-GZ2HIB4I.js +4 -0
  74. package/dist/{migrations-JAHMI5MK.js.map → migrations-GZ2HIB4I.js.map} +1 -1
  75. package/dist/{plugin-bootstrap-BHWQ2df8.d.cts → plugin-bootstrap-CfVILQeP.d.ts} +1 -1
  76. package/dist/{plugin-bootstrap-Bj4fxX1q.d.ts → plugin-bootstrap-RY5pkoOT.d.cts} +1 -1
  77. package/dist/plugins.cjs +40 -40
  78. package/dist/plugins.js +3 -3
  79. package/dist/rbac-TFUOYIVN.cjs +14 -0
  80. package/dist/{rbac-AORZ6O3N.cjs.map → rbac-TFUOYIVN.cjs.map} +1 -1
  81. package/dist/rbac-XSNP76CV.js +5 -0
  82. package/dist/{rbac-P44772FP.js.map → rbac-XSNP76CV.js.map} +1 -1
  83. package/dist/routes.cjs +31 -30
  84. package/dist/routes.d.cts +3 -5
  85. package/dist/routes.d.ts +3 -5
  86. package/dist/routes.js +11 -10
  87. package/dist/services.cjs +30 -30
  88. package/dist/services.d.cts +9 -2
  89. package/dist/services.d.ts +9 -2
  90. package/dist/services.js +3 -3
  91. package/dist/types.d.cts +1 -1
  92. package/dist/types.d.ts +1 -1
  93. package/dist/utils.cjs +12 -12
  94. package/dist/utils.d.cts +1 -1
  95. package/dist/utils.d.ts +1 -1
  96. package/dist/utils.js +2 -2
  97. package/package.json +3 -3
  98. package/dist/chunk-2D3A4X52.js.map +0 -1
  99. package/dist/chunk-2OXFMMA3.js.map +0 -1
  100. package/dist/chunk-2XAQTPAE.js.map +0 -1
  101. package/dist/chunk-36Z3AKX3.cjs.map +0 -1
  102. package/dist/chunk-6OA77UM7.cjs.map +0 -1
  103. package/dist/chunk-7P5OCUPS.js.map +0 -1
  104. package/dist/chunk-BDQ55MWV.js.map +0 -1
  105. package/dist/chunk-BJ6NJL2E.cjs.map +0 -1
  106. package/dist/chunk-CWIGQYRR.js.map +0 -1
  107. package/dist/chunk-D7RLBBHE.js.map +0 -1
  108. package/dist/chunk-E7E3NL3Y.cjs.map +0 -1
  109. package/dist/chunk-JCBDXEY2.cjs.map +0 -1
  110. package/dist/chunk-MOGK3U4A.cjs.map +0 -1
  111. package/dist/chunk-YAURVGUK.cjs.map +0 -1
  112. package/dist/config-4TIHSNW6.js +0 -6
  113. package/dist/migrations-JAHMI5MK.js +0 -4
  114. package/dist/migrations-KU4V6T73.cjs +0 -13
  115. package/dist/rbac-AORZ6O3N.cjs +0 -14
  116. package/dist/rbac-P44772FP.js +0 -5
package/dist/index.cjs CHANGED
@@ -1,27 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunkRSBZITK3_cjs = require('./chunk-RSBZITK3.cjs');
4
- var chunk6OA77UM7_cjs = require('./chunk-6OA77UM7.cjs');
5
- require('./chunk-XWVDSM2L.cjs');
3
+ var chunk6UAI4SGN_cjs = require('./chunk-6UAI4SGN.cjs');
4
+ var chunkS2QN4LFD_cjs = require('./chunk-S2QN4LFD.cjs');
6
5
  require('./chunk-TT3TQSCZ.cjs');
7
- var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
6
+ var chunkFZGIU5AZ_cjs = require('./chunk-FZGIU5AZ.cjs');
7
+ require('./chunk-XWVDSM2L.cjs');
8
+ var chunkC5LDQ3SH_cjs = require('./chunk-C5LDQ3SH.cjs');
8
9
  var chunkYA3TJ65D_cjs = require('./chunk-YA3TJ65D.cjs');
9
10
  var chunkYP7GW2G5_cjs = require('./chunk-YP7GW2G5.cjs');
10
- var chunkE7E3NL3Y_cjs = require('./chunk-E7E3NL3Y.cjs');
11
- var chunkJCBDXEY2_cjs = require('./chunk-JCBDXEY2.cjs');
11
+ var chunkBRKXMRMB_cjs = require('./chunk-BRKXMRMB.cjs');
12
+ var chunkOLEOKHDX_cjs = require('./chunk-OLEOKHDX.cjs');
12
13
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
13
- var chunkYAURVGUK_cjs = require('./chunk-YAURVGUK.cjs');
14
- var chunkMOGK3U4A_cjs = require('./chunk-MOGK3U4A.cjs');
14
+ var chunk4DHPR7KR_cjs = require('./chunk-4DHPR7KR.cjs');
15
+ var chunkPAS7GZBS_cjs = require('./chunk-PAS7GZBS.cjs');
15
16
  var chunkCN3T3TDI_cjs = require('./chunk-CN3T3TDI.cjs');
16
17
  var chunkOUBUS74I_cjs = require('./chunk-OUBUS74I.cjs');
17
18
  var chunkMI2YXCK4_cjs = require('./chunk-MI2YXCK4.cjs');
18
- var chunkI7MIRRFJ_cjs = require('./chunk-I7MIRRFJ.cjs');
19
- var chunkD6FWEYQE_cjs = require('./chunk-D6FWEYQE.cjs');
19
+ var chunkA22RBHO7_cjs = require('./chunk-A22RBHO7.cjs');
20
+ var chunkKWQNB6UM_cjs = require('./chunk-KWQNB6UM.cjs');
20
21
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
21
- var chunkDLTT7QZU_cjs = require('./chunk-DLTT7QZU.cjs');
22
+ var chunkSFGYZUWU_cjs = require('./chunk-SFGYZUWU.cjs');
22
23
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
23
24
  require('./chunk-P3XDZL6Q.cjs');
24
- var chunkBJ6NJL2E_cjs = require('./chunk-BJ6NJL2E.cjs');
25
+ var chunkXZUEGFXE_cjs = require('./chunk-XZUEGFXE.cjs');
25
26
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
26
27
  var chunkQTFKZBLC_cjs = require('./chunk-QTFKZBLC.cjs');
27
28
  require('./chunk-IGJUBJBW.cjs');
@@ -701,7 +702,7 @@ function formatCellValue(value, colName) {
701
702
  // src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
702
703
  function createDatabaseToolsAdminRoutes() {
703
704
  const router3 = new hono.Hono();
704
- router3.use("*", chunkE7E3NL3Y_cjs.requireAuth());
705
+ router3.use("*", chunkBRKXMRMB_cjs.requireAuth());
705
706
  router3.get("/api/stats", async (c) => {
706
707
  try {
707
708
  const user = c.get("user");
@@ -1060,7 +1061,7 @@ var SiteConfigService = class {
1060
1061
  db;
1061
1062
  env;
1062
1063
  async load() {
1063
- const settings = new chunk36Z3AKX3_cjs.SettingsService(this.db);
1064
+ const settings = new chunkC5LDQ3SH_cjs.SettingsService(this.db);
1064
1065
  const general = await settings.getGeneralSettings();
1065
1066
  const siteUrl = this.env.PUBLIC_URL || "http://localhost:8787";
1066
1067
  return {
@@ -1110,7 +1111,7 @@ var SiteConfigService = class {
1110
1111
 
1111
1112
  // src/plugins/core-plugins/email-plugin/routes/admin.ts
1112
1113
  var adminRoutes = new hono.Hono();
1113
- adminRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
1114
+ adminRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
1114
1115
  adminRoutes.post("/settings", async (c) => {
1115
1116
  if (c.get("user")?.role !== "admin") {
1116
1117
  return c.json({ error: "admin role required" }, 403);
@@ -1148,7 +1149,7 @@ adminRoutes.post("/test", async (c) => {
1148
1149
  const { subject, html: html4, text } = renderTestEmail({ siteName });
1149
1150
  try {
1150
1151
  const settingsLoaded = await settings.load();
1151
- const result = await chunk6OA77UM7_cjs.getEmailService().send({
1152
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1152
1153
  to,
1153
1154
  subject,
1154
1155
  html: html4,
@@ -1230,7 +1231,7 @@ function makeOnRegistrationCompleted(env) {
1230
1231
  siteName,
1231
1232
  loginUrl: siteConfig.buildLoginUrl(siteUrl)
1232
1233
  });
1233
- const result = await chunk6OA77UM7_cjs.getEmailService().send({
1234
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1234
1235
  to: user.email,
1235
1236
  subject,
1236
1237
  html: html4,
@@ -1304,7 +1305,7 @@ function makeOnPasswordResetRequested(env) {
1304
1305
  expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
1305
1306
  siteName
1306
1307
  });
1307
- const result = await chunk6OA77UM7_cjs.getEmailService().send({
1308
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1308
1309
  to: user.email,
1309
1310
  subject,
1310
1311
  html: html4,
@@ -1372,7 +1373,7 @@ function makeOnPasswordResetCompleted(env) {
1372
1373
  supportEmail,
1373
1374
  when: Date.now()
1374
1375
  });
1375
- const result = await chunk6OA77UM7_cjs.getEmailService().send({
1376
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1376
1377
  to: user.email,
1377
1378
  subject,
1378
1379
  html: html4,
@@ -2113,7 +2114,7 @@ var CloudflareEmailProvider = class {
2113
2114
  }
2114
2115
  }
2115
2116
  };
2116
- var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2117
+ var emailPluginV3 = chunkKWQNB6UM_cjs.definePlugin({
2117
2118
  id: "email",
2118
2119
  version: "1.0.0",
2119
2120
  name: "Email",
@@ -2127,7 +2128,7 @@ var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2127
2128
  const db = env.DB;
2128
2129
  if (db) {
2129
2130
  try {
2130
- const typeRegistry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
2131
+ const typeRegistry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
2131
2132
  await typeRegistry.register({
2132
2133
  id: "email_log",
2133
2134
  name: "email_log",
@@ -2142,7 +2143,7 @@ var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2142
2143
  } catch {
2143
2144
  }
2144
2145
  }
2145
- if (!chunk6OA77UM7_cjs.hasEmailService()) {
2146
+ if (!chunkS2QN4LFD_cjs.hasEmailService()) {
2146
2147
  const settings = db ? await new EmailSettingsService(db).load() : {};
2147
2148
  const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
2148
2149
  const cfEmailBinding = env.EMAIL;
@@ -2160,7 +2161,7 @@ var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2160
2161
  } else {
2161
2162
  provider = resolveEmailProvider({ env });
2162
2163
  }
2163
- chunk6OA77UM7_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2164
+ chunkS2QN4LFD_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2164
2165
  }
2165
2166
  ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
2166
2167
  ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
@@ -2171,7 +2172,7 @@ var emailPluginV3 = chunkD6FWEYQE_cjs.definePlugin({
2171
2172
  var BATCH_SIZE = 100;
2172
2173
  ({
2173
2174
  schema: zod.z.record(zod.z.string(), zod.z.unknown())});
2174
- var emailReconciliationPlugin = chunkD6FWEYQE_cjs.definePlugin({
2175
+ var emailReconciliationPlugin = chunkKWQNB6UM_cjs.definePlugin({
2175
2176
  id: "email-reconciliation",
2176
2177
  version: "1.0.0",
2177
2178
  description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
@@ -2192,11 +2193,11 @@ var emailReconciliationPlugin = chunkD6FWEYQE_cjs.definePlugin({
2192
2193
  console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
2193
2194
  return;
2194
2195
  }
2195
- if (!chunk6OA77UM7_cjs.hasEmailService()) {
2196
+ if (!chunkS2QN4LFD_cjs.hasEmailService()) {
2196
2197
  console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
2197
2198
  return;
2198
2199
  }
2199
- const emailService = chunk6OA77UM7_cjs.getEmailService();
2200
+ const emailService = chunkS2QN4LFD_cjs.getEmailService();
2200
2201
  let rows = [];
2201
2202
  try {
2202
2203
  const result = await db.prepare(
@@ -2629,7 +2630,7 @@ function buildOtpApi() {
2629
2630
  console.warn("Failed to parse OTP plugin settings, using defaults");
2630
2631
  }
2631
2632
  }
2632
- const settingsService = new chunk36Z3AKX3_cjs.SettingsService(db);
2633
+ const settingsService = new chunkC5LDQ3SH_cjs.SettingsService(db);
2633
2634
  const generalSettings = await settingsService.getGeneralSettings();
2634
2635
  const siteName = generalSettings.siteName;
2635
2636
  const canRequest = await otpService.checkRateLimit(normalizedEmail, settings);
@@ -2683,8 +2684,8 @@ function buildOtpApi() {
2683
2684
  loginUrl: settings.loginUrl || "",
2684
2685
  loginButtonText: settings.loginButtonText || ""
2685
2686
  });
2686
- if (chunk6OA77UM7_cjs.hasEmailService()) {
2687
- const sent = await chunk6OA77UM7_cjs.getEmailService().send({
2687
+ if (chunkS2QN4LFD_cjs.hasEmailService()) {
2688
+ const sent = await chunkS2QN4LFD_cjs.getEmailService().send({
2688
2689
  to: normalizedEmail,
2689
2690
  subject: `Your login code for ${siteName}`,
2690
2691
  flow: "otp",
@@ -2786,21 +2787,21 @@ function buildOtpApi() {
2786
2787
  error: "Account is deactivated"
2787
2788
  }, 403);
2788
2789
  }
2789
- const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(db, c.env);
2790
- const token = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2790
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(db, c.env);
2791
+ const token = await chunkBRKXMRMB_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2791
2792
  cookie.setCookie(c, "auth_token", token, {
2792
2793
  httpOnly: true,
2793
2794
  secure: true,
2794
2795
  sameSite: "Strict",
2795
2796
  maxAge: tokenTtl
2796
2797
  });
2797
- chunk6OA77UM7_cjs.dispatchHookEvent(
2798
+ chunkS2QN4LFD_cjs.dispatchHookEvent(
2798
2799
  c,
2799
2800
  "auth:otp:verified",
2800
2801
  { user: { id: user.id, email: user.email, role: user.role } },
2801
2802
  "fire-and-forget"
2802
2803
  );
2803
- const customData = await chunk6OA77UM7_cjs.getCustomData(db, user.id);
2804
+ const customData = await chunkS2QN4LFD_cjs.getCustomData(db, user.id);
2804
2805
  const { is_active: _isActive, ...publicUser } = user;
2805
2806
  return c.json({
2806
2807
  success: true,
@@ -2845,7 +2846,7 @@ function buildOtpApi() {
2845
2846
  });
2846
2847
  return otpAPI;
2847
2848
  }
2848
- var otpLoginPlugin = chunkD6FWEYQE_cjs.definePlugin({
2849
+ var otpLoginPlugin = chunkKWQNB6UM_cjs.definePlugin({
2849
2850
  id: "otp-login",
2850
2851
  version: "1.0.0",
2851
2852
  name: "OTP Login",
@@ -3243,15 +3244,15 @@ function buildOauthApi() {
3243
3244
  if (!user || !user.is_active) {
3244
3245
  return c.redirect("/auth/login?error=Account is deactivated");
3245
3246
  }
3246
- const tokenTtl2 = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3247
- const jwt2 = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3247
+ const tokenTtl2 = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3248
+ const jwt2 = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3248
3249
  user.id,
3249
3250
  user.email,
3250
3251
  user.role,
3251
3252
  c.env.JWT_SECRET,
3252
3253
  tokenTtl2
3253
3254
  );
3254
- chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3255
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3255
3256
  return c.redirect("/admin");
3256
3257
  }
3257
3258
  const existingUser = await oauthService.findUserByEmail(profile.email);
@@ -3268,15 +3269,15 @@ function buildOauthApi() {
3268
3269
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3269
3270
  profileData: JSON.stringify(profile)
3270
3271
  });
3271
- const tokenTtl2 = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3272
- const jwt2 = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3272
+ const tokenTtl2 = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3273
+ const jwt2 = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3273
3274
  existingUser.id,
3274
3275
  existingUser.email,
3275
3276
  existingUser.role,
3276
3277
  c.env.JWT_SECRET,
3277
3278
  tokenTtl2
3278
3279
  );
3279
- chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3280
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3280
3281
  return c.redirect("/admin");
3281
3282
  }
3282
3283
  const newUserId = await oauthService.createUserFromOAuth(profile);
@@ -3289,15 +3290,15 @@ function buildOauthApi() {
3289
3290
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3290
3291
  profileData: JSON.stringify(profile)
3291
3292
  });
3292
- const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3293
- const jwt = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
3293
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3294
+ const jwt = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3294
3295
  newUserId,
3295
3296
  profile.email.toLowerCase(),
3296
3297
  "viewer",
3297
3298
  c.env.JWT_SECRET,
3298
3299
  tokenTtl
3299
3300
  );
3300
- chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3301
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3301
3302
  return c.redirect("/admin");
3302
3303
  } catch (error) {
3303
3304
  console.error("OAuth callback error:", error);
@@ -3392,7 +3393,7 @@ function buildOauthApi() {
3392
3393
  });
3393
3394
  return oauthAPI;
3394
3395
  }
3395
- var oauthProvidersPlugin = chunkD6FWEYQE_cjs.definePlugin({
3396
+ var oauthProvidersPlugin = chunkKWQNB6UM_cjs.definePlugin({
3396
3397
  id: "oauth-providers",
3397
3398
  version: "1.0.0",
3398
3399
  name: "OAuth Providers",
@@ -3976,7 +3977,7 @@ var AISearchService = class {
3976
3977
  */
3977
3978
  async detectNewCollections() {
3978
3979
  try {
3979
- const allCollections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3980
+ const allCollections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3980
3981
  id: r.id,
3981
3982
  name: r.name,
3982
3983
  display_name: r.displayName,
@@ -4028,7 +4029,7 @@ var AISearchService = class {
4028
4029
  */
4029
4030
  async getAllCollections() {
4030
4031
  try {
4031
- const allCollections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4032
+ const allCollections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4032
4033
  id: r.id,
4033
4034
  name: r.name,
4034
4035
  display_name: r.displayName,
@@ -4367,7 +4368,7 @@ var IndexManager = class {
4367
4368
  */
4368
4369
  async indexCollection(collectionId) {
4369
4370
  try {
4370
- const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
4371
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
4371
4372
  const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
4372
4373
  if (!record) {
4373
4374
  throw new Error(`Collection ${collectionId} not found`);
@@ -4994,7 +4995,7 @@ function renderSettingsPage(data) {
4994
4995
 
4995
4996
  // src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
4996
4997
  var adminRoutes2 = new hono.Hono();
4997
- adminRoutes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
4998
+ adminRoutes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
4998
4999
  adminRoutes2.get("/", async (c) => {
4999
5000
  try {
5000
5001
  const user = c.get("user");
@@ -5235,7 +5236,7 @@ var manifest_default = {
5235
5236
  author: "SonicJS"};
5236
5237
 
5237
5238
  // src/plugins/core-plugins/ai-search-plugin/index.ts
5238
- var aiSearchPlugin = chunkD6FWEYQE_cjs.definePlugin({
5239
+ var aiSearchPlugin = chunkKWQNB6UM_cjs.definePlugin({
5239
5240
  id: manifest_default.id,
5240
5241
  version: manifest_default.version,
5241
5242
  name: manifest_default.name,
@@ -5288,7 +5289,7 @@ var SecurityAuditService = class {
5288
5289
  constructor(db, settings = DEFAULT_SETTINGS2) {
5289
5290
  this.db = db;
5290
5291
  this.settings = settings;
5291
- this.docsService = new chunkJCBDXEY2_cjs.DocumentsService(db, {
5292
+ this.docsService = new chunkOLEOKHDX_cjs.DocumentsService(db, {
5292
5293
  queryableFields: QUERYABLE_FIELDS,
5293
5294
  maxVersionsPerRoot: 1,
5294
5295
  tenantId: TENANT
@@ -6108,7 +6109,7 @@ function renderSecuritySettingsPage(data) {
6108
6109
 
6109
6110
  // src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
6110
6111
  var adminRoutes3 = new hono.Hono();
6111
- adminRoutes3.use("*", chunkE7E3NL3Y_cjs.requireAuth());
6112
+ adminRoutes3.use("*", chunkBRKXMRMB_cjs.requireAuth());
6112
6113
  adminRoutes3.use("*", async (c, next) => {
6113
6114
  const user = c.get("user");
6114
6115
  if (user?.role !== "admin") {
@@ -6118,7 +6119,7 @@ adminRoutes3.use("*", async (c, next) => {
6118
6119
  });
6119
6120
  async function getSettings(db) {
6120
6121
  try {
6121
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6122
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6122
6123
  const plugin2 = await pluginService.getPlugin("security-audit");
6123
6124
  if (plugin2?.settings) {
6124
6125
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6223,7 +6224,7 @@ adminRoutes3.post("/settings", async (c) => {
6223
6224
  autoPurge: body["retention.autoPurge"] === "true"
6224
6225
  }
6225
6226
  };
6226
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6227
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6227
6228
  await pluginService.updatePluginSettings("security-audit", settings);
6228
6229
  if (c.req.header("HX-Request")) {
6229
6230
  return c.json({ success: true });
@@ -6385,7 +6386,7 @@ var BruteForceDetector = class {
6385
6386
 
6386
6387
  // src/plugins/core-plugins/security-audit-plugin/routes/api.ts
6387
6388
  var apiRoutes2 = new hono.Hono();
6388
- apiRoutes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
6389
+ apiRoutes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
6389
6390
  apiRoutes2.use("*", async (c, next) => {
6390
6391
  const user = c.get("user");
6391
6392
  if (user?.role !== "admin") {
@@ -6395,7 +6396,7 @@ apiRoutes2.use("*", async (c, next) => {
6395
6396
  });
6396
6397
  async function getSettings2(db) {
6397
6398
  try {
6398
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6399
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6399
6400
  const plugin2 = await pluginService.getPlugin("security-audit");
6400
6401
  if (plugin2?.settings) {
6401
6402
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6543,7 +6544,7 @@ function generateFingerprint(ip, userAgent) {
6543
6544
  }
6544
6545
  async function getPluginSettings(db) {
6545
6546
  try {
6546
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
6547
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6547
6548
  const plugin2 = await pluginService.getPlugin("security-audit");
6548
6549
  if (plugin2?.settings) {
6549
6550
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6774,7 +6775,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
6774
6775
 
6775
6776
  // src/plugins/core-plugins/security-audit-plugin/index.ts
6776
6777
  var SECURITY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>`;
6777
- var securityAuditPlugin = chunkD6FWEYQE_cjs.definePlugin({
6778
+ var securityAuditPlugin = chunkKWQNB6UM_cjs.definePlugin({
6778
6779
  id: "security-audit",
6779
6780
  version: "1.0.0",
6780
6781
  name: "Security Audit",
@@ -6824,7 +6825,7 @@ var ApiKeyService = class {
6824
6825
  db;
6825
6826
  tenantId;
6826
6827
  docService() {
6827
- return new chunkJCBDXEY2_cjs.DocumentsService(this.db, {
6828
+ return new chunkOLEOKHDX_cjs.DocumentsService(this.db, {
6828
6829
  queryableFields: API_KEY_QUERYABLE,
6829
6830
  tenantId: this.tenantId,
6830
6831
  maxVersionsPerRoot: 1
@@ -6850,7 +6851,7 @@ var ApiKeyService = class {
6850
6851
  const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
6851
6852
  const expiresAt = input.expiresAt ?? null;
6852
6853
  const doc = await this.docService().create(
6853
- chunk6OA77UM7_cjs.createDocumentSchema.parse({
6854
+ chunkS2QN4LFD_cjs.createDocumentSchema.parse({
6854
6855
  typeId: "api_key",
6855
6856
  tenantId: this.tenantId,
6856
6857
  title: name,
@@ -7163,7 +7164,7 @@ var createSchema = zod.z.object({
7163
7164
  });
7164
7165
  async function getSettings3(db) {
7165
7166
  try {
7166
- const plugin2 = await new chunkYAURVGUK_cjs.PluginService(db).getPlugin("api-keys");
7167
+ const plugin2 = await new chunk4DHPR7KR_cjs.PluginService(db).getPlugin("api-keys");
7167
7168
  if (plugin2?.settings) {
7168
7169
  const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
7169
7170
  return { ...DEFAULT_SETTINGS3, ...s };
@@ -7172,7 +7173,7 @@ async function getSettings3(db) {
7172
7173
  }
7173
7174
  return DEFAULT_SETTINGS3;
7174
7175
  }
7175
- adminRoutes4.use("*", chunkE7E3NL3Y_cjs.requireAuth());
7176
+ adminRoutes4.use("*", chunkBRKXMRMB_cjs.requireAuth());
7176
7177
  adminRoutes4.use("*", async (c, next) => {
7177
7178
  const user = c.get("user");
7178
7179
  if (user?.role !== "admin") {
@@ -7257,7 +7258,7 @@ function apiKeyAuthMiddleware() {
7257
7258
 
7258
7259
  // src/plugins/core-plugins/api-keys-plugin/index.ts
7259
7260
  var KEY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/></svg>`;
7260
- var apiKeysPlugin = chunkD6FWEYQE_cjs.definePlugin({
7261
+ var apiKeysPlugin = chunkKWQNB6UM_cjs.definePlugin({
7261
7262
  id: "api-keys",
7262
7263
  version: "1.0.0-beta.1",
7263
7264
  name: "API Keys",
@@ -8028,7 +8029,7 @@ var DEFAULT_SETTINGS4 = {
8028
8029
 
8029
8030
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
8030
8031
  var adminRoutes5 = new hono.Hono();
8031
- adminRoutes5.use("*", chunkE7E3NL3Y_cjs.requireAuth());
8032
+ adminRoutes5.use("*", chunkBRKXMRMB_cjs.requireAuth());
8032
8033
  adminRoutes5.use("*", async (c, next) => {
8033
8034
  const user = c.get("user");
8034
8035
  if (user?.role !== "admin") {
@@ -8038,7 +8039,7 @@ adminRoutes5.use("*", async (c, next) => {
8038
8039
  });
8039
8040
  async function getSettings4(db) {
8040
8041
  try {
8041
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
8042
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
8042
8043
  const plugin2 = await pluginService.getPlugin("stripe");
8043
8044
  if (plugin2?.settings) {
8044
8045
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8361,7 +8362,7 @@ function timingSafeEqual(a, b) {
8361
8362
  var apiRoutes3 = new hono.Hono();
8362
8363
  async function getSettings5(db) {
8363
8364
  try {
8364
- const pluginService = new chunkYAURVGUK_cjs.PluginService(db);
8365
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
8365
8366
  const plugin2 = await pluginService.getPlugin("stripe");
8366
8367
  if (plugin2?.settings) {
8367
8368
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8512,7 +8513,7 @@ apiRoutes3.post("/webhook", async (c) => {
8512
8513
  }
8513
8514
  return c.json({ received: true });
8514
8515
  });
8515
- apiRoutes3.post("/create-checkout-session", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8516
+ apiRoutes3.post("/create-checkout-session", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8516
8517
  const db = c.env.DB;
8517
8518
  const user = c.get("user");
8518
8519
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -8552,7 +8553,7 @@ apiRoutes3.post("/create-checkout-session", chunkE7E3NL3Y_cjs.requireAuth(), asy
8552
8553
  });
8553
8554
  return c.json({ sessionId: session.id, url: session.url });
8554
8555
  });
8555
- apiRoutes3.get("/subscription", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8556
+ apiRoutes3.get("/subscription", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8556
8557
  const user = c.get("user");
8557
8558
  if (!user) return c.json({ error: "Unauthorized" }, 401);
8558
8559
  const db = c.env.DB;
@@ -8564,7 +8565,7 @@ apiRoutes3.get("/subscription", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8564
8565
  }
8565
8566
  return c.json({ subscription });
8566
8567
  });
8567
- apiRoutes3.get("/subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8568
+ apiRoutes3.get("/subscriptions", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8568
8569
  const user = c.get("user");
8569
8570
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8570
8571
  const db = c.env.DB;
@@ -8580,7 +8581,7 @@ apiRoutes3.get("/subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8580
8581
  const result = await subscriptionService.list(filters);
8581
8582
  return c.json(result);
8582
8583
  });
8583
- apiRoutes3.get("/stats", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8584
+ apiRoutes3.get("/stats", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8584
8585
  const user = c.get("user");
8585
8586
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8586
8587
  const db = c.env.DB;
@@ -8589,7 +8590,7 @@ apiRoutes3.get("/stats", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8589
8590
  const stats = await subscriptionService.getStats();
8590
8591
  return c.json(stats);
8591
8592
  });
8592
- apiRoutes3.post("/sync-subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8593
+ apiRoutes3.post("/sync-subscriptions", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8593
8594
  const user = c.get("user");
8594
8595
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8595
8596
  const db = c.env.DB;
@@ -8637,7 +8638,7 @@ apiRoutes3.post("/sync-subscriptions", chunkE7E3NL3Y_cjs.requireAuth(), async (c
8637
8638
  }, 500);
8638
8639
  }
8639
8640
  });
8640
- apiRoutes3.get("/events", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8641
+ apiRoutes3.get("/events", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8641
8642
  const user = c.get("user");
8642
8643
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8643
8644
  const db = c.env.DB;
@@ -8660,7 +8661,7 @@ apiRoutes3.get("/events", chunkE7E3NL3Y_cjs.requireAuth(), async (c) => {
8660
8661
 
8661
8662
  // src/plugins/core-plugins/stripe-plugin/index.ts
8662
8663
  var STRIPE_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/></svg>`;
8663
- var stripePlugin = chunkD6FWEYQE_cjs.definePlugin({
8664
+ var stripePlugin = chunkKWQNB6UM_cjs.definePlugin({
8664
8665
  id: "stripe",
8665
8666
  version: "1.0.0",
8666
8667
  name: "Stripe",
@@ -8933,7 +8934,7 @@ function renderFormsListPage(data) {
8933
8934
 
8934
8935
  <!-- Forms Table -->
8935
8936
  <div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
8936
- ${chunk6OA77UM7_cjs.renderTable(tableData)}
8937
+ ${chunkS2QN4LFD_cjs.renderTable(tableData)}
8937
8938
  </div>
8938
8939
  </div>
8939
8940
  `;
@@ -10363,7 +10364,7 @@ function renderFormCreatePage(data) {
10363
10364
  // src/routes/admin-forms.ts
10364
10365
  var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
10365
10366
  var adminFormsRoutes = new hono.Hono();
10366
- adminFormsRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
10367
+ adminFormsRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
10367
10368
  adminFormsRoutes.get("/", async (c) => {
10368
10369
  try {
10369
10370
  const user = c.get("user");
@@ -10536,7 +10537,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
10536
10537
  if (!form) {
10537
10538
  return c.html("<p>Form not found</p>", 404);
10538
10539
  }
10539
- const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
10540
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
10540
10541
  const turnstileSettings = await turnstileService.getSettings();
10541
10542
  const pageData = {
10542
10543
  id: form.id,
@@ -10705,7 +10706,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
10705
10706
  if (!form) {
10706
10707
  return c.json({ error: "Form not found" }, 404);
10707
10708
  }
10708
- const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
10709
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
10709
10710
  const globalSettings = await turnstileService.getSettings();
10710
10711
  const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
10711
10712
  const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
@@ -11135,7 +11136,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11135
11136
  const turnstileEnabled = form.turnstile_enabled === 1;
11136
11137
  const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
11137
11138
  if (turnstileEnabled || turnstileSettings.inherit) {
11138
- const turnstileService = new chunkI7MIRRFJ_cjs.TurnstileService(db);
11139
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
11139
11140
  const globalEnabled = await turnstileService.isEnabled();
11140
11141
  if (globalEnabled || turnstileEnabled) {
11141
11142
  const turnstileToken = body.data?.turnstile || body.turnstile;
@@ -11197,7 +11198,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11197
11198
  });
11198
11199
 
11199
11200
  // src/plugins/core-plugins/forms-plugin/index.ts
11200
- var formsPlugin = chunkD6FWEYQE_cjs.definePlugin({
11201
+ var formsPlugin = chunkKWQNB6UM_cjs.definePlugin({
11201
11202
  id: "forms",
11202
11203
  version: "1.0.0",
11203
11204
  name: "Forms",
@@ -11217,7 +11218,7 @@ var formsPlugin = chunkD6FWEYQE_cjs.definePlugin({
11217
11218
  });
11218
11219
  chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
11219
11220
  var adminRbacRoutes = new hono.Hono();
11220
- adminRbacRoutes.use("*", chunkE7E3NL3Y_cjs.requireRbac("rbac", "manage"));
11221
+ adminRbacRoutes.use("*", chunkBRKXMRMB_cjs.requireRbac("rbac", "manage"));
11221
11222
  var esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
11222
11223
  var TABS2 = `
11223
11224
  <div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
@@ -11227,7 +11228,7 @@ var TABS2 = `
11227
11228
  </nav>
11228
11229
  </div>`;
11229
11230
  adminRbacRoutes.get("/", async (c) => {
11230
- const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11231
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11231
11232
  const [roles, verbs, resources, grants] = await Promise.all([
11232
11233
  rbac.getRoles(),
11233
11234
  rbac.getVerbs(),
@@ -11525,7 +11526,7 @@ adminRbacRoutes.get("/", async (c) => {
11525
11526
  title: "Roles & Permissions",
11526
11527
  pageTitle: "Roles & Permissions",
11527
11528
  currentPath: "/admin/users",
11528
- version: chunkBJ6NJL2E_cjs.getCoreVersion(),
11529
+ version: chunkXZUEGFXE_cjs.getCoreVersion(),
11529
11530
  user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
11530
11531
  content: content2
11531
11532
  })
@@ -11549,7 +11550,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11549
11550
  pairsByRole.get(roleId).push({ resource, verb, scope });
11550
11551
  }
11551
11552
  }
11552
- const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11553
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11553
11554
  for (const id of saveRoleIds) {
11554
11555
  await rbac.setRoleGrants(id, pairsByRole.get(id) || []);
11555
11556
  }
@@ -11570,7 +11571,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11570
11571
  adminRbacRoutes.post("/roles/bulk", async (c) => {
11571
11572
  const form = await c.req.formData();
11572
11573
  const roleIds = String(form.get("role_ids") || "").split(",").filter(Boolean);
11573
- const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11574
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11574
11575
  for (const roleId of roleIds) {
11575
11576
  const displayName = String(form.get(`display_name_${roleId}`) || "").trim();
11576
11577
  const nameVal = form.get(`name_${roleId}`) ? String(form.get(`name_${roleId}`)).trim() : void 0;
@@ -11595,7 +11596,7 @@ adminRbacRoutes.post("/roles", async (c) => {
11595
11596
  const displayName = String(form.get("display_name") || "").trim();
11596
11597
  if (name && displayName) {
11597
11598
  try {
11598
- await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).createRole(name, displayName);
11599
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).createRole(name, displayName);
11599
11600
  } catch {
11600
11601
  }
11601
11602
  }
@@ -11610,7 +11611,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11610
11611
  const portalAccess = form.get("portal_access") === "1";
11611
11612
  if (displayName) {
11612
11613
  try {
11613
- const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11614
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11614
11615
  if (roleId !== "role-admin") {
11615
11616
  await rbac.updateRoleAndPortalAccess(roleId, displayName, name, portalAccess, description);
11616
11617
  } else {
@@ -11622,7 +11623,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11622
11623
  return c.redirect(`/admin/rbac#roles-verbs`);
11623
11624
  });
11624
11625
  adminRbacRoutes.post("/roles/:id/delete", async (c) => {
11625
- await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11626
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11626
11627
  return c.redirect("/admin/rbac#roles-verbs");
11627
11628
  });
11628
11629
  adminRbacRoutes.post("/verbs", async (c) => {
@@ -11630,18 +11631,18 @@ adminRbacRoutes.post("/verbs", async (c) => {
11630
11631
  const name = String(form.get("name") || "").trim();
11631
11632
  if (name) {
11632
11633
  try {
11633
- await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).createVerb(name);
11634
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).createVerb(name);
11634
11635
  } catch {
11635
11636
  }
11636
11637
  }
11637
11638
  return c.redirect("/admin/rbac#roles-verbs");
11638
11639
  });
11639
11640
  adminRbacRoutes.post("/verbs/:id/delete", async (c) => {
11640
- await new chunkJCBDXEY2_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11641
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11641
11642
  return c.redirect("/admin/rbac#roles-verbs");
11642
11643
  });
11643
11644
  adminRbacRoutes.get("/check", async (c) => {
11644
- const rbac = new chunkJCBDXEY2_cjs.RbacService(c.env.DB);
11645
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11645
11646
  const resource = c.req.query("resource") || "";
11646
11647
  const verb = c.req.query("verb") || "";
11647
11648
  const roleId = c.req.query("role");
@@ -11662,7 +11663,7 @@ adminRbacRoutes.get("/check", async (c) => {
11662
11663
  });
11663
11664
 
11664
11665
  // src/middleware/plugin-menu.ts
11665
- var REGISTRY_MENU_PLUGINS = Object.values(chunkYAURVGUK_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11666
+ var REGISTRY_MENU_PLUGINS = Object.values(chunk4DHPR7KR_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11666
11667
  id: p.id,
11667
11668
  label: p.adminMenu.label,
11668
11669
  path: p.adminMenu.path,
@@ -11741,7 +11742,7 @@ function pluginMenuMiddleware() {
11741
11742
  } catch {
11742
11743
  }
11743
11744
  const user = c.get("user");
11744
- const singletonItems = chunkD6FWEYQE_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11745
+ const singletonItems = chunkKWQNB6UM_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11745
11746
  const singletonPluginIds = [...new Set(
11746
11747
  singletonItems.map((i) => i.pluginId).filter((id) => !!id)
11747
11748
  )];
@@ -12928,8 +12929,8 @@ function sanitizeUrl(url) {
12928
12929
  return trimmed;
12929
12930
  }
12930
12931
  var adminMenuRoutes = new hono.Hono();
12931
- adminMenuRoutes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
12932
- adminMenuRoutes.use("*", chunkE7E3NL3Y_cjs.requireRole(["admin"]));
12932
+ adminMenuRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
12933
+ adminMenuRoutes.use("*", chunkBRKXMRMB_cjs.requireRole(["admin"]));
12933
12934
  adminMenuRoutes.get("/", async (c) => {
12934
12935
  const db = c.env.DB;
12935
12936
  const user = c.get("user");
@@ -13143,7 +13144,7 @@ adminMenuRoutes.post("/:id/move-down", async (c) => {
13143
13144
  }
13144
13145
  return c.redirect("/admin/menu");
13145
13146
  });
13146
- var menuPlugin = chunkD6FWEYQE_cjs.definePlugin({
13147
+ var menuPlugin = chunkKWQNB6UM_cjs.definePlugin({
13147
13148
  id: "menu",
13148
13149
  version: "1.0.0",
13149
13150
  name: "Menu Manager",
@@ -13158,7 +13159,7 @@ var menuPlugin = chunkD6FWEYQE_cjs.definePlugin({
13158
13159
  const db = env.DB;
13159
13160
  if (!db) return;
13160
13161
  try {
13161
- const typeRegistry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
13162
+ const typeRegistry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
13162
13163
  await typeRegistry.register({
13163
13164
  id: "menu_item",
13164
13165
  name: "menu_item",
@@ -13193,7 +13194,7 @@ var menuPlugin = chunkD6FWEYQE_cjs.definePlugin({
13193
13194
  lockedFields: [...item.lockedFields]
13194
13195
  }, item.sortOrder);
13195
13196
  }
13196
- await chunk6OA77UM7_cjs.reconcileMenuFromPlugins(db);
13197
+ await chunkS2QN4LFD_cjs.reconcileMenuFromPlugins(db);
13197
13198
  } catch {
13198
13199
  }
13199
13200
  },
@@ -13213,7 +13214,7 @@ var menuPlugin = chunkD6FWEYQE_cjs.definePlugin({
13213
13214
  });
13214
13215
  chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
13215
13216
  var adminRoutes6 = new hono.Hono();
13216
- adminRoutes6.use("*", chunkE7E3NL3Y_cjs.requireAuth());
13217
+ adminRoutes6.use("*", chunkBRKXMRMB_cjs.requireAuth());
13217
13218
  adminRoutes6.use("*", async (c, next) => {
13218
13219
  const user = c.get("user");
13219
13220
  if (user?.role !== "admin") {
@@ -13360,7 +13361,7 @@ var QUERYABLE_FIELDS2 = [
13360
13361
  var EventTrackingService = class {
13361
13362
  constructor(db) {
13362
13363
  this.db = db;
13363
- this.docsService = new chunkJCBDXEY2_cjs.DocumentsService(db, {
13364
+ this.docsService = new chunkOLEOKHDX_cjs.DocumentsService(db, {
13364
13365
  queryableFields: QUERYABLE_FIELDS2,
13365
13366
  maxVersionsPerRoot: 1,
13366
13367
  tenantId: TENANT2
@@ -13569,7 +13570,7 @@ apiRoutes4.get("/stats", async (c) => {
13569
13570
  });
13570
13571
 
13571
13572
  // src/plugins/core-plugins/analytics/index.ts
13572
- var analyticsPlugin = chunkD6FWEYQE_cjs.definePlugin({
13573
+ var analyticsPlugin = chunkKWQNB6UM_cjs.definePlugin({
13573
13574
  id: "core-analytics",
13574
13575
  version: "1.0.0",
13575
13576
  name: "Analytics",
@@ -13716,7 +13717,7 @@ function esc2(s) {
13716
13717
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
13717
13718
  }
13718
13719
  async function getVariablesMap(db) {
13719
- let variables = chunk6OA77UM7_cjs.getVariablesCached();
13720
+ let variables = chunkS2QN4LFD_cjs.getVariablesCached();
13720
13721
  if (variables) return variables;
13721
13722
  try {
13722
13723
  const { results } = await db.prepare(
@@ -13726,7 +13727,7 @@ async function getVariablesMap(db) {
13726
13727
  for (const row of results || []) {
13727
13728
  variables.set(row.key, row.value);
13728
13729
  }
13729
- chunk6OA77UM7_cjs.setVariablesCache(variables);
13730
+ chunkS2QN4LFD_cjs.setVariablesCache(variables);
13730
13731
  return variables;
13731
13732
  } catch {
13732
13733
  return /* @__PURE__ */ new Map();
@@ -13795,7 +13796,7 @@ apiRoutes5.post("/", async (c) => {
13795
13796
  await db.prepare(
13796
13797
  "INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
13797
13798
  ).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
13798
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13799
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13799
13800
  const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
13800
13801
  return c.json({ success: true, data: formatVariable(created) }, 201);
13801
13802
  } catch {
@@ -13840,7 +13841,7 @@ apiRoutes5.put("/:id", async (c) => {
13840
13841
  updates.push("updated_at = strftime('%s', 'now')");
13841
13842
  params.push(id);
13842
13843
  await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
13843
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13844
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13844
13845
  const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
13845
13846
  return c.json({ success: true, data: formatVariable(updated) });
13846
13847
  } catch {
@@ -13854,7 +13855,7 @@ apiRoutes5.delete("/:id", async (c) => {
13854
13855
  const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
13855
13856
  if (!existing) return c.json({ error: "Variable not found" }, 404);
13856
13857
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
13857
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13858
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13858
13859
  return c.json({ success: true });
13859
13860
  } catch {
13860
13861
  return c.json({ success: false, error: "Failed to delete variable" }, 500);
@@ -13914,7 +13915,7 @@ adminRoutes7.put("/:id", async (c) => {
13914
13915
  const value = body.value;
13915
13916
  if (value !== void 0) {
13916
13917
  await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
13917
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13918
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13918
13919
  }
13919
13920
  return c.html('<span class="text-green-400 text-xs">Saved</span>');
13920
13921
  });
@@ -13922,7 +13923,7 @@ adminRoutes7.post("/:id/toggle", async (c) => {
13922
13923
  const db = c.env.DB;
13923
13924
  const id = c.req.param("id");
13924
13925
  await db.prepare("UPDATE global_variables SET is_active = CASE WHEN is_active = 1 THEN 0 ELSE 1 END, updated_at = strftime('%s', 'now') WHERE id = ?").bind(id).run();
13925
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13926
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13926
13927
  c.header("HX-Redirect", "/admin/global-variables");
13927
13928
  return c.body(null, 204);
13928
13929
  });
@@ -13943,7 +13944,7 @@ adminRoutes7.post("/", async (c) => {
13943
13944
  await db.prepare(
13944
13945
  "INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
13945
13946
  ).bind(key, value, description, category).run();
13946
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13947
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13947
13948
  c.header("HX-Redirect", "/admin/global-variables");
13948
13949
  return c.body(null, 204);
13949
13950
  });
@@ -13962,7 +13963,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
13962
13963
  adminRoutes7.delete("/:id", async (c) => {
13963
13964
  const db = c.env.DB;
13964
13965
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
13965
- chunk6OA77UM7_cjs.invalidateVariablesCache();
13966
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13966
13967
  return c.html("");
13967
13968
  });
13968
13969
  function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
@@ -14280,7 +14281,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
14280
14281
  </div>
14281
14282
  ` });
14282
14283
  }
14283
- var globalVariablesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14284
+ var globalVariablesPlugin = chunkKWQNB6UM_cjs.definePlugin({
14284
14285
  id: "global-variables",
14285
14286
  version: "1.1.0",
14286
14287
  name: "Global Variables",
@@ -14303,7 +14304,7 @@ var globalVariablesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14303
14304
  if (!db || !data) return data;
14304
14305
  const variables = await getVariablesMap(db);
14305
14306
  if (variables.size === 0) return data;
14306
- return chunk6OA77UM7_cjs.resolveVariablesInObject(data, variables);
14307
+ return chunkS2QN4LFD_cjs.resolveVariablesInObject(data, variables);
14307
14308
  } catch {
14308
14309
  return data;
14309
14310
  }
@@ -14321,7 +14322,7 @@ var globalVariablesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14321
14322
  },
14322
14323
  activate: async () => console.info("[GlobalVariables] Plugin activated"),
14323
14324
  deactivate: async () => {
14324
- chunk6OA77UM7_cjs.invalidateVariablesCache();
14325
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
14325
14326
  console.info("[GlobalVariables] Plugin deactivated, cache cleared");
14326
14327
  },
14327
14328
  uninstall: async (ctx) => {
@@ -14887,7 +14888,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
14887
14888
  </div>
14888
14889
  ` });
14889
14890
  }
14890
- var shortcodesPlugin = chunkD6FWEYQE_cjs.definePlugin({
14891
+ var shortcodesPlugin = chunkKWQNB6UM_cjs.definePlugin({
14891
14892
  id: "shortcodes",
14892
14893
  version: "1.0.0",
14893
14894
  name: "Shortcodes",
@@ -14971,7 +14972,7 @@ helloWorldRoutes.get("/", async (c) => {
14971
14972
  </html>
14972
14973
  `);
14973
14974
  });
14974
- var helloWorldPlugin = chunkD6FWEYQE_cjs.definePlugin({
14975
+ var helloWorldPlugin = chunkKWQNB6UM_cjs.definePlugin({
14975
14976
  id: "hello-world",
14976
14977
  version: "1.0.0",
14977
14978
  name: "Hello World",
@@ -15202,7 +15203,7 @@ function renderTenantForm(data) {
15202
15203
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
15203
15204
  chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15204
15205
  function roleOptions(selected) {
15205
- return chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map(
15206
+ return chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map(
15206
15207
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15207
15208
  ).join("");
15208
15209
  }
@@ -15264,7 +15265,7 @@ function renderInvitations(slug, invitations) {
15264
15265
  <div>
15265
15266
  <label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
15266
15267
  <select id="invite-role" name="role" class="rounded-lg border border-zinc-950/10 bg-white px-2 py-2 text-sm text-zinc-950 dark:border-white/10 dark:bg-zinc-800 dark:text-white">
15267
- ${chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15268
+ ${chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15268
15269
  </select>
15269
15270
  </div>
15270
15271
  <button type="submit" data-send-invite class="rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Invite</button>
@@ -15360,7 +15361,7 @@ function renderTenantMembers(data) {
15360
15361
  // src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
15361
15362
  chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15362
15363
  function roleOptions2(selected) {
15363
- return chunk6OA77UM7_cjs.VALID_MEMBER_ROLES.map(
15364
+ return chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map(
15364
15365
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15365
15366
  ).join("");
15366
15367
  }
@@ -15522,7 +15523,7 @@ function zodToFieldErrors(error) {
15522
15523
  }
15523
15524
  async function isMultiTenantActive(db) {
15524
15525
  try {
15525
- const plugin2 = await new chunkYAURVGUK_cjs.PluginService(db).getPlugin(chunkYAURVGUK_cjs.MULTI_TENANT_PLUGIN_ID);
15526
+ const plugin2 = await new chunk4DHPR7KR_cjs.PluginService(db).getPlugin(chunk4DHPR7KR_cjs.MULTI_TENANT_PLUGIN_ID);
15526
15527
  return plugin2?.status === "active";
15527
15528
  } catch {
15528
15529
  return false;
@@ -15530,7 +15531,7 @@ async function isMultiTenantActive(db) {
15530
15531
  }
15531
15532
  function createTenantAdminRoutes() {
15532
15533
  const routes2 = new hono.Hono();
15533
- routes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
15534
+ routes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
15534
15535
  routes2.use("*", async (c, next) => {
15535
15536
  const user = c.get("user");
15536
15537
  if (user?.role !== "admin") {
@@ -15544,7 +15545,7 @@ function createTenantAdminRoutes() {
15544
15545
  const form = await c.req.formData();
15545
15546
  const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
15546
15547
  const redirect = String(form.get("redirect") ?? "");
15547
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15548
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15548
15549
  const tenant = await svc.getTenantBySlug(slug);
15549
15550
  if (!tenant || tenant.status !== "active") {
15550
15551
  return c.json({ error: "Unknown or inactive tenant" }, 400);
@@ -15554,7 +15555,7 @@ function createTenantAdminRoutes() {
15554
15555
  if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
15555
15556
  return c.json({ error: "You are not a member of this tenant" }, 403);
15556
15557
  }
15557
- cookie.setCookie(c, chunkYAURVGUK_cjs.TENANT_COOKIE, slug, {
15558
+ cookie.setCookie(c, chunk4DHPR7KR_cjs.TENANT_COOKIE, slug, {
15558
15559
  path: "/",
15559
15560
  httpOnly: true,
15560
15561
  sameSite: "Lax",
@@ -15571,7 +15572,7 @@ function createTenantAdminRoutes() {
15571
15572
  if (!user) return c.redirect("/auth/login");
15572
15573
  const token = c.req.query("token") ?? "";
15573
15574
  try {
15574
- const { slug } = await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15575
+ const { slug } = await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15575
15576
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
15576
15577
  } catch (error) {
15577
15578
  const message = error instanceof Error ? error.message : "Failed to accept invitation";
@@ -15599,7 +15600,7 @@ function createTenantAdminRoutes() {
15599
15600
  const userId = c.req.param("userId");
15600
15601
  const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
15601
15602
  if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
15602
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15603
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15603
15604
  const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
15604
15605
  const memberSlugs = new Set(memberships.map((m) => m.slug));
15605
15606
  const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
@@ -15624,10 +15625,10 @@ function createTenantAdminRoutes() {
15624
15625
  const slug = String(form.get("slug") ?? "").trim().toLowerCase();
15625
15626
  const role = String(form.get("role") ?? "viewer");
15626
15627
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15627
- if (!chunk6OA77UM7_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15628
+ if (!chunkS2QN4LFD_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15628
15629
  const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
15629
15630
  if (!target) throw new Error("User not found");
15630
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15631
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15631
15632
  if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
15632
15633
  if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
15633
15634
  await svc.addMember(slug, userId, role, target.email ?? null);
@@ -15646,7 +15647,7 @@ function createTenantAdminRoutes() {
15646
15647
  const form = await c.req.formData();
15647
15648
  const role = String(form.get("role") ?? "");
15648
15649
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15649
- await new chunk6OA77UM7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15650
+ await new chunkS2QN4LFD_cjs.TenantService(db).setMemberRole(slug, userId, role);
15650
15651
  return c.redirect(`${redirectTo}?message=Role updated`);
15651
15652
  } catch (error) {
15652
15653
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15661,7 +15662,7 @@ function createTenantAdminRoutes() {
15661
15662
  try {
15662
15663
  const form = await c.req.formData();
15663
15664
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15664
- await new chunk6OA77UM7_cjs.TenantService(db).removeMember(slug, userId);
15665
+ await new chunkS2QN4LFD_cjs.TenantService(db).removeMember(slug, userId);
15665
15666
  return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
15666
15667
  } catch (error) {
15667
15668
  const message = error instanceof Error ? error.message : "Failed to remove membership";
@@ -15676,7 +15677,7 @@ function createTenantAdminRoutes() {
15676
15677
  return c.html(renderTenantsInactive({ user: userShape(cur), version }));
15677
15678
  }
15678
15679
  const roleName = c.req.param("roleName");
15679
- const assignments = await new chunk6OA77UM7_cjs.TenantService(db).listAssignmentsByRole(roleName);
15680
+ const assignments = await new chunkS2QN4LFD_cjs.TenantService(db).listAssignmentsByRole(roleName);
15680
15681
  return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
15681
15682
  });
15682
15683
  routes2.get("/", async (c) => {
@@ -15686,7 +15687,7 @@ function createTenantAdminRoutes() {
15686
15687
  if (!await isMultiTenantActive(db)) {
15687
15688
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15688
15689
  }
15689
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15690
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15690
15691
  await svc.ensureDefaultTenant();
15691
15692
  const tenants = await svc.listTenants();
15692
15693
  const [docRes, memberRes] = await db.batch([
@@ -15725,7 +15726,7 @@ function createTenantAdminRoutes() {
15725
15726
  formEntries = Object.fromEntries(form.entries());
15726
15727
  const validated = tenantFormSchema.parse(formEntries);
15727
15728
  if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
15728
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15729
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15729
15730
  await svc.createTenant({
15730
15731
  name: validated.name,
15731
15732
  slug: validated.slug,
@@ -15750,7 +15751,7 @@ function createTenantAdminRoutes() {
15750
15751
  if (!await isMultiTenantActive(db)) {
15751
15752
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15752
15753
  }
15753
- const tenant = await new chunk6OA77UM7_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15754
+ const tenant = await new chunkS2QN4LFD_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15754
15755
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15755
15756
  return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
15756
15757
  });
@@ -15760,7 +15761,7 @@ function createTenantAdminRoutes() {
15760
15761
  const version = c.get("appVersion");
15761
15762
  const slug = c.req.param("slug");
15762
15763
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15763
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15764
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15764
15765
  try {
15765
15766
  const form = await c.req.formData();
15766
15767
  const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
@@ -15785,7 +15786,7 @@ function createTenantAdminRoutes() {
15785
15786
  const slug = c.req.param("slug");
15786
15787
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15787
15788
  try {
15788
- await new chunk6OA77UM7_cjs.TenantService(db).deleteTenant(slug);
15789
+ await new chunkS2QN4LFD_cjs.TenantService(db).deleteTenant(slug);
15789
15790
  return c.redirect("/admin/tenants?message=Tenant deleted successfully");
15790
15791
  } catch (error) {
15791
15792
  const message = error instanceof Error ? error.message : "Failed to delete tenant";
@@ -15800,7 +15801,7 @@ function createTenantAdminRoutes() {
15800
15801
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15801
15802
  }
15802
15803
  const slug = c.req.param("slug");
15803
- const svc = new chunk6OA77UM7_cjs.TenantService(db);
15804
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15804
15805
  const tenant = await svc.getTenantBySlug(slug);
15805
15806
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15806
15807
  const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
@@ -15826,7 +15827,7 @@ function createTenantAdminRoutes() {
15826
15827
  const form = await c.req.formData();
15827
15828
  const email = String(form.get("email") ?? "");
15828
15829
  const role = String(form.get("role") ?? "viewer");
15829
- await new chunk6OA77UM7_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15830
+ await new chunkS2QN4LFD_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15830
15831
  return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
15831
15832
  } catch (error) {
15832
15833
  const message = error instanceof Error ? error.message : "Failed to add member";
@@ -15841,7 +15842,7 @@ function createTenantAdminRoutes() {
15841
15842
  try {
15842
15843
  const form = await c.req.formData();
15843
15844
  const role = String(form.get("role") ?? "");
15844
- await new chunk6OA77UM7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15845
+ await new chunkS2QN4LFD_cjs.TenantService(db).setMemberRole(slug, userId, role);
15845
15846
  return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
15846
15847
  } catch (error) {
15847
15848
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15854,7 +15855,7 @@ function createTenantAdminRoutes() {
15854
15855
  const userId = c.req.param("userId");
15855
15856
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15856
15857
  try {
15857
- await new chunk6OA77UM7_cjs.TenantService(db).removeMember(slug, userId);
15858
+ await new chunkS2QN4LFD_cjs.TenantService(db).removeMember(slug, userId);
15858
15859
  return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
15859
15860
  } catch (error) {
15860
15861
  const message = error instanceof Error ? error.message : "Failed to remove member";
@@ -15870,12 +15871,12 @@ function createTenantAdminRoutes() {
15870
15871
  const form = await c.req.formData();
15871
15872
  const email = String(form.get("email") ?? "");
15872
15873
  const role = String(form.get("role") ?? "viewer");
15873
- const token = await new chunk6OA77UM7_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15874
+ const token = await new chunkS2QN4LFD_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15874
15875
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
15875
15876
  const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
15876
15877
  let note;
15877
15878
  let noteType = "";
15878
- const svc2 = chunk6OA77UM7_cjs.hasEmailService() ? chunk6OA77UM7_cjs.getEmailService() : null;
15879
+ const svc2 = chunkS2QN4LFD_cjs.hasEmailService() ? chunkS2QN4LFD_cjs.getEmailService() : null;
15879
15880
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15880
15881
  if (hasRealProvider) {
15881
15882
  const result = await svc2.send({
@@ -15916,7 +15917,7 @@ function createTenantAdminRoutes() {
15916
15917
  WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
15917
15918
  ).bind(id, slug).first();
15918
15919
  if (!inv) throw new Error("Invitation not found or already used");
15919
- const svc2 = chunk6OA77UM7_cjs.hasEmailService() ? chunk6OA77UM7_cjs.getEmailService() : null;
15920
+ const svc2 = chunkS2QN4LFD_cjs.hasEmailService() ? chunkS2QN4LFD_cjs.getEmailService() : null;
15920
15921
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15921
15922
  if (!hasRealProvider) throw new Error("No email plugin active");
15922
15923
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
@@ -15941,7 +15942,7 @@ function createTenantAdminRoutes() {
15941
15942
  const id = c.req.param("id");
15942
15943
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15943
15944
  try {
15944
- await new chunk6OA77UM7_cjs.TenantService(db).revokeInvitation(slug, id);
15945
+ await new chunkS2QN4LFD_cjs.TenantService(db).revokeInvitation(slug, id);
15945
15946
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
15946
15947
  } catch (error) {
15947
15948
  const message = error instanceof Error ? error.message : "Failed to revoke invitation";
@@ -16171,7 +16172,7 @@ function createJoinRoutes() {
16171
16172
  if (existing) return rerender("An account with this email already exists. Please sign in instead.");
16172
16173
  try {
16173
16174
  const userId = crypto.randomUUID();
16174
- const passwordHash = await chunkE7E3NL3Y_cjs.AuthManager.hashPassword(password);
16175
+ const passwordHash = await chunkBRKXMRMB_cjs.AuthManager.hashPassword(password);
16175
16176
  const now = Date.now();
16176
16177
  const nowSec = Math.floor(now / 1e3);
16177
16178
  await db.batch([
@@ -16184,8 +16185,8 @@ function createJoinRoutes() {
16184
16185
  VALUES (?, ?, ?, 'credential', ?, ?, ?)`
16185
16186
  ).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
16186
16187
  ]);
16187
- await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16188
- const auth = chunkRSBZITK3_cjs.createAuth(c.env);
16188
+ await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16189
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env);
16189
16190
  const origin = new URL(c.req.url).origin;
16190
16191
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16191
16192
  method: "POST",
@@ -16240,7 +16241,7 @@ function createJoinRoutes() {
16240
16241
  version
16241
16242
  }), 400);
16242
16243
  try {
16243
- const auth = chunkRSBZITK3_cjs.createAuth(c.env);
16244
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env);
16244
16245
  const origin = new URL(c.req.url).origin;
16245
16246
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16246
16247
  method: "POST",
@@ -16252,7 +16253,7 @@ function createJoinRoutes() {
16252
16253
  const baBody = await baRes.json();
16253
16254
  const userId = baBody?.user?.id;
16254
16255
  if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
16255
- await new chunk6OA77UM7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16256
+ await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16256
16257
  const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
16257
16258
  copyBaCookies(baRes, headers);
16258
16259
  return new Response(null, { status: 302, headers });
@@ -16266,7 +16267,7 @@ function createJoinRoutes() {
16266
16267
 
16267
16268
  // src/plugins/core-plugins/multi-tenant-plugin/index.ts
16268
16269
  var TENANT_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"/></svg>`;
16269
- var multiTenantPlugin = chunkD6FWEYQE_cjs.definePlugin({
16270
+ var multiTenantPlugin = chunkKWQNB6UM_cjs.definePlugin({
16270
16271
  id: manifest_default2.id,
16271
16272
  version: "1.0.0",
16272
16273
  name: manifest_default2.name,
@@ -16281,30 +16282,30 @@ var multiTenantPlugin = chunkD6FWEYQE_cjs.definePlugin({
16281
16282
  { label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
16282
16283
  ],
16283
16284
  activate: async () => {
16284
- chunkYAURVGUK_cjs.invalidateTenantCache();
16285
+ chunk4DHPR7KR_cjs.invalidateTenantCache();
16285
16286
  console.info("\u2705 Multi-Tenant plugin activated");
16286
16287
  },
16287
16288
  deactivate: async () => {
16288
- chunkYAURVGUK_cjs.invalidateTenantCache();
16289
+ chunk4DHPR7KR_cjs.invalidateTenantCache();
16289
16290
  console.info("\u274C Multi-Tenant plugin deactivated");
16290
16291
  }
16291
16292
  });
16292
16293
  var routes = new hono.Hono();
16293
- routes.use("*", chunkE7E3NL3Y_cjs.requireAuth());
16294
- routes.use("*", chunkE7E3NL3Y_cjs.requireRole(["admin", "editor"]));
16294
+ routes.use("*", chunkBRKXMRMB_cjs.requireAuth());
16295
+ routes.use("*", chunkBRKXMRMB_cjs.requireRole(["admin", "editor"]));
16295
16296
  routes.get("/:rootId", async (c) => {
16296
16297
  const { rootId } = c.req.param();
16297
16298
  const db = c.env.DB;
16298
- const scope = await chunk6OA77UM7_cjs.resolveDocScope(c, db, { rootId });
16299
+ const scope = await chunkS2QN4LFD_cjs.resolveDocScope(c, db, { rootId });
16299
16300
  if (!scope) {
16300
16301
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
16301
16302
  }
16302
16303
  if (!scope.docType?.settings?.versioning) {
16303
16304
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
16304
16305
  }
16305
- const denied = await chunk6OA77UM7_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16306
+ const denied = await chunkS2QN4LFD_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16306
16307
  if (denied) return denied;
16307
- const repo = new chunk6OA77UM7_cjs.DocumentRepository(db, scope.tenantId);
16308
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(db, scope.tenantId);
16308
16309
  const versions = await repo.getVersionHistory(rootId);
16309
16310
  const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
16310
16311
  const rows = versions.map((v) => {
@@ -16397,14 +16398,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16397
16398
  const { rootId, versionNumber } = c.req.param();
16398
16399
  const db = c.env.DB;
16399
16400
  const user = c.get("user");
16400
- const scope = await chunk6OA77UM7_cjs.resolveDocScope(c, db, { rootId });
16401
+ const scope = await chunkS2QN4LFD_cjs.resolveDocScope(c, db, { rootId });
16401
16402
  if (!scope) {
16402
16403
  return c.json({ error: "Document not found" }, 404);
16403
16404
  }
16404
16405
  if (!scope.docType?.settings?.versioning) {
16405
16406
  return c.json({ error: "Versioning not enabled for this type" }, 404);
16406
16407
  }
16407
- const denied = await chunk6OA77UM7_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16408
+ const denied = await chunkS2QN4LFD_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16408
16409
  if (denied) return denied;
16409
16410
  const row = await db.prepare("SELECT * FROM documents WHERE root_id = ? AND tenant_id = ? AND version_number = ? LIMIT 1").bind(rootId, scope.tenantId, Number(versionNumber)).first();
16410
16411
  if (!row) {
@@ -16414,7 +16415,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16414
16415
  const title = row.title ?? null;
16415
16416
  const slug = row.slug ?? null;
16416
16417
  const docType = scope.docType;
16417
- const svc = new chunkJCBDXEY2_cjs.DocumentsService(db, {
16418
+ const svc = new chunkOLEOKHDX_cjs.DocumentsService(db, {
16418
16419
  queryableFields: docType?.queryableFields ?? [],
16419
16420
  typeSchemaVersion: docType?.schemaVersion ?? 1,
16420
16421
  maxVersionsPerRoot: docType?.settings?.maxVersionsPerRoot ?? 50,
@@ -16427,7 +16428,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16427
16428
  var routes_default = routes;
16428
16429
 
16429
16430
  // src/plugins/core-plugins/versioning-plugin/index.ts
16430
- var versioningPlugin = chunkD6FWEYQE_cjs.definePlugin({
16431
+ var versioningPlugin = chunkKWQNB6UM_cjs.definePlugin({
16431
16432
  id: "versioning",
16432
16433
  version: "1.0.0",
16433
16434
  name: "Versioning",
@@ -16504,8 +16505,8 @@ function createMagicLinkAuthPlugin() {
16504
16505
  const baseUrl = new URL(c.req.url).origin;
16505
16506
  const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
16506
16507
  try {
16507
- if (chunk6OA77UM7_cjs.hasEmailService()) {
16508
- await chunk6OA77UM7_cjs.getEmailService().send({
16508
+ if (chunkS2QN4LFD_cjs.hasEmailService()) {
16509
+ await chunkS2QN4LFD_cjs.getEmailService().send({
16509
16510
  to: normalizedEmail,
16510
16511
  subject: "Your Magic Link to Sign In",
16511
16512
  flow: "magic-link",
@@ -16582,19 +16583,19 @@ function createMagicLinkAuthPlugin() {
16582
16583
  SET used = 1, used_at = ?
16583
16584
  WHERE id = ?
16584
16585
  `).bind(Date.now(), magicLink.id).run();
16585
- const tokenTtl = await chunkE7E3NL3Y_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16586
- const jwtToken = await chunkE7E3NL3Y_cjs.AuthManager.generateToken(
16586
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16587
+ const jwtToken = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
16587
16588
  user.id,
16588
16589
  user.email,
16589
16590
  user.role,
16590
16591
  c.env.JWT_SECRET,
16591
16592
  tokenTtl
16592
16593
  );
16593
- chunkE7E3NL3Y_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16594
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16594
16595
  await db.prepare(`
16595
16596
  UPDATE auth_user SET last_login_at = ? WHERE id = ?
16596
16597
  `).bind(Date.now(), user.id).run();
16597
- chunk6OA77UM7_cjs.dispatchHookEvent(
16598
+ chunkS2QN4LFD_cjs.dispatchHookEvent(
16598
16599
  c,
16599
16600
  "auth:magic-link:consumed",
16600
16601
  { user: { id: user.id, email: user.email, role: user.role } },
@@ -17079,7 +17080,7 @@ async function warmCollections(db) {
17079
17080
  const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
17080
17081
  let count = 0;
17081
17082
  try {
17082
- const results = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().map(chunkYAURVGUK_cjs.collectionRecordToRow);
17083
+ const results = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().map(chunk4DHPR7KR_cjs.collectionRecordToRow);
17083
17084
  for (const collection of results) {
17084
17085
  const key = collectionCache.generateKey("item", collection.id);
17085
17086
  await collectionCache.set(key, collection);
@@ -17197,6 +17198,14 @@ function renderCacheDashboard(data) {
17197
17198
  >
17198
17199
  Collection Settings
17199
17200
  </button>
17201
+ <button
17202
+ onclick="switchTab('url-catalog')"
17203
+ id="tab-url-catalog"
17204
+ class="cache-tab border-b-2 border-transparent py-3 px-1 text-sm font-medium text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 hover:border-zinc-300 dark:hover:border-zinc-600 whitespace-nowrap"
17205
+ >
17206
+ URL Catalog
17207
+ ${data.catalog.stats.totalEntries > 0 ? `<span class="ml-1.5 inline-flex items-center rounded-full px-1.5 py-0.5 text-xs font-medium bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-300">${data.catalog.stats.totalEntries}</span>` : ""}
17208
+ </button>
17200
17209
  </nav>
17201
17210
  </div>
17202
17211
 
@@ -17277,10 +17286,18 @@ function renderCacheDashboard(data) {
17277
17286
  <div id="tab-panel-collection-settings" class="hidden space-y-6">
17278
17287
  ${renderCollectionSettingsTab(data.collections)}
17279
17288
  </div>
17289
+
17290
+ <!-- Tab: URL Catalog -->
17291
+ <div id="tab-panel-url-catalog" class="hidden space-y-6">
17292
+ ${renderUrlCatalogTab(data.catalog)}
17293
+ </div>
17280
17294
  </div>
17281
17295
 
17282
17296
  <script>
17283
- function switchTab(tab) {
17297
+ const VALID_TABS = ['overview', 'collection-settings', 'url-catalog']
17298
+
17299
+ function switchTab(tab, pushHash) {
17300
+ if (!VALID_TABS.includes(tab)) tab = 'overview'
17284
17301
  // Update tab button styles
17285
17302
  document.querySelectorAll('.cache-tab').forEach(btn => {
17286
17303
  btn.classList.remove('border-zinc-950', 'dark:border-white', 'text-zinc-950', 'dark:text-white')
@@ -17298,8 +17315,21 @@ function renderCacheDashboard(data) {
17298
17315
  })
17299
17316
  const activePanel = document.getElementById('tab-panel-' + tab)
17300
17317
  if (activePanel) activePanel.classList.remove('hidden')
17318
+
17319
+ // Sync URL hash (pushHash=false when called from hashchange to avoid loop)
17320
+ if (pushHash !== false) location.hash = tab
17301
17321
  }
17302
17322
 
17323
+ document.addEventListener('DOMContentLoaded', function () {
17324
+ const hash = location.hash.slice(1)
17325
+ switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
17326
+ })
17327
+
17328
+ window.addEventListener('hashchange', function () {
17329
+ const hash = location.hash.slice(1)
17330
+ switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
17331
+ })
17332
+
17303
17333
  async function refreshStats() {
17304
17334
  window.location.reload()
17305
17335
  }
@@ -17323,6 +17353,21 @@ function renderCacheDashboard(data) {
17323
17353
  }
17324
17354
  }
17325
17355
 
17356
+ async function clearUrlCatalog() {
17357
+ try {
17358
+ const response = await fetch('/admin/cache/catalog/clear', { method: 'POST' })
17359
+ const result = await response.json()
17360
+ if (result.success) {
17361
+ alert('URL catalog cleared')
17362
+ window.location.reload()
17363
+ } else {
17364
+ alert('Error: ' + result.error)
17365
+ }
17366
+ } catch (error) {
17367
+ alert('Error: ' + error.message)
17368
+ }
17369
+ }
17370
+
17326
17371
  let namespaceToDelete = null
17327
17372
 
17328
17373
  async function clearNamespaceCache(namespace) {
@@ -17350,7 +17395,7 @@ function renderCacheDashboard(data) {
17350
17395
  </script>
17351
17396
 
17352
17397
  <!-- Confirmation Dialogs -->
17353
- ${chunk6OA77UM7_cjs.renderConfirmationDialog({
17398
+ ${chunkS2QN4LFD_cjs.renderConfirmationDialog({
17354
17399
  id: "clear-all-cache-confirm",
17355
17400
  title: "Clear All Cache",
17356
17401
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -17361,7 +17406,7 @@ function renderCacheDashboard(data) {
17361
17406
  onConfirm: "performClearAllCaches()"
17362
17407
  })}
17363
17408
 
17364
- ${chunk6OA77UM7_cjs.renderConfirmationDialog({
17409
+ ${chunkS2QN4LFD_cjs.renderConfirmationDialog({
17365
17410
  id: "clear-namespace-cache-confirm",
17366
17411
  title: "Clear Namespace Cache",
17367
17412
  message: "Clear cache for this namespace?",
@@ -17372,7 +17417,7 @@ function renderCacheDashboard(data) {
17372
17417
  onConfirm: "performClearNamespaceCache()"
17373
17418
  })}
17374
17419
 
17375
- ${chunk6OA77UM7_cjs.getConfirmationDialogScript()}
17420
+ ${chunkS2QN4LFD_cjs.getConfirmationDialogScript()}
17376
17421
  `;
17377
17422
  const layoutData = {
17378
17423
  title: "Cache System",
@@ -17384,6 +17429,130 @@ function renderCacheDashboard(data) {
17384
17429
  };
17385
17430
  return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
17386
17431
  }
17432
+ function renderUrlCatalogTab(catalog) {
17433
+ const { entries, stats, swrPending } = catalog;
17434
+ const statCards = `
17435
+ <div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
17436
+ ${renderMiniStatCard("Tracked URLs", stats.totalEntries.toLocaleString(), "sky")}
17437
+ ${renderMiniStatCard("Cache Hits", stats.totalHits.toLocaleString(), "lime")}
17438
+ ${renderMiniStatCard("Cache Misses", stats.totalMisses.toLocaleString(), "amber")}
17439
+ ${renderMiniStatCard("Stale Serves", stats.totalStale.toLocaleString(), "purple")}
17440
+ </div>
17441
+ `;
17442
+ const swrBadge = swrPending > 0 ? `<span class="ml-2 inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-300">${swrPending} stale pending</span>` : "";
17443
+ if (entries.length === 0) {
17444
+ return `
17445
+ ${statCards}
17446
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17447
+ <div class="p-12 text-center">
17448
+ <svg class="mx-auto h-8 w-8 text-zinc-400 dark:text-zinc-500 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
17449
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
17450
+ </svg>
17451
+ <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">No entries yet</p>
17452
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Cache-eligible API requests will appear here after the first page load.</p>
17453
+ </div>
17454
+ </div>
17455
+ `;
17456
+ }
17457
+ const rows = entries.map((entry) => {
17458
+ const totalReqs = entry.hits + entry.misses + entry.staleServes;
17459
+ const hitRate = totalReqs > 0 ? Math.round(entry.hits / totalReqs * 100) : 0;
17460
+ const hitRateColor = hitRate > 70 ? "text-lime-600 dark:text-lime-400" : hitRate > 40 ? "text-amber-600 dark:text-amber-400" : "text-red-600 dark:text-red-400";
17461
+ const pathDisplay = entry.queryString ? `${entry.path}?${entry.queryString}` : entry.path;
17462
+ const truncatedPath = pathDisplay.length > 80 ? pathDisplay.slice(0, 77) + "\u2026" : pathDisplay;
17463
+ const collBadge = entry.collection ? `<span class="inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium bg-sky-50 dark:bg-sky-500/10 text-sky-700 dark:text-sky-400 ring-1 ring-inset ring-sky-600/20">${entry.collection}</span>` : `<span class="text-xs text-zinc-400 dark:text-zinc-600">\u2014</span>`;
17464
+ const timeAgo = formatTimeAgo(entry.lastSeen);
17465
+ return `
17466
+ <tr class="hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
17467
+ <td class="px-4 py-3 max-w-xs">
17468
+ <code class="text-xs text-zinc-700 dark:text-zinc-300 break-all" title="${pathDisplay}">${truncatedPath}</code>
17469
+ </td>
17470
+ <td class="px-4 py-3 whitespace-nowrap">${collBadge}</td>
17471
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-900 dark:text-zinc-100 text-right">${totalReqs.toLocaleString()}</td>
17472
+ <td class="px-4 py-3 whitespace-nowrap text-right">
17473
+ <span class="text-sm font-medium ${hitRateColor}">${hitRate}%</span>
17474
+ </td>
17475
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.hits.toLocaleString()}</td>
17476
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.misses.toLocaleString()}</td>
17477
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-500 text-right">${entry.staleServes > 0 ? entry.staleServes.toLocaleString() : "\u2014"}</td>
17478
+ <td class="px-4 py-3 whitespace-nowrap text-xs text-zinc-400 dark:text-zinc-500 text-right">${timeAgo}</td>
17479
+ </tr>
17480
+ `;
17481
+ }).join("");
17482
+ return `
17483
+ ${statCards}
17484
+
17485
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17486
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10 flex items-center justify-between">
17487
+ <div>
17488
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">
17489
+ Cache-Eligible API URLs${swrBadge}
17490
+ </h2>
17491
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
17492
+ Ranked by total requests. Resets on isolate eviction. Scoped to public/privileged (non-ACL) requests only.
17493
+ </p>
17494
+ </div>
17495
+ <button
17496
+ onclick="clearUrlCatalog()"
17497
+ class="inline-flex items-center gap-2 rounded-lg bg-white dark:bg-zinc-900 px-3 py-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-300 ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800"
17498
+ >
17499
+ Clear
17500
+ </button>
17501
+ </div>
17502
+ <div class="overflow-x-auto">
17503
+ <table class="min-w-full divide-y divide-zinc-950/5 dark:divide-white/10">
17504
+ <thead class="bg-zinc-50 dark:bg-zinc-800/50">
17505
+ <tr>
17506
+ <th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">URL</th>
17507
+ <th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Collection</th>
17508
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Requests</th>
17509
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hit Rate</th>
17510
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hits</th>
17511
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Misses</th>
17512
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Stale</th>
17513
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Last Seen</th>
17514
+ </tr>
17515
+ </thead>
17516
+ <tbody class="divide-y divide-zinc-950/5 dark:divide-white/10">
17517
+ ${rows}
17518
+ </tbody>
17519
+ </table>
17520
+ </div>
17521
+ </div>
17522
+
17523
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17524
+ <div class="px-6 py-5">
17525
+ <h3 class="text-sm font-semibold text-zinc-950 dark:text-white mb-2">About this catalog</h3>
17526
+ <ul class="text-sm text-zinc-600 dark:text-zinc-400 space-y-1 list-disc list-inside">
17527
+ <li><strong>Phase 1 (done):</strong> Collection-scoped cache invalidation \u2014 content changes only purge the affected collection's keys.</li>
17528
+ <li><strong>Phase 2 (this view):</strong> URL catalog tracks every cache-eligible API request. Use to identify hot URLs for targeted pre-warming.</li>
17529
+ <li><strong>Phase 3 (SWR):</strong> Stale-While-Revalidate \u2014 on invalidation, the previous response is kept for 30 s so the first post-edit request is served from cache instantly. Stale serves are counted above.</li>
17530
+ <li>Catalog is per-isolate and resets on cold start. For persistent tracking, sink data to Analytics Engine.</li>
17531
+ </ul>
17532
+ </div>
17533
+ </div>
17534
+ `;
17535
+ }
17536
+ function renderMiniStatCard(label, value, color) {
17537
+ const colorClasses = {
17538
+ sky: "bg-sky-50 dark:bg-sky-500/10 text-sky-600 dark:text-sky-400",
17539
+ lime: "bg-lime-50 dark:bg-lime-500/10 text-lime-600 dark:text-lime-400",
17540
+ amber: "bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400",
17541
+ purple: "bg-purple-50 dark:bg-purple-500/10 text-purple-600 dark:text-purple-400"
17542
+ };
17543
+ return `
17544
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10 p-4">
17545
+ <p class="text-xs text-zinc-500 dark:text-zinc-400">${label}</p>
17546
+ <p class="mt-1 text-xl font-semibold ${colorClasses[color] ?? colorClasses.sky}">${value}</p>
17547
+ </div>
17548
+ `;
17549
+ }
17550
+ function formatTimeAgo(ts) {
17551
+ const secs = Math.floor((Date.now() - ts) / 1e3);
17552
+ if (secs < 60) return `${secs}s ago`;
17553
+ if (secs < 3600) return `${Math.floor(secs / 60)}m ago`;
17554
+ return `${Math.floor(secs / 3600)}h ago`;
17555
+ }
17387
17556
  function renderCollectionSettingsTab(collections) {
17388
17557
  if (collections.length === 0) {
17389
17558
  return `
@@ -17638,7 +17807,7 @@ app.get("/", async (c) => {
17638
17807
  const totalRequests = totalHits + totalMisses;
17639
17808
  const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
17640
17809
  const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
17641
- const collections = chunkYAURVGUK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17810
+ const collections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17642
17811
  const cacheOverride = r.cache;
17643
17812
  const cacheEnabled = cacheOverride?.enabled !== false;
17644
17813
  const hasCustomTtl = typeof cacheOverride?.ttl === "number";
@@ -17651,6 +17820,9 @@ app.get("/", async (c) => {
17651
17820
  ttlSource: hasCustomTtl ? "collection" : "default"
17652
17821
  };
17653
17822
  });
17823
+ await chunkFZGIU5AZ_cjs.loadKvCatalog();
17824
+ const catalogEntries = chunkFZGIU5AZ_cjs.getCatalog({ limit: 100 });
17825
+ const catalogSummary = chunkFZGIU5AZ_cjs.getCatalogStats();
17654
17826
  const dashboardData = {
17655
17827
  stats,
17656
17828
  totals: {
@@ -17663,6 +17835,11 @@ app.get("/", async (c) => {
17663
17835
  },
17664
17836
  namespaces: Object.keys(stats),
17665
17837
  collections,
17838
+ catalog: {
17839
+ entries: catalogEntries,
17840
+ stats: catalogSummary,
17841
+ swrPending: chunkS2QN4LFD_cjs.swrStats().count
17842
+ },
17666
17843
  user: user ? {
17667
17844
  name: user.email,
17668
17845
  email: user.email,
@@ -18009,6 +18186,24 @@ app.post("/warm/:namespace", async (c) => {
18009
18186
  }, 500);
18010
18187
  }
18011
18188
  });
18189
+ app.get("/catalog", async (c) => {
18190
+ const collection = c.req.query("collection") || void 0;
18191
+ const sortBy = c.req.query("sort") || "requests";
18192
+ const limit = parseInt(c.req.query("limit") || "100");
18193
+ await chunkFZGIU5AZ_cjs.loadKvCatalog();
18194
+ const entries = chunkFZGIU5AZ_cjs.getCatalog({ collection, sortBy, limit });
18195
+ const stats = chunkFZGIU5AZ_cjs.getCatalogStats();
18196
+ return c.json({
18197
+ success: true,
18198
+ data: { entries, stats, swrPending: chunkS2QN4LFD_cjs.swrStats().count },
18199
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
18200
+ });
18201
+ });
18202
+ app.post("/catalog/clear", async (_c) => {
18203
+ chunkFZGIU5AZ_cjs.clearCatalog();
18204
+ await chunkFZGIU5AZ_cjs.clearKvCatalog();
18205
+ return _c.json({ success: true, message: "URL catalog cleared", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
18206
+ });
18012
18207
  var routes_default2 = app;
18013
18208
 
18014
18209
  // src/plugins/cache/index.ts
@@ -18175,9 +18370,9 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
18175
18370
  // src/app.ts
18176
18371
  function createSonicJSApp(config = {}) {
18177
18372
  const app2 = new hono.Hono();
18178
- const appVersion = config.version || chunkBJ6NJL2E_cjs.getCoreVersion();
18373
+ const appVersion = config.version || chunkXZUEGFXE_cjs.getCoreVersion();
18179
18374
  const appName = config.name || "SonicJS AI";
18180
- const hookSystem = new chunkI7MIRRFJ_cjs.HookSystemImpl();
18375
+ const hookSystem = new chunkA22RBHO7_cjs.HookSystemImpl();
18181
18376
  chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
18182
18377
  const magicLinkPlugin = createMagicLinkAuthPlugin();
18183
18378
  const corePluginsBeforeCatchAll = [
@@ -18185,7 +18380,7 @@ function createSonicJSApp(config = {}) {
18185
18380
  apiKeysPlugin,
18186
18381
  aiSearchPlugin,
18187
18382
  oauthProvidersPlugin,
18188
- chunk6OA77UM7_cjs.userProfilesPlugin,
18383
+ chunkS2QN4LFD_cjs.userProfilesPlugin,
18189
18384
  otpLoginPlugin,
18190
18385
  analyticsPlugin,
18191
18386
  stripePlugin,
@@ -18195,24 +18390,24 @@ function createSonicJSApp(config = {}) {
18195
18390
  shortcodesPlugin,
18196
18391
  helloWorldPlugin,
18197
18392
  multiTenantPlugin,
18198
- chunk6OA77UM7_cjs.lexicalEditorPlugin,
18393
+ chunkS2QN4LFD_cjs.lexicalEditorPlugin,
18199
18394
  versioningPlugin,
18200
18395
  menuPlugin
18201
18396
  ];
18202
18397
  const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
18203
- const wirePlugins = chunkI7MIRRFJ_cjs.createPluginWirer(
18398
+ const wirePlugins = chunkA22RBHO7_cjs.createPluginWirer(
18204
18399
  () => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
18205
18400
  // The capability-gated `ctx.cap.email` resolves to the app EmailService, which
18206
18401
  // is initialized (below) just before wiring on the first request.
18207
18402
  () => ({
18208
18403
  hooks: hookSystem,
18209
18404
  env: firstRequestEnv,
18210
- providers: { email: () => chunk6OA77UM7_cjs.getEmailService() }
18405
+ providers: { email: () => chunkS2QN4LFD_cjs.getEmailService() }
18211
18406
  })
18212
18407
  );
18213
18408
  let firstRequestEnv;
18214
18409
  const initEmailService = async (env = {}) => {
18215
- if (chunk6OA77UM7_cjs.hasEmailService()) return;
18410
+ if (chunkS2QN4LFD_cjs.hasEmailService()) return;
18216
18411
  let provider;
18217
18412
  let defaultFrom = config.email?.from;
18218
18413
  let defaultReplyTo;
@@ -18247,14 +18442,14 @@ function createSonicJSApp(config = {}) {
18247
18442
  }
18248
18443
  }
18249
18444
  defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
18250
- chunk6OA77UM7_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18445
+ chunkS2QN4LFD_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18251
18446
  };
18252
18447
  app2.use("*", async (c, next) => {
18253
18448
  c.set("appVersion", appVersion);
18254
18449
  await next();
18255
18450
  });
18256
- app2.use("*", chunkE7E3NL3Y_cjs.metricsMiddleware());
18257
- app2.use("*", chunkE7E3NL3Y_cjs.bootstrapMiddleware(config, [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []]));
18451
+ app2.use("*", chunkBRKXMRMB_cjs.metricsMiddleware());
18452
+ app2.use("*", chunkBRKXMRMB_cjs.bootstrapMiddleware(config, [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []]));
18258
18453
  const boot = async (env) => {
18259
18454
  if (config.plugins?.disableAll) return;
18260
18455
  firstRequestEnv = env;
@@ -18286,19 +18481,28 @@ function createSonicJSApp(config = {}) {
18286
18481
  const allowed = c.env?.CORS_ORIGINS;
18287
18482
  if (!allowed) return null;
18288
18483
  const list = allowed.split(",").map((s) => s.trim());
18289
- return list.includes(origin) ? origin : null;
18484
+ const match = list.some((pattern) => {
18485
+ if (pattern === origin) return true;
18486
+ if (pattern.startsWith("*.")) {
18487
+ const suffix = pattern.slice(1);
18488
+ return origin.endsWith(suffix);
18489
+ }
18490
+ return false;
18491
+ });
18492
+ return match ? origin : null;
18290
18493
  },
18291
18494
  allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
18292
- allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
18495
+ allowHeaders: ["Content-Type", "Authorization", "X-API-Key", "Cache-Control"],
18496
+ exposeHeaders: ["X-Cache-Status", "X-Cache-Source", "X-Cache-TTL", "X-Response-Time"],
18293
18497
  credentials: true
18294
18498
  }));
18295
- app2.use("*", chunkE7E3NL3Y_cjs.securityHeadersMiddleware());
18296
- app2.use("*", chunkE7E3NL3Y_cjs.csrfProtection());
18499
+ app2.use("*", chunkBRKXMRMB_cjs.securityHeadersMiddleware());
18500
+ app2.use("*", chunkBRKXMRMB_cjs.csrfProtection());
18297
18501
  app2.use("*", async (c, next) => {
18298
18502
  try {
18299
18503
  const reqUrl = new URL(c.req.url);
18300
18504
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18301
- const auth = chunkRSBZITK3_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18505
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18302
18506
  const session = await auth.api.getSession({ headers: c.req.raw.headers });
18303
18507
  if (session?.user) {
18304
18508
  const u = session.user;
@@ -18333,7 +18537,7 @@ function createSonicJSApp(config = {}) {
18333
18537
  const token = authHeader.slice(7);
18334
18538
  try {
18335
18539
  const secret = c.env?.JWT_SECRET;
18336
- const payload = await chunkE7E3NL3Y_cjs.AuthManager.verifyToken(token, secret);
18540
+ const payload = await chunkBRKXMRMB_cjs.AuthManager.verifyToken(token, secret);
18337
18541
  if (payload) {
18338
18542
  c.set("user", {
18339
18543
  userId: payload.userId,
@@ -18354,9 +18558,9 @@ function createSonicJSApp(config = {}) {
18354
18558
  app2.use("*", middleware);
18355
18559
  }
18356
18560
  }
18357
- app2.use("*", chunkYAURVGUK_cjs.tenantMiddleware());
18358
- app2.use("/admin/*", chunkE7E3NL3Y_cjs.requireAuth());
18359
- app2.use("/admin/*", chunkE7E3NL3Y_cjs.requireRbac("portal", "access"));
18561
+ app2.use("*", chunk4DHPR7KR_cjs.tenantMiddleware());
18562
+ app2.use("/admin/*", chunkBRKXMRMB_cjs.requireAuth());
18563
+ app2.use("/admin/*", chunkBRKXMRMB_cjs.requireRbac("portal", "access"));
18360
18564
  app2.use("/admin/*", pluginMenuMiddleware());
18361
18565
  app2.use("/admin/*", menuMiddleware());
18362
18566
  const NAV_LANDING = [
@@ -18374,7 +18578,7 @@ function createSonicJSApp(config = {}) {
18374
18578
  if (!user?.userId) return next();
18375
18579
  let perms = [];
18376
18580
  try {
18377
- const { RbacService: RbacService2 } = await import('./rbac-AORZ6O3N.cjs');
18581
+ const { RbacService: RbacService2 } = await import('./rbac-TFUOYIVN.cjs');
18378
18582
  perms = await new RbacService2(c.env.DB, c.env.CACHE_KV).permissionsForUser(user.userId);
18379
18583
  } catch {
18380
18584
  return next();
@@ -18403,43 +18607,43 @@ function createSonicJSApp(config = {}) {
18403
18607
  });
18404
18608
  app2.route("/api/security-audit", apiRoutes2);
18405
18609
  app2.route("/admin/plugins/security-audit", adminRoutes3);
18406
- app2.route("/api/media", chunk6OA77UM7_cjs.api_media_default);
18407
- app2.route("/api/system", chunk6OA77UM7_cjs.api_system_default);
18408
- app2.route("/api/documents", chunk6OA77UM7_cjs.apiDocumentsRoutes);
18409
- app2.route("/api", chunk6OA77UM7_cjs.api_default);
18410
- app2.route("/admin/documents", chunk6OA77UM7_cjs.adminDocumentsRoutes);
18411
- chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18412
- app2.route("/admin/api", chunk6OA77UM7_cjs.admin_api_default);
18413
- app2.route("/admin/collections", chunk6OA77UM7_cjs.adminCollectionsRoutes);
18414
- app2.route("/admin/settings", chunk6OA77UM7_cjs.adminSettingsRoutes);
18415
- app2.route("/admin/api-reference", chunk6OA77UM7_cjs.router2);
18610
+ app2.route("/api/media", chunkS2QN4LFD_cjs.api_media_default);
18611
+ app2.route("/api/system", chunkS2QN4LFD_cjs.api_system_default);
18612
+ app2.route("/api/documents", chunkS2QN4LFD_cjs.apiDocumentsRoutes);
18613
+ app2.route("/api", chunkS2QN4LFD_cjs.api_default);
18614
+ app2.route("/admin/documents", chunkS2QN4LFD_cjs.adminDocumentsRoutes);
18615
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18616
+ app2.route("/admin/api", chunkS2QN4LFD_cjs.admin_api_default);
18617
+ app2.route("/admin/collections", chunkS2QN4LFD_cjs.adminCollectionsRoutes);
18618
+ app2.route("/admin/settings", chunkS2QN4LFD_cjs.adminSettingsRoutes);
18619
+ app2.route("/admin/api-reference", chunkS2QN4LFD_cjs.router2);
18416
18620
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
18417
- app2.route("/admin/content", chunk6OA77UM7_cjs.admin_content_default);
18418
- app2.route("/admin/media", chunk6OA77UM7_cjs.adminMediaRoutes);
18621
+ app2.route("/admin/content", chunkS2QN4LFD_cjs.admin_content_default);
18622
+ app2.route("/admin/media", chunkS2QN4LFD_cjs.adminMediaRoutes);
18419
18623
  app2.use("/auth/*", securityAuditMiddleware());
18420
18624
  if (!config.plugins?.disableAll) {
18421
- chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18625
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18422
18626
  app2.route("/admin/cache", cache_default.getRoutes());
18423
18627
  if (config.plugins?.register && config.plugins.register.length > 0) {
18424
- chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18628
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18425
18629
  }
18426
18630
  }
18427
18631
  app2.route("/api/events", apiRoutes4);
18428
- app2.route("/admin/dashboard", chunk6OA77UM7_cjs.router);
18429
- app2.route("/admin/plugins", chunk6OA77UM7_cjs.adminPluginRoutes);
18430
- app2.route("/admin/logs", chunk6OA77UM7_cjs.adminLogsRoutes);
18632
+ app2.route("/admin/dashboard", chunkS2QN4LFD_cjs.router);
18633
+ app2.route("/admin/plugins", chunkS2QN4LFD_cjs.adminPluginRoutes);
18634
+ app2.route("/admin/logs", chunkS2QN4LFD_cjs.adminLogsRoutes);
18431
18635
  app2.route("/admin/rbac", adminRbacRoutes);
18432
- app2.route("/admin", chunk6OA77UM7_cjs.userRoutes);
18433
- app2.route("/auth", chunk6OA77UM7_cjs.auth_default);
18636
+ app2.route("/admin", chunkS2QN4LFD_cjs.userRoutes);
18637
+ app2.route("/auth", chunkS2QN4LFD_cjs.auth_default);
18434
18638
  app2.on(["GET", "POST"], "/auth/*", (c) => {
18435
18639
  const reqUrl = new URL(c.req.url);
18436
18640
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18437
- const auth = chunkRSBZITK3_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18641
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18438
18642
  return auth.handler(c.req.raw);
18439
18643
  });
18440
- app2.route("/", chunk6OA77UM7_cjs.test_cleanup_default);
18644
+ app2.route("/", chunkS2QN4LFD_cjs.test_cleanup_default);
18441
18645
  if (!config.plugins?.disableAll) {
18442
- chunkI7MIRRFJ_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18646
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18443
18647
  }
18444
18648
  if (!config.plugins?.disableAll) {
18445
18649
  const allMountedPlugins = [
@@ -18449,10 +18653,10 @@ function createSonicJSApp(config = {}) {
18449
18653
  ...config.plugins?.register ?? []
18450
18654
  ];
18451
18655
  const userPlugins = (config.plugins?.register ?? []).filter(
18452
- (p) => !chunkYAURVGUK_cjs.PLUGIN_REGISTRY[p.id]
18656
+ (p) => !chunk4DHPR7KR_cjs.PLUGIN_REGISTRY[p.id]
18453
18657
  );
18454
- chunkD6FWEYQE_cjs.setPluginMenu(userPlugins.flatMap((p) => (p.menu ?? []).map((m) => ({ ...m, pluginId: p.id }))));
18455
- chunkD6FWEYQE_cjs.setPluginDefinitions(allMountedPlugins);
18658
+ chunkKWQNB6UM_cjs.setPluginMenu(userPlugins.flatMap((p) => (p.menu ?? []).map((m) => ({ ...m, pluginId: p.id }))));
18659
+ chunkKWQNB6UM_cjs.setPluginDefinitions(allMountedPlugins);
18456
18660
  }
18457
18661
  app2.get("/favicon.svg", (c) => {
18458
18662
  return new Response(faviconSvg, {
@@ -18505,7 +18709,7 @@ function createSonicJSApp(config = {}) {
18505
18709
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
18506
18710
  });
18507
18711
  });
18508
- chunk36Z3AKX3_cjs.setAppInstance(app2);
18712
+ chunkC5LDQ3SH_cjs.setAppInstance(app2);
18509
18713
  app2.notFound((c) => {
18510
18714
  return c.json({ error: "Not Found", status: 404 }, 404);
18511
18715
  });
@@ -19320,7 +19524,7 @@ var RedirectService = class {
19320
19524
  env;
19321
19525
  cloudflareService = null;
19322
19526
  getDocService() {
19323
- return new chunkJCBDXEY2_cjs.DocumentsService(this.db, {
19527
+ return new chunkOLEOKHDX_cjs.DocumentsService(this.db, {
19324
19528
  queryableFields: REDIRECT_QUERYABLE_FIELDS,
19325
19529
  maxVersionsPerRoot: 1,
19326
19530
  tenantId: TENANT3
@@ -21946,7 +22150,7 @@ function createRedirectApiRoutes() {
21946
22150
  });
21947
22151
  return api;
21948
22152
  }
21949
- var redirectPlugin = chunkD6FWEYQE_cjs.definePlugin({
22153
+ var redirectPlugin = chunkKWQNB6UM_cjs.definePlugin({
21950
22154
  id: manifest_default3.id,
21951
22155
  version: manifest_default3.version,
21952
22156
  name: manifest_default3.name,
@@ -21964,7 +22168,7 @@ var redirectPlugin = chunkD6FWEYQE_cjs.definePlugin({
21964
22168
  async onBoot(ctx) {
21965
22169
  const db = ctx.env?.DB;
21966
22170
  if (!db) return;
21967
- const registry = new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(db);
22171
+ const registry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
21968
22172
  await registry.register({
21969
22173
  id: "redirect",
21970
22174
  name: "redirect",
@@ -21988,6 +22192,69 @@ function createRedirectPlugin() {
21988
22192
  return redirectPlugin;
21989
22193
  }
21990
22194
 
22195
+ // src/plugins/core-plugins/demo-login/index.ts
22196
+ var demoLoginJs = `
22197
+ // Demo Login Prefill Script
22198
+ (function() {
22199
+ 'use strict';
22200
+
22201
+ function prefillLoginForm() {
22202
+ const emailInput = document.getElementById('email');
22203
+ const passwordInput = document.getElementById('password');
22204
+
22205
+ if (emailInput && passwordInput) {
22206
+ emailInput.value = 'admin@sonicjs.com';
22207
+ passwordInput.value = 'sonicjs!';
22208
+
22209
+ const form = emailInput.closest('form');
22210
+ if (form) {
22211
+ const notice = document.createElement('div');
22212
+ notice.className = 'mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-blue-800 text-sm';
22213
+ notice.innerHTML = '\u{1F3AF} <strong>Demo Mode:</strong> Login form prefilled with demo credentials';
22214
+ form.insertBefore(notice, form.firstChild);
22215
+ }
22216
+ }
22217
+ }
22218
+
22219
+ if (document.readyState === 'loading') {
22220
+ document.addEventListener('DOMContentLoaded', prefillLoginForm);
22221
+ } else {
22222
+ prefillLoginForm();
22223
+ }
22224
+
22225
+ document.addEventListener('htmx:afterSwap', function(event) {
22226
+ if (event.detail.target.id === 'main-content' ||
22227
+ document.getElementById('email')) {
22228
+ setTimeout(prefillLoginForm, 100);
22229
+ }
22230
+ });
22231
+ })();
22232
+ `;
22233
+ var loginPrefillHandler = async (data) => {
22234
+ if (data.pageType === "auth-login" || data.template?.includes("login")) {
22235
+ data.scripts = data.scripts ?? [];
22236
+ data.inlineScripts = data.inlineScripts ?? [];
22237
+ data.inlineScripts.push(demoLoginJs);
22238
+ }
22239
+ return data;
22240
+ };
22241
+ var demoLoginPlugin = chunkKWQNB6UM_cjs.definePlugin({
22242
+ id: "demo-login-plugin",
22243
+ version: "1.0.0",
22244
+ name: "Demo Login",
22245
+ description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration.",
22246
+ sonicjsVersionRange: "^3.0.0",
22247
+ author: { name: "SonicJS" },
22248
+ async onBoot(ctx) {
22249
+ chunkS2QN4LFD_cjs.setDemoModeActive();
22250
+ const hooks = ctx.raw?.hooks;
22251
+ if (hooks?.register) {
22252
+ hooks.register("template:render", loginPrefillHandler);
22253
+ hooks.register("page:before-render", loginPrefillHandler);
22254
+ }
22255
+ }
22256
+ });
22257
+
21991
22258
  // src/collections/site-settings.collection.ts
21992
22259
  var site_settings_collection_default = {
21993
22260
  name: "site_settings",
@@ -22370,10 +22637,10 @@ function shapeDocument(doc, redactFields) {
22370
22637
  };
22371
22638
  }
22372
22639
  async function resolveType(ctx, typeId) {
22373
- const docType = await new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22640
+ const docType = await new chunkBRKXMRMB_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22374
22641
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22375
- const effTenant = chunk6OA77UM7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22376
- const repo = new chunk6OA77UM7_cjs.DocumentRepository(ctx.db, effTenant);
22642
+ const effTenant = chunkS2QN4LFD_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22643
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(ctx.db, effTenant);
22377
22644
  return { docType, repo };
22378
22645
  }
22379
22646
  async function execList(ctx, typeId, args) {
@@ -22411,11 +22678,11 @@ async function execGet(ctx, typeId, args) {
22411
22678
 
22412
22679
  // src/plugins/core-plugins/mcp-plugin/tools/mutations.ts
22413
22680
  async function resolveWriteScope(ctx, typeId) {
22414
- const docType = await new chunkE7E3NL3Y_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22681
+ const docType = await new chunkBRKXMRMB_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22415
22682
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22416
- const effTenant = chunk6OA77UM7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22417
- const repo = new chunk6OA77UM7_cjs.DocumentRepository(ctx.db, effTenant);
22418
- const svc = new chunkJCBDXEY2_cjs.DocumentsService(ctx.db, {
22683
+ const effTenant = chunkS2QN4LFD_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22684
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(ctx.db, effTenant);
22685
+ const svc = new chunkOLEOKHDX_cjs.DocumentsService(ctx.db, {
22419
22686
  queryableFields: docType.queryableFields ?? [],
22420
22687
  typeSchemaVersion: docType.schemaVersion,
22421
22688
  maxVersionsPerRoot: docType.settings?.maxVersionsPerRoot,
@@ -22429,7 +22696,7 @@ async function assertAllowed(scope, ctx, rootId, permission) {
22429
22696
  if (!ok) throw new McpToolError(`Permission denied: cannot ${permission} ${scope.docType.id}`);
22430
22697
  }
22431
22698
  function applyUserFieldDefaults(data, typeId, userId) {
22432
- const col = chunkYAURVGUK_cjs.getCollectionRegistry().getByName(typeId);
22699
+ const col = chunk4DHPR7KR_cjs.getCollectionRegistry().getByName(typeId);
22433
22700
  if (!col?.schema?.properties) return data;
22434
22701
  const props = col.schema.properties;
22435
22702
  const patched = { ...data };
@@ -22442,7 +22709,7 @@ async function execCreate(ctx, typeId, args) {
22442
22709
  const scope = await resolveWriteScope(ctx, typeId);
22443
22710
  await assertAllowed(scope, ctx, "", "create");
22444
22711
  const data = redact(applyUserFieldDefaults(args.data ?? {}, typeId, ctx.userId), ctx.redactFields);
22445
- const input = chunk6OA77UM7_cjs.createDocumentSchema.parse({
22712
+ const input = chunkS2QN4LFD_cjs.createDocumentSchema.parse({
22446
22713
  typeId,
22447
22714
  tenantId: scope.effTenant,
22448
22715
  title: args.title ?? null,
@@ -22460,7 +22727,7 @@ async function execUpdate(ctx, typeId, args) {
22460
22727
  const current = await scope.repo.getCurrentDraft(args.id);
22461
22728
  if (!current || current.typeId !== typeId) throw new McpToolError("Document not found");
22462
22729
  await assertAllowed(scope, ctx, args.id, "update");
22463
- const patch = chunk6OA77UM7_cjs.updateDocumentSchema.parse({
22730
+ const patch = chunkS2QN4LFD_cjs.updateDocumentSchema.parse({
22464
22731
  ...args.title !== void 0 ? { title: args.title } : {},
22465
22732
  ...args.slug !== void 0 ? { slug: args.slug } : {},
22466
22733
  ...args.data !== void 0 ? { data: redact(args.data, ctx.redactFields) } : {}
@@ -22566,8 +22833,8 @@ function createMcpRoutes(options = {}) {
22566
22833
  rpcError(id, JSON_RPC.UNAUTHORIZED, "Unauthorized: provide a valid API key via Authorization: Bearer sk_...")
22567
22834
  );
22568
22835
  }
22569
- const { tenantId, principalSet, userId } = chunk6OA77UM7_cjs.getDocumentRequestContext(c);
22570
- const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
22836
+ const { tenantId, principalSet, userId } = chunkS2QN4LFD_cjs.getDocumentRequestContext(c);
22837
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
22571
22838
  const active = registry.listActive();
22572
22839
  const collections = new Map(active.map((col) => [col.name, col]));
22573
22840
  const cfg = resolveMcpConfig(options, active);
@@ -22856,7 +23123,7 @@ function renderMcpDashboardPage(data) {
22856
23123
  // src/plugins/core-plugins/mcp-plugin/admin/routes.ts
22857
23124
  function createMcpAdminRoutes(options = {}) {
22858
23125
  const routes2 = new hono.Hono();
22859
- routes2.use("*", chunkE7E3NL3Y_cjs.requireAuth());
23126
+ routes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
22860
23127
  routes2.use("*", async (c, next) => {
22861
23128
  const user = c.get("user");
22862
23129
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
@@ -22865,7 +23132,7 @@ function createMcpAdminRoutes(options = {}) {
22865
23132
  routes2.get("/", async (c) => {
22866
23133
  const url = new URL(c.req.url);
22867
23134
  const endpointUrl = `${url.protocol}//${url.host}/mcp`;
22868
- const registry = chunkYAURVGUK_cjs.getCollectionRegistry();
23135
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
22869
23136
  const active = registry.listActive();
22870
23137
  const collections = new Map(active.map((col) => [col.name, col]));
22871
23138
  const cfg = resolveMcpConfig(options, active);
@@ -22888,7 +23155,7 @@ function createMcpAdminRoutes(options = {}) {
22888
23155
  // src/plugins/core-plugins/mcp-plugin/index.ts
22889
23156
  var MCP_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>`;
22890
23157
  function mcpPlugin(options = {}) {
22891
- return chunkD6FWEYQE_cjs.definePlugin({
23158
+ return chunkKWQNB6UM_cjs.definePlugin({
22892
23159
  id: "mcp",
22893
23160
  version: "1.0.0",
22894
23161
  name: "MCP Server",
@@ -22907,103 +23174,103 @@ function createMcpPlugin(options) {
22907
23174
  }
22908
23175
 
22909
23176
  // src/index.ts
22910
- var VERSION = chunkBJ6NJL2E_cjs.package_default.version;
23177
+ var VERSION = chunkXZUEGFXE_cjs.package_default.version;
22911
23178
 
22912
23179
  Object.defineProperty(exports, "DocumentRepository", {
22913
23180
  enumerable: true,
22914
- get: function () { return chunk6OA77UM7_cjs.DocumentRepository; }
23181
+ get: function () { return chunkS2QN4LFD_cjs.DocumentRepository; }
22915
23182
  });
22916
23183
  Object.defineProperty(exports, "ROUTES_INFO", {
22917
23184
  enumerable: true,
22918
- get: function () { return chunk6OA77UM7_cjs.ROUTES_INFO; }
23185
+ get: function () { return chunkS2QN4LFD_cjs.ROUTES_INFO; }
22919
23186
  });
22920
23187
  Object.defineProperty(exports, "adminApiRoutes", {
22921
23188
  enumerable: true,
22922
- get: function () { return chunk6OA77UM7_cjs.admin_api_default; }
23189
+ get: function () { return chunkS2QN4LFD_cjs.admin_api_default; }
22923
23190
  });
22924
23191
  Object.defineProperty(exports, "adminCheckboxRoutes", {
22925
23192
  enumerable: true,
22926
- get: function () { return chunk6OA77UM7_cjs.adminCheckboxRoutes; }
23193
+ get: function () { return chunkS2QN4LFD_cjs.adminCheckboxRoutes; }
22927
23194
  });
22928
23195
  Object.defineProperty(exports, "adminCollectionsRoutes", {
22929
23196
  enumerable: true,
22930
- get: function () { return chunk6OA77UM7_cjs.adminCollectionsRoutes; }
23197
+ get: function () { return chunkS2QN4LFD_cjs.adminCollectionsRoutes; }
22931
23198
  });
22932
23199
  Object.defineProperty(exports, "adminContentRoutes", {
22933
23200
  enumerable: true,
22934
- get: function () { return chunk6OA77UM7_cjs.admin_content_default; }
23201
+ get: function () { return chunkS2QN4LFD_cjs.admin_content_default; }
22935
23202
  });
22936
23203
  Object.defineProperty(exports, "adminDashboardRoutes", {
22937
23204
  enumerable: true,
22938
- get: function () { return chunk6OA77UM7_cjs.router; }
23205
+ get: function () { return chunkS2QN4LFD_cjs.router; }
22939
23206
  });
22940
23207
  Object.defineProperty(exports, "adminLogsRoutes", {
22941
23208
  enumerable: true,
22942
- get: function () { return chunk6OA77UM7_cjs.adminLogsRoutes; }
23209
+ get: function () { return chunkS2QN4LFD_cjs.adminLogsRoutes; }
22943
23210
  });
22944
23211
  Object.defineProperty(exports, "adminMediaRoutes", {
22945
23212
  enumerable: true,
22946
- get: function () { return chunk6OA77UM7_cjs.adminMediaRoutes; }
23213
+ get: function () { return chunkS2QN4LFD_cjs.adminMediaRoutes; }
22947
23214
  });
22948
23215
  Object.defineProperty(exports, "adminPluginRoutes", {
22949
23216
  enumerable: true,
22950
- get: function () { return chunk6OA77UM7_cjs.adminPluginRoutes; }
23217
+ get: function () { return chunkS2QN4LFD_cjs.adminPluginRoutes; }
22951
23218
  });
22952
23219
  Object.defineProperty(exports, "adminSettingsRoutes", {
22953
23220
  enumerable: true,
22954
- get: function () { return chunk6OA77UM7_cjs.adminSettingsRoutes; }
23221
+ get: function () { return chunkS2QN4LFD_cjs.adminSettingsRoutes; }
22955
23222
  });
22956
23223
  Object.defineProperty(exports, "adminUsersRoutes", {
22957
23224
  enumerable: true,
22958
- get: function () { return chunk6OA77UM7_cjs.userRoutes; }
23225
+ get: function () { return chunkS2QN4LFD_cjs.userRoutes; }
22959
23226
  });
22960
23227
  Object.defineProperty(exports, "apiContentCrudRoutes", {
22961
23228
  enumerable: true,
22962
- get: function () { return chunk6OA77UM7_cjs.api_content_crud_default; }
23229
+ get: function () { return chunkS2QN4LFD_cjs.api_content_crud_default; }
22963
23230
  });
22964
23231
  Object.defineProperty(exports, "apiMediaRoutes", {
22965
23232
  enumerable: true,
22966
- get: function () { return chunk6OA77UM7_cjs.api_media_default; }
23233
+ get: function () { return chunkS2QN4LFD_cjs.api_media_default; }
22967
23234
  });
22968
23235
  Object.defineProperty(exports, "apiRoutes", {
22969
23236
  enumerable: true,
22970
- get: function () { return chunk6OA77UM7_cjs.api_default; }
23237
+ get: function () { return chunkS2QN4LFD_cjs.api_default; }
22971
23238
  });
22972
23239
  Object.defineProperty(exports, "apiSystemRoutes", {
22973
23240
  enumerable: true,
22974
- get: function () { return chunk6OA77UM7_cjs.api_system_default; }
23241
+ get: function () { return chunkS2QN4LFD_cjs.api_system_default; }
22975
23242
  });
22976
23243
  Object.defineProperty(exports, "authRoutes", {
22977
23244
  enumerable: true,
22978
- get: function () { return chunk6OA77UM7_cjs.auth_default; }
23245
+ get: function () { return chunkS2QN4LFD_cjs.auth_default; }
22979
23246
  });
22980
23247
  Object.defineProperty(exports, "createUserProfilesPlugin", {
22981
23248
  enumerable: true,
22982
- get: function () { return chunk6OA77UM7_cjs.createUserProfilesPlugin; }
23249
+ get: function () { return chunkS2QN4LFD_cjs.createUserProfilesPlugin; }
22983
23250
  });
22984
23251
  Object.defineProperty(exports, "defineUserProfile", {
22985
23252
  enumerable: true,
22986
- get: function () { return chunk6OA77UM7_cjs.defineUserProfile; }
23253
+ get: function () { return chunkS2QN4LFD_cjs.defineUserProfile; }
22987
23254
  });
22988
23255
  Object.defineProperty(exports, "getUserProfileConfig", {
22989
23256
  enumerable: true,
22990
- get: function () { return chunk6OA77UM7_cjs.getUserProfileConfig; }
23257
+ get: function () { return chunkS2QN4LFD_cjs.getUserProfileConfig; }
22991
23258
  });
22992
23259
  Object.defineProperty(exports, "userProfilesPlugin", {
22993
23260
  enumerable: true,
22994
- get: function () { return chunk6OA77UM7_cjs.userProfilesPlugin; }
23261
+ get: function () { return chunkS2QN4LFD_cjs.userProfilesPlugin; }
22995
23262
  });
22996
23263
  Object.defineProperty(exports, "Logger", {
22997
23264
  enumerable: true,
22998
- get: function () { return chunk36Z3AKX3_cjs.Logger; }
23265
+ get: function () { return chunkC5LDQ3SH_cjs.Logger; }
22999
23266
  });
23000
23267
  Object.defineProperty(exports, "getLogger", {
23001
23268
  enumerable: true,
23002
- get: function () { return chunk36Z3AKX3_cjs.getLogger; }
23269
+ get: function () { return chunkC5LDQ3SH_cjs.getLogger; }
23003
23270
  });
23004
23271
  Object.defineProperty(exports, "initLogger", {
23005
23272
  enumerable: true,
23006
- get: function () { return chunk36Z3AKX3_cjs.initLogger; }
23273
+ get: function () { return chunkC5LDQ3SH_cjs.initLogger; }
23007
23274
  });
23008
23275
  Object.defineProperty(exports, "apiTokens", {
23009
23276
  enumerable: true,
@@ -23147,127 +23414,127 @@ Object.defineProperty(exports, "workflowHistory", {
23147
23414
  });
23148
23415
  Object.defineProperty(exports, "AuthManager", {
23149
23416
  enumerable: true,
23150
- get: function () { return chunkE7E3NL3Y_cjs.AuthManager; }
23417
+ get: function () { return chunkBRKXMRMB_cjs.AuthManager; }
23151
23418
  });
23152
23419
  Object.defineProperty(exports, "PermissionManager", {
23153
23420
  enumerable: true,
23154
- get: function () { return chunkE7E3NL3Y_cjs.PermissionManager; }
23421
+ get: function () { return chunkBRKXMRMB_cjs.PermissionManager; }
23155
23422
  });
23156
23423
  Object.defineProperty(exports, "bootstrapDocumentTypes", {
23157
23424
  enumerable: true,
23158
- get: function () { return chunkE7E3NL3Y_cjs.bootstrapDocumentTypes; }
23425
+ get: function () { return chunkBRKXMRMB_cjs.bootstrapDocumentTypes; }
23159
23426
  });
23160
23427
  Object.defineProperty(exports, "bootstrapMiddleware", {
23161
23428
  enumerable: true,
23162
- get: function () { return chunkE7E3NL3Y_cjs.bootstrapMiddleware; }
23429
+ get: function () { return chunkBRKXMRMB_cjs.bootstrapMiddleware; }
23163
23430
  });
23164
23431
  Object.defineProperty(exports, "cacheHeaders", {
23165
23432
  enumerable: true,
23166
- get: function () { return chunkE7E3NL3Y_cjs.cacheHeaders; }
23433
+ get: function () { return chunkBRKXMRMB_cjs.cacheHeaders; }
23167
23434
  });
23168
23435
  Object.defineProperty(exports, "compressionMiddleware", {
23169
23436
  enumerable: true,
23170
- get: function () { return chunkE7E3NL3Y_cjs.compressionMiddleware; }
23437
+ get: function () { return chunkBRKXMRMB_cjs.compressionMiddleware; }
23171
23438
  });
23172
23439
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
23173
23440
  enumerable: true,
23174
- get: function () { return chunkE7E3NL3Y_cjs.detailedLoggingMiddleware; }
23175
- });
23176
- Object.defineProperty(exports, "getActivePlugins", {
23177
- enumerable: true,
23178
- get: function () { return chunkE7E3NL3Y_cjs.getActivePlugins; }
23179
- });
23180
- Object.defineProperty(exports, "isPluginActive", {
23181
- enumerable: true,
23182
- get: function () { return chunkE7E3NL3Y_cjs.isPluginActive; }
23441
+ get: function () { return chunkBRKXMRMB_cjs.detailedLoggingMiddleware; }
23183
23442
  });
23184
23443
  Object.defineProperty(exports, "logActivity", {
23185
23444
  enumerable: true,
23186
- get: function () { return chunkE7E3NL3Y_cjs.logActivity; }
23445
+ get: function () { return chunkBRKXMRMB_cjs.logActivity; }
23187
23446
  });
23188
23447
  Object.defineProperty(exports, "loggingMiddleware", {
23189
23448
  enumerable: true,
23190
- get: function () { return chunkE7E3NL3Y_cjs.loggingMiddleware; }
23449
+ get: function () { return chunkBRKXMRMB_cjs.loggingMiddleware; }
23191
23450
  });
23192
23451
  Object.defineProperty(exports, "optionalAuth", {
23193
23452
  enumerable: true,
23194
- get: function () { return chunkE7E3NL3Y_cjs.optionalAuth; }
23453
+ get: function () { return chunkBRKXMRMB_cjs.optionalAuth; }
23195
23454
  });
23196
23455
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
23197
23456
  enumerable: true,
23198
- get: function () { return chunkE7E3NL3Y_cjs.performanceLoggingMiddleware; }
23199
- });
23200
- Object.defineProperty(exports, "requireActivePlugin", {
23201
- enumerable: true,
23202
- get: function () { return chunkE7E3NL3Y_cjs.requireActivePlugin; }
23203
- });
23204
- Object.defineProperty(exports, "requireActivePlugins", {
23205
- enumerable: true,
23206
- get: function () { return chunkE7E3NL3Y_cjs.requireActivePlugins; }
23457
+ get: function () { return chunkBRKXMRMB_cjs.performanceLoggingMiddleware; }
23207
23458
  });
23208
23459
  Object.defineProperty(exports, "requireAnyPermission", {
23209
23460
  enumerable: true,
23210
- get: function () { return chunkE7E3NL3Y_cjs.requireAnyPermission; }
23461
+ get: function () { return chunkBRKXMRMB_cjs.requireAnyPermission; }
23211
23462
  });
23212
23463
  Object.defineProperty(exports, "requireAuth", {
23213
23464
  enumerable: true,
23214
- get: function () { return chunkE7E3NL3Y_cjs.requireAuth; }
23465
+ get: function () { return chunkBRKXMRMB_cjs.requireAuth; }
23215
23466
  });
23216
23467
  Object.defineProperty(exports, "requirePermission", {
23217
23468
  enumerable: true,
23218
- get: function () { return chunkE7E3NL3Y_cjs.requirePermission; }
23469
+ get: function () { return chunkBRKXMRMB_cjs.requirePermission; }
23219
23470
  });
23220
23471
  Object.defineProperty(exports, "requireRole", {
23221
23472
  enumerable: true,
23222
- get: function () { return chunkE7E3NL3Y_cjs.requireRole; }
23473
+ get: function () { return chunkBRKXMRMB_cjs.requireRole; }
23223
23474
  });
23224
23475
  Object.defineProperty(exports, "securityHeaders", {
23225
23476
  enumerable: true,
23226
- get: function () { return chunkE7E3NL3Y_cjs.securityHeadersMiddleware; }
23477
+ get: function () { return chunkBRKXMRMB_cjs.securityHeadersMiddleware; }
23227
23478
  });
23228
23479
  Object.defineProperty(exports, "securityLoggingMiddleware", {
23229
23480
  enumerable: true,
23230
- get: function () { return chunkE7E3NL3Y_cjs.securityLoggingMiddleware; }
23481
+ get: function () { return chunkBRKXMRMB_cjs.securityLoggingMiddleware; }
23231
23482
  });
23232
23483
  Object.defineProperty(exports, "DocumentsService", {
23233
23484
  enumerable: true,
23234
- get: function () { return chunkJCBDXEY2_cjs.DocumentsService; }
23485
+ get: function () { return chunkOLEOKHDX_cjs.DocumentsService; }
23235
23486
  });
23236
23487
  Object.defineProperty(exports, "RbacService", {
23237
23488
  enumerable: true,
23238
- get: function () { return chunkJCBDXEY2_cjs.RbacService; }
23489
+ get: function () { return chunkOLEOKHDX_cjs.RbacService; }
23239
23490
  });
23240
23491
  Object.defineProperty(exports, "PluginBootstrapService", {
23241
23492
  enumerable: true,
23242
- get: function () { return chunkYAURVGUK_cjs.PluginBootstrapService; }
23493
+ get: function () { return chunk4DHPR7KR_cjs.PluginBootstrapService; }
23243
23494
  });
23244
23495
  Object.defineProperty(exports, "PluginServiceClass", {
23245
23496
  enumerable: true,
23246
- get: function () { return chunkYAURVGUK_cjs.PluginService; }
23497
+ get: function () { return chunk4DHPR7KR_cjs.PluginService; }
23498
+ });
23499
+ Object.defineProperty(exports, "getActivePlugins", {
23500
+ enumerable: true,
23501
+ get: function () { return chunk4DHPR7KR_cjs.getActivePlugins; }
23247
23502
  });
23248
23503
  Object.defineProperty(exports, "getAvailableCollectionNames", {
23249
23504
  enumerable: true,
23250
- get: function () { return chunkYAURVGUK_cjs.getAvailableCollectionNames; }
23505
+ get: function () { return chunk4DHPR7KR_cjs.getAvailableCollectionNames; }
23506
+ });
23507
+ Object.defineProperty(exports, "isPluginActive", {
23508
+ enumerable: true,
23509
+ get: function () { return chunk4DHPR7KR_cjs.isPluginActive; }
23251
23510
  });
23252
23511
  Object.defineProperty(exports, "loadCollectionConfig", {
23253
23512
  enumerable: true,
23254
- get: function () { return chunkYAURVGUK_cjs.loadCollectionConfig; }
23513
+ get: function () { return chunk4DHPR7KR_cjs.loadCollectionConfig; }
23255
23514
  });
23256
23515
  Object.defineProperty(exports, "loadCollectionConfigs", {
23257
23516
  enumerable: true,
23258
- get: function () { return chunkYAURVGUK_cjs.loadCollectionConfigs; }
23517
+ get: function () { return chunk4DHPR7KR_cjs.loadCollectionConfigs; }
23259
23518
  });
23260
23519
  Object.defineProperty(exports, "registerCollections", {
23261
23520
  enumerable: true,
23262
- get: function () { return chunkYAURVGUK_cjs.registerCollections; }
23521
+ get: function () { return chunk4DHPR7KR_cjs.registerCollections; }
23522
+ });
23523
+ Object.defineProperty(exports, "requireActivePlugin", {
23524
+ enumerable: true,
23525
+ get: function () { return chunk4DHPR7KR_cjs.requireActivePlugin; }
23526
+ });
23527
+ Object.defineProperty(exports, "requireActivePlugins", {
23528
+ enumerable: true,
23529
+ get: function () { return chunk4DHPR7KR_cjs.requireActivePlugins; }
23263
23530
  });
23264
23531
  Object.defineProperty(exports, "validateCollectionConfig", {
23265
23532
  enumerable: true,
23266
- get: function () { return chunkYAURVGUK_cjs.validateCollectionConfig; }
23533
+ get: function () { return chunk4DHPR7KR_cjs.validateCollectionConfig; }
23267
23534
  });
23268
23535
  Object.defineProperty(exports, "MigrationService", {
23269
23536
  enumerable: true,
23270
- get: function () { return chunkMOGK3U4A_cjs.MigrationService; }
23537
+ get: function () { return chunkPAS7GZBS_cjs.MigrationService; }
23271
23538
  });
23272
23539
  Object.defineProperty(exports, "renderFilterBar", {
23273
23540
  enumerable: true,
@@ -23307,99 +23574,99 @@ Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
23307
23574
  });
23308
23575
  Object.defineProperty(exports, "HookSystemImpl", {
23309
23576
  enumerable: true,
23310
- get: function () { return chunkI7MIRRFJ_cjs.HookSystemImpl; }
23577
+ get: function () { return chunkA22RBHO7_cjs.HookSystemImpl; }
23311
23578
  });
23312
23579
  Object.defineProperty(exports, "HookUtils", {
23313
23580
  enumerable: true,
23314
- get: function () { return chunkI7MIRRFJ_cjs.HookUtils; }
23581
+ get: function () { return chunkA22RBHO7_cjs.HookUtils; }
23315
23582
  });
23316
23583
  Object.defineProperty(exports, "PluginDependencyCycleError", {
23317
23584
  enumerable: true,
23318
- get: function () { return chunkI7MIRRFJ_cjs.PluginDependencyCycleError; }
23585
+ get: function () { return chunkA22RBHO7_cjs.PluginDependencyCycleError; }
23319
23586
  });
23320
23587
  Object.defineProperty(exports, "PluginManagerClass", {
23321
23588
  enumerable: true,
23322
- get: function () { return chunkI7MIRRFJ_cjs.PluginManager; }
23589
+ get: function () { return chunkA22RBHO7_cjs.PluginManager; }
23323
23590
  });
23324
23591
  Object.defineProperty(exports, "PluginRegistryImpl", {
23325
23592
  enumerable: true,
23326
- get: function () { return chunkI7MIRRFJ_cjs.PluginRegistryImpl; }
23593
+ get: function () { return chunkA22RBHO7_cjs.PluginRegistryImpl; }
23327
23594
  });
23328
23595
  Object.defineProperty(exports, "PluginValidatorClass", {
23329
23596
  enumerable: true,
23330
- get: function () { return chunkI7MIRRFJ_cjs.PluginValidator; }
23597
+ get: function () { return chunkA22RBHO7_cjs.PluginValidator; }
23331
23598
  });
23332
23599
  Object.defineProperty(exports, "RegisterPluginsError", {
23333
23600
  enumerable: true,
23334
- get: function () { return chunkI7MIRRFJ_cjs.RegisterPluginsError; }
23601
+ get: function () { return chunkA22RBHO7_cjs.RegisterPluginsError; }
23335
23602
  });
23336
23603
  Object.defineProperty(exports, "ScopedHookSystemClass", {
23337
23604
  enumerable: true,
23338
- get: function () { return chunkI7MIRRFJ_cjs.ScopedHookSystem; }
23605
+ get: function () { return chunkA22RBHO7_cjs.ScopedHookSystem; }
23339
23606
  });
23340
23607
  Object.defineProperty(exports, "collectCronSchedules", {
23341
23608
  enumerable: true,
23342
- get: function () { return chunkI7MIRRFJ_cjs.collectCronSchedules; }
23609
+ get: function () { return chunkA22RBHO7_cjs.collectCronSchedules; }
23343
23610
  });
23344
23611
  Object.defineProperty(exports, "collectCrons", {
23345
23612
  enumerable: true,
23346
- get: function () { return chunkI7MIRRFJ_cjs.collectCrons; }
23613
+ get: function () { return chunkA22RBHO7_cjs.collectCrons; }
23347
23614
  });
23348
23615
  Object.defineProperty(exports, "createScheduledHandler", {
23349
23616
  enumerable: true,
23350
- get: function () { return chunkI7MIRRFJ_cjs.createScheduledHandler; }
23617
+ get: function () { return chunkA22RBHO7_cjs.createScheduledHandler; }
23351
23618
  });
23352
23619
  Object.defineProperty(exports, "dispatchCronTick", {
23353
23620
  enumerable: true,
23354
- get: function () { return chunkI7MIRRFJ_cjs.dispatchCronTick; }
23621
+ get: function () { return chunkA22RBHO7_cjs.dispatchCronTick; }
23355
23622
  });
23356
23623
  Object.defineProperty(exports, "registerPlugins", {
23357
23624
  enumerable: true,
23358
- get: function () { return chunkI7MIRRFJ_cjs.registerPlugins; }
23625
+ get: function () { return chunkA22RBHO7_cjs.registerPlugins; }
23359
23626
  });
23360
23627
  Object.defineProperty(exports, "topoSort", {
23361
23628
  enumerable: true,
23362
- get: function () { return chunkI7MIRRFJ_cjs.topoSort; }
23629
+ get: function () { return chunkA22RBHO7_cjs.topoSort; }
23363
23630
  });
23364
23631
  Object.defineProperty(exports, "applySchemaDefaults", {
23365
23632
  enumerable: true,
23366
- get: function () { return chunkD6FWEYQE_cjs.applySchemaDefaults; }
23633
+ get: function () { return chunkKWQNB6UM_cjs.applySchemaDefaults; }
23367
23634
  });
23368
23635
  Object.defineProperty(exports, "definePlugin", {
23369
23636
  enumerable: true,
23370
- get: function () { return chunkD6FWEYQE_cjs.definePlugin; }
23637
+ get: function () { return chunkKWQNB6UM_cjs.definePlugin; }
23371
23638
  });
23372
23639
  Object.defineProperty(exports, "getPluginMenu", {
23373
23640
  enumerable: true,
23374
- get: function () { return chunkD6FWEYQE_cjs.getPluginMenu; }
23641
+ get: function () { return chunkKWQNB6UM_cjs.getPluginMenu; }
23375
23642
  });
23376
23643
  Object.defineProperty(exports, "isDefinedPlugin", {
23377
23644
  enumerable: true,
23378
- get: function () { return chunkD6FWEYQE_cjs.isDefinedPlugin; }
23645
+ get: function () { return chunkKWQNB6UM_cjs.isDefinedPlugin; }
23379
23646
  });
23380
23647
  Object.defineProperty(exports, "parseConfigSchema", {
23381
23648
  enumerable: true,
23382
- get: function () { return chunkD6FWEYQE_cjs.parseConfigSchema; }
23649
+ get: function () { return chunkKWQNB6UM_cjs.parseConfigSchema; }
23383
23650
  });
23384
23651
  Object.defineProperty(exports, "parseFormDataToSettings", {
23385
23652
  enumerable: true,
23386
- get: function () { return chunkD6FWEYQE_cjs.parseFormDataToSettings; }
23653
+ get: function () { return chunkKWQNB6UM_cjs.parseFormDataToSettings; }
23387
23654
  });
23388
23655
  Object.defineProperty(exports, "renderSchemaFields", {
23389
23656
  enumerable: true,
23390
- get: function () { return chunkD6FWEYQE_cjs.renderSchemaFields; }
23657
+ get: function () { return chunkKWQNB6UM_cjs.renderSchemaFields; }
23391
23658
  });
23392
23659
  Object.defineProperty(exports, "resetPluginMenu", {
23393
23660
  enumerable: true,
23394
- get: function () { return chunkD6FWEYQE_cjs.resetPluginMenu; }
23661
+ get: function () { return chunkKWQNB6UM_cjs.resetPluginMenu; }
23395
23662
  });
23396
23663
  Object.defineProperty(exports, "resolvePluginMenuItems", {
23397
23664
  enumerable: true,
23398
- get: function () { return chunkD6FWEYQE_cjs.resolvePluginMenuItems; }
23665
+ get: function () { return chunkKWQNB6UM_cjs.resolvePluginMenuItems; }
23399
23666
  });
23400
23667
  Object.defineProperty(exports, "setPluginMenu", {
23401
23668
  enumerable: true,
23402
- get: function () { return chunkD6FWEYQE_cjs.setPluginMenu; }
23669
+ get: function () { return chunkKWQNB6UM_cjs.setPluginMenu; }
23403
23670
  });
23404
23671
  Object.defineProperty(exports, "getHookSystem", {
23405
23672
  enumerable: true,
@@ -23423,23 +23690,23 @@ Object.defineProperty(exports, "setHookSystem", {
23423
23690
  });
23424
23691
  Object.defineProperty(exports, "QueryFilterBuilder", {
23425
23692
  enumerable: true,
23426
- get: function () { return chunkDLTT7QZU_cjs.QueryFilterBuilder; }
23693
+ get: function () { return chunkSFGYZUWU_cjs.QueryFilterBuilder; }
23427
23694
  });
23428
23695
  Object.defineProperty(exports, "TemplateRenderer", {
23429
23696
  enumerable: true,
23430
- get: function () { return chunkDLTT7QZU_cjs.TemplateRenderer; }
23697
+ get: function () { return chunkSFGYZUWU_cjs.TemplateRenderer; }
23431
23698
  });
23432
23699
  Object.defineProperty(exports, "buildQuery", {
23433
23700
  enumerable: true,
23434
- get: function () { return chunkDLTT7QZU_cjs.buildQuery; }
23701
+ get: function () { return chunkSFGYZUWU_cjs.buildQuery; }
23435
23702
  });
23436
23703
  Object.defineProperty(exports, "renderTemplate", {
23437
23704
  enumerable: true,
23438
- get: function () { return chunkDLTT7QZU_cjs.renderTemplate; }
23705
+ get: function () { return chunkSFGYZUWU_cjs.renderTemplate; }
23439
23706
  });
23440
23707
  Object.defineProperty(exports, "templateRenderer", {
23441
23708
  enumerable: true,
23442
- get: function () { return chunkDLTT7QZU_cjs.templateRenderer; }
23709
+ get: function () { return chunkSFGYZUWU_cjs.templateRenderer; }
23443
23710
  });
23444
23711
  Object.defineProperty(exports, "metricsTracker", {
23445
23712
  enumerable: true,
@@ -23447,11 +23714,11 @@ Object.defineProperty(exports, "metricsTracker", {
23447
23714
  });
23448
23715
  Object.defineProperty(exports, "SONICJS_VERSION", {
23449
23716
  enumerable: true,
23450
- get: function () { return chunkBJ6NJL2E_cjs.SONICJS_VERSION; }
23717
+ get: function () { return chunkXZUEGFXE_cjs.SONICJS_VERSION; }
23451
23718
  });
23452
23719
  Object.defineProperty(exports, "getCoreVersion", {
23453
23720
  enumerable: true,
23454
- get: function () { return chunkBJ6NJL2E_cjs.getCoreVersion; }
23721
+ get: function () { return chunkXZUEGFXE_cjs.getCoreVersion; }
23455
23722
  });
23456
23723
  Object.defineProperty(exports, "escapeHtml", {
23457
23724
  enumerable: true,
@@ -23479,6 +23746,7 @@ exports.createMcpPlugin = createMcpPlugin;
23479
23746
  exports.createOAuthProvidersPlugin = createOAuthProvidersPlugin;
23480
23747
  exports.createRedirectPlugin = createRedirectPlugin;
23481
23748
  exports.createSonicJSApp = createSonicJSApp;
23749
+ exports.demoLoginPlugin = demoLoginPlugin;
23482
23750
  exports.emailReconciliationPlugin = emailReconciliationPlugin;
23483
23751
  exports.generateTriggersComment = generateTriggersComment;
23484
23752
  exports.helloWorldPlugin = helloWorldPlugin;