@sonicjs-cms/core 2.15.0 → 2.16.1

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 (55) hide show
  1. package/dist/{app-COElO4Rm.d.cts → app-D9L3mrC-.d.cts} +1 -0
  2. package/dist/{app-COElO4Rm.d.ts → app-D9L3mrC-.d.ts} +1 -0
  3. package/dist/{chunk-UFPT5KCQ.cjs → chunk-7HHIZQNE.cjs} +19 -9
  4. package/dist/chunk-7HHIZQNE.cjs.map +1 -0
  5. package/dist/{chunk-7MMD5WMK.js → chunk-BAMJVG33.js} +9 -9
  6. package/dist/{chunk-7MMD5WMK.js.map → chunk-BAMJVG33.js.map} +1 -1
  7. package/dist/{chunk-RVD7PLMU.cjs → chunk-HU4MN74Q.cjs} +55 -5
  8. package/dist/chunk-HU4MN74Q.cjs.map +1 -0
  9. package/dist/{chunk-EWXV2KG2.js → chunk-JF5RQXPN.js} +3 -3
  10. package/dist/{chunk-EWXV2KG2.js.map → chunk-JF5RQXPN.js.map} +1 -1
  11. package/dist/{chunk-2BL2A62D.js → chunk-KYAF33AF.js} +15 -5
  12. package/dist/chunk-KYAF33AF.js.map +1 -0
  13. package/dist/{chunk-26HYU7MX.cjs → chunk-MZS33LLH.cjs} +114 -114
  14. package/dist/{chunk-26HYU7MX.cjs.map → chunk-MZS33LLH.cjs.map} +1 -1
  15. package/dist/{chunk-5SOFMH66.js → chunk-PUZMLXOJ.js} +55 -5
  16. package/dist/chunk-PUZMLXOJ.js.map +1 -0
  17. package/dist/{chunk-43AB4EH4.cjs → chunk-U6FOL6EO.cjs} +2 -2
  18. package/dist/{chunk-43AB4EH4.cjs.map → chunk-U6FOL6EO.cjs.map} +1 -1
  19. package/dist/{chunk-VUISYUHY.cjs → chunk-V76ERLX6.cjs} +3 -3
  20. package/dist/{chunk-VUISYUHY.cjs.map → chunk-V76ERLX6.cjs.map} +1 -1
  21. package/dist/{chunk-G7XSN72O.js → chunk-W33MHOPA.js} +2 -2
  22. package/dist/{chunk-G7XSN72O.js.map → chunk-W33MHOPA.js.map} +1 -1
  23. package/dist/index.cjs +829 -135
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +707 -13
  28. package/dist/index.js.map +1 -1
  29. package/dist/middleware.cjs +29 -29
  30. package/dist/middleware.d.cts +1 -1
  31. package/dist/middleware.d.ts +1 -1
  32. package/dist/middleware.js +3 -3
  33. package/dist/migrations-MYQI2KAJ.cjs +13 -0
  34. package/dist/{migrations-APFGYCB6.cjs.map → migrations-MYQI2KAJ.cjs.map} +1 -1
  35. package/dist/migrations-WCEBO5QQ.js +4 -0
  36. package/dist/{migrations-YB52SLW7.js.map → migrations-WCEBO5QQ.js.map} +1 -1
  37. package/dist/routes.cjs +28 -28
  38. package/dist/routes.d.cts +1 -1
  39. package/dist/routes.d.ts +1 -1
  40. package/dist/routes.js +5 -5
  41. package/dist/services.cjs +23 -23
  42. package/dist/services.d.cts +1 -1
  43. package/dist/services.d.ts +1 -1
  44. package/dist/services.js +2 -2
  45. package/dist/utils.cjs +11 -11
  46. package/dist/utils.js +1 -1
  47. package/migrations/035_user_profiles_data_column.sql +14 -15
  48. package/migrations/036_analytics_events.sql +22 -0
  49. package/package.json +1 -1
  50. package/dist/chunk-2BL2A62D.js.map +0 -1
  51. package/dist/chunk-5SOFMH66.js.map +0 -1
  52. package/dist/chunk-RVD7PLMU.cjs.map +0 -1
  53. package/dist/chunk-UFPT5KCQ.cjs.map +0 -1
  54. package/dist/migrations-APFGYCB6.cjs +0 -13
  55. package/dist/migrations-YB52SLW7.js +0 -4
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunk26HYU7MX_cjs = require('./chunk-26HYU7MX.cjs');
3
+ var chunkMZS33LLH_cjs = require('./chunk-MZS33LLH.cjs');
4
4
  var chunkNZWFCUDA_cjs = require('./chunk-NZWFCUDA.cjs');
5
- var chunkUFPT5KCQ_cjs = require('./chunk-UFPT5KCQ.cjs');
6
- var chunk43AB4EH4_cjs = require('./chunk-43AB4EH4.cjs');
7
- var chunkRVD7PLMU_cjs = require('./chunk-RVD7PLMU.cjs');
5
+ var chunk7HHIZQNE_cjs = require('./chunk-7HHIZQNE.cjs');
6
+ var chunkU6FOL6EO_cjs = require('./chunk-U6FOL6EO.cjs');
7
+ var chunkHU4MN74Q_cjs = require('./chunk-HU4MN74Q.cjs');
8
8
  var chunk4ZSNJDLS_cjs = require('./chunk-4ZSNJDLS.cjs');
9
9
  var chunkOHYBNCVL_cjs = require('./chunk-OHYBNCVL.cjs');
10
10
  var chunkUYJ6TJHX_cjs = require('./chunk-UYJ6TJHX.cjs');
11
11
  var chunkABB34XUS_cjs = require('./chunk-ABB34XUS.cjs');
12
12
  var chunk635JAMSE_cjs = require('./chunk-635JAMSE.cjs');
13
- var chunkVUISYUHY_cjs = require('./chunk-VUISYUHY.cjs');
13
+ var chunkV76ERLX6_cjs = require('./chunk-V76ERLX6.cjs');
14
14
  require('./chunk-P3XDZL6Q.cjs');
15
15
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
16
16
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
@@ -560,7 +560,7 @@ function formatCellValue(value) {
560
560
  // src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
561
561
  function createDatabaseToolsAdminRoutes() {
562
562
  const router3 = new hono.Hono();
563
- router3.use("*", chunkUFPT5KCQ_cjs.requireAuth());
563
+ router3.use("*", chunk7HHIZQNE_cjs.requireAuth());
564
564
  router3.get("/api/stats", async (c) => {
565
565
  try {
566
566
  const user = c.get("user");
@@ -1939,7 +1939,7 @@ function createOTPLoginPlugin() {
1939
1939
  error: "Account is deactivated"
1940
1940
  }, 403);
1941
1941
  }
1942
- const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
1942
+ const token = await chunk7HHIZQNE_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
1943
1943
  cookie.setCookie(c, "auth_token", token, {
1944
1944
  httpOnly: true,
1945
1945
  secure: true,
@@ -2409,13 +2409,13 @@ function createOAuthProvidersPlugin() {
2409
2409
  if (!user || !user.is_active) {
2410
2410
  return c.redirect("/auth/login?error=Account is deactivated");
2411
2411
  }
2412
- const jwt2 = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
2412
+ const jwt2 = await chunk7HHIZQNE_cjs.AuthManager.generateToken(
2413
2413
  user.id,
2414
2414
  user.email,
2415
2415
  user.role,
2416
2416
  c.env.JWT_SECRET
2417
2417
  );
2418
- chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
2418
+ chunk7HHIZQNE_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
2419
2419
  return c.redirect("/admin");
2420
2420
  }
2421
2421
  const existingUser = await oauthService.findUserByEmail(profile.email);
@@ -2432,13 +2432,13 @@ function createOAuthProvidersPlugin() {
2432
2432
  tokenExpiresAt: tokenExpiresAt ?? void 0,
2433
2433
  profileData: JSON.stringify(profile)
2434
2434
  });
2435
- const jwt2 = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
2435
+ const jwt2 = await chunk7HHIZQNE_cjs.AuthManager.generateToken(
2436
2436
  existingUser.id,
2437
2437
  existingUser.email,
2438
2438
  existingUser.role,
2439
2439
  c.env.JWT_SECRET
2440
2440
  );
2441
- chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
2441
+ chunk7HHIZQNE_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
2442
2442
  return c.redirect("/admin");
2443
2443
  }
2444
2444
  const newUserId = await oauthService.createUserFromOAuth(profile);
@@ -2451,13 +2451,13 @@ function createOAuthProvidersPlugin() {
2451
2451
  tokenExpiresAt: tokenExpiresAt ?? void 0,
2452
2452
  profileData: JSON.stringify(profile)
2453
2453
  });
2454
- const jwt = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
2454
+ const jwt = await chunk7HHIZQNE_cjs.AuthManager.generateToken(
2455
2455
  newUserId,
2456
2456
  profile.email.toLowerCase(),
2457
2457
  "viewer",
2458
2458
  c.env.JWT_SECRET
2459
2459
  );
2460
- chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax" });
2460
+ chunk7HHIZQNE_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax" });
2461
2461
  return c.redirect("/admin");
2462
2462
  } catch (error) {
2463
2463
  console.error("OAuth callback error:", error);
@@ -4150,7 +4150,7 @@ function renderSettingsPage(data) {
4150
4150
 
4151
4151
  // src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
4152
4152
  var adminRoutes = new hono.Hono();
4153
- adminRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
4153
+ adminRoutes.use("*", chunk7HHIZQNE_cjs.requireAuth());
4154
4154
  adminRoutes.get("/", async (c) => {
4155
4155
  try {
4156
4156
  const user = c.get("user");
@@ -4551,13 +4551,13 @@ function createMagicLinkAuthPlugin() {
4551
4551
  SET used = 1, used_at = ?
4552
4552
  WHERE id = ?
4553
4553
  `).bind(Date.now(), magicLink.id).run();
4554
- const jwtToken = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
4554
+ const jwtToken = await chunk7HHIZQNE_cjs.AuthManager.generateToken(
4555
4555
  user.id,
4556
4556
  user.email,
4557
4557
  user.role,
4558
4558
  c.env.JWT_SECRET
4559
4559
  );
4560
- chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwtToken);
4560
+ chunk7HHIZQNE_cjs.AuthManager.setAuthCookie(c, jwtToken);
4561
4561
  await db.prepare(`
4562
4562
  UPDATE users SET last_login_at = ? WHERE id = ?
4563
4563
  `).bind(Date.now(), user.id).run();
@@ -5567,7 +5567,7 @@ function renderSecuritySettingsPage(data) {
5567
5567
 
5568
5568
  // src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
5569
5569
  var adminRoutes2 = new hono.Hono();
5570
- adminRoutes2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
5570
+ adminRoutes2.use("*", chunk7HHIZQNE_cjs.requireAuth());
5571
5571
  adminRoutes2.use("*", async (c, next) => {
5572
5572
  const user = c.get("user");
5573
5573
  if (user?.role !== "admin") {
@@ -5577,7 +5577,7 @@ adminRoutes2.use("*", async (c, next) => {
5577
5577
  });
5578
5578
  async function getSettings(db) {
5579
5579
  try {
5580
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
5580
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
5581
5581
  const plugin2 = await pluginService.getPlugin("security-audit");
5582
5582
  if (plugin2?.settings) {
5583
5583
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -5682,7 +5682,7 @@ adminRoutes2.post("/settings", async (c) => {
5682
5682
  autoPurge: body["retention.autoPurge"] === "true"
5683
5683
  }
5684
5684
  };
5685
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
5685
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
5686
5686
  await pluginService.updatePluginSettings("security-audit", settings);
5687
5687
  if (c.req.header("HX-Request")) {
5688
5688
  return c.json({ success: true });
@@ -5700,7 +5700,7 @@ var BruteForceDetector = class {
5700
5700
  }
5701
5701
  settings;
5702
5702
  async recordFailedAttempt(ip, email) {
5703
- if (!this.settings.enabled) {
5703
+ if (!this.settings.enabled || !this.kv) {
5704
5704
  return { ipCount: 0, emailCount: 0, shouldLockIP: false, shouldLockEmail: false, isSuspicious: false };
5705
5705
  }
5706
5706
  const windowMs = this.settings.windowMinutes * 60 * 1e3;
@@ -5717,7 +5717,7 @@ var BruteForceDetector = class {
5717
5717
  return { ipCount, emailCount, shouldLockIP, shouldLockEmail, isSuspicious };
5718
5718
  }
5719
5719
  async isLocked(ip, email) {
5720
- if (!this.settings.enabled) {
5720
+ if (!this.settings.enabled || !this.kv) {
5721
5721
  return { locked: false };
5722
5722
  }
5723
5723
  const ipLocked = await this.kv.get(`${LOCK_PREFIX}ip:${ip}`);
@@ -5731,6 +5731,7 @@ var BruteForceDetector = class {
5731
5731
  return { locked: false };
5732
5732
  }
5733
5733
  async lockIP(ip) {
5734
+ if (!this.kv) return;
5734
5735
  const ttl = this.settings.lockoutDurationMinutes * 60;
5735
5736
  await this.kv.put(`${LOCK_PREFIX}ip:${ip}`, JSON.stringify({
5736
5737
  lockedAt: Date.now(),
@@ -5738,6 +5739,7 @@ var BruteForceDetector = class {
5738
5739
  }), { expirationTtl: ttl });
5739
5740
  }
5740
5741
  async lockEmail(email) {
5742
+ if (!this.kv) return;
5741
5743
  const ttl = this.settings.lockoutDurationMinutes * 60;
5742
5744
  await this.kv.put(`${LOCK_PREFIX}email:${email}`, JSON.stringify({
5743
5745
  lockedAt: Date.now(),
@@ -5745,12 +5747,15 @@ var BruteForceDetector = class {
5745
5747
  }), { expirationTtl: ttl });
5746
5748
  }
5747
5749
  async unlockIP(ip) {
5750
+ if (!this.kv) return;
5748
5751
  await this.kv.delete(`${LOCK_PREFIX}ip:${ip}`);
5749
5752
  }
5750
5753
  async unlockEmail(email) {
5754
+ if (!this.kv) return;
5751
5755
  await this.kv.delete(`${LOCK_PREFIX}email:${email}`);
5752
5756
  }
5753
5757
  async getActiveLockouts() {
5758
+ if (!this.kv) return [];
5754
5759
  const ipLocks = await this.kv.list({ prefix: `${LOCK_PREFIX}ip:` });
5755
5760
  const emailLocks = await this.kv.list({ prefix: `${LOCK_PREFIX}email:` });
5756
5761
  const lockouts = [];
@@ -5781,6 +5786,7 @@ var BruteForceDetector = class {
5781
5786
  return lockouts;
5782
5787
  }
5783
5788
  async releaseLockout(key) {
5789
+ if (!this.kv) return;
5784
5790
  await this.kv.delete(key);
5785
5791
  }
5786
5792
  isAboveAlertThreshold(count) {
@@ -5837,7 +5843,7 @@ var BruteForceDetector = class {
5837
5843
 
5838
5844
  // src/plugins/core-plugins/security-audit-plugin/routes/api.ts
5839
5845
  var apiRoutes2 = new hono.Hono();
5840
- apiRoutes2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
5846
+ apiRoutes2.use("*", chunk7HHIZQNE_cjs.requireAuth());
5841
5847
  apiRoutes2.use("*", async (c, next) => {
5842
5848
  const user = c.get("user");
5843
5849
  if (user?.role !== "admin") {
@@ -5847,7 +5853,7 @@ apiRoutes2.use("*", async (c, next) => {
5847
5853
  });
5848
5854
  async function getSettings2(db) {
5849
5855
  try {
5850
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
5856
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
5851
5857
  const plugin2 = await pluginService.getPlugin("security-audit");
5852
5858
  if (plugin2?.settings) {
5853
5859
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -5995,7 +6001,7 @@ function generateFingerprint(ip, userAgent) {
5995
6001
  }
5996
6002
  async function getPluginSettings(db) {
5997
6003
  try {
5998
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
6004
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
5999
6005
  const plugin2 = await pluginService.getPlugin("security-audit");
6000
6006
  if (plugin2?.settings) {
6001
6007
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6883,7 +6889,7 @@ function renderEventsPage(data) {
6883
6889
  <tr>
6884
6890
  <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Time</th>
6885
6891
  <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Type</th>
6886
- <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Object</th>
6892
+ <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Object / User</th>
6887
6893
  <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Status</th>
6888
6894
  <th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Event ID</th>
6889
6895
  </tr>
@@ -6942,8 +6948,20 @@ function formatTimestamp3(timestamp) {
6942
6948
  second: "2-digit"
6943
6949
  });
6944
6950
  }
6951
+ function extractUserInfo(event) {
6952
+ try {
6953
+ const data = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
6954
+ const userId = data?.metadata?.sonicjs_user_id || data?.sonicjs_user_id;
6955
+ const email = data?.customer_email || data?.customerEmail || data?.receipt_email;
6956
+ return { userId: userId || void 0, email: email || void 0 };
6957
+ } catch {
6958
+ return {};
6959
+ }
6960
+ }
6945
6961
  function renderEventRow(event) {
6946
6962
  const errorTooltip = event.error ? ` title="${event.error.replace(/"/g, "&quot;")}"` : "";
6963
+ const userInfo = extractUserInfo(event);
6964
+ const userLink = userInfo.userId ? `<a href="/admin/users/${userInfo.userId}" class="text-sm text-blue-600 dark:text-blue-400 hover:underline">${userInfo.email || userInfo.userId}</a>` : userInfo.email ? `<span class="text-sm text-zinc-500 dark:text-zinc-400">${userInfo.email}</span>` : "";
6947
6965
  return `
6948
6966
  <tr class="hover:bg-zinc-950/[0.025] dark:hover:bg-white/[0.025]"${errorTooltip}>
6949
6967
  <td class="px-6 py-4 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-400">
@@ -6955,6 +6973,7 @@ function renderEventRow(event) {
6955
6973
  <td class="px-6 py-4 whitespace-nowrap">
6956
6974
  <div class="text-sm font-mono text-zinc-500 dark:text-zinc-400">${event.objectId || "-"}</div>
6957
6975
  <div class="text-xs text-zinc-400 dark:text-zinc-500">${event.objectType}</div>
6976
+ ${userLink ? `<div class="mt-1">${userLink}</div>` : ""}
6958
6977
  </td>
6959
6978
  <td class="px-6 py-4 whitespace-nowrap">${eventStatusBadge(event.status)}</td>
6960
6979
  <td class="px-6 py-4 whitespace-nowrap text-xs font-mono text-zinc-400 dark:text-zinc-500">${event.stripeEventId}</td>
@@ -6992,7 +7011,7 @@ var DEFAULT_SETTINGS3 = {
6992
7011
 
6993
7012
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
6994
7013
  var adminRoutes3 = new hono.Hono();
6995
- adminRoutes3.use("*", chunkUFPT5KCQ_cjs.requireAuth());
7014
+ adminRoutes3.use("*", chunk7HHIZQNE_cjs.requireAuth());
6996
7015
  adminRoutes3.use("*", async (c, next) => {
6997
7016
  const user = c.get("user");
6998
7017
  if (user?.role !== "admin") {
@@ -7002,7 +7021,7 @@ adminRoutes3.use("*", async (c, next) => {
7002
7021
  });
7003
7022
  async function getSettings3(db) {
7004
7023
  try {
7005
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
7024
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
7006
7025
  const plugin2 = await pluginService.getPlugin("stripe");
7007
7026
  if (plugin2?.settings) {
7008
7027
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -7324,7 +7343,7 @@ function timingSafeEqual(a, b) {
7324
7343
  var apiRoutes3 = new hono.Hono();
7325
7344
  async function getSettings4(db) {
7326
7345
  try {
7327
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
7346
+ const pluginService = new chunkU6FOL6EO_cjs.PluginService(db);
7328
7347
  const plugin2 = await pluginService.getPlugin("stripe");
7329
7348
  if (plugin2?.settings) {
7330
7349
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -7475,7 +7494,7 @@ apiRoutes3.post("/webhook", async (c) => {
7475
7494
  }
7476
7495
  return c.json({ received: true });
7477
7496
  });
7478
- apiRoutes3.post("/create-checkout-session", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7497
+ apiRoutes3.post("/create-checkout-session", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7479
7498
  const db = c.env.DB;
7480
7499
  const user = c.get("user");
7481
7500
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -7515,7 +7534,7 @@ apiRoutes3.post("/create-checkout-session", chunkUFPT5KCQ_cjs.requireAuth(), asy
7515
7534
  });
7516
7535
  return c.json({ sessionId: session.id, url: session.url });
7517
7536
  });
7518
- apiRoutes3.get("/subscription", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7537
+ apiRoutes3.get("/subscription", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7519
7538
  const user = c.get("user");
7520
7539
  if (!user) return c.json({ error: "Unauthorized" }, 401);
7521
7540
  const db = c.env.DB;
@@ -7527,7 +7546,7 @@ apiRoutes3.get("/subscription", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7527
7546
  }
7528
7547
  return c.json({ subscription });
7529
7548
  });
7530
- apiRoutes3.get("/subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7549
+ apiRoutes3.get("/subscriptions", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7531
7550
  const user = c.get("user");
7532
7551
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7533
7552
  const db = c.env.DB;
@@ -7543,7 +7562,7 @@ apiRoutes3.get("/subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7543
7562
  const result = await subscriptionService.list(filters);
7544
7563
  return c.json(result);
7545
7564
  });
7546
- apiRoutes3.get("/stats", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7565
+ apiRoutes3.get("/stats", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7547
7566
  const user = c.get("user");
7548
7567
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7549
7568
  const db = c.env.DB;
@@ -7552,7 +7571,7 @@ apiRoutes3.get("/stats", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7552
7571
  const stats = await subscriptionService.getStats();
7553
7572
  return c.json(stats);
7554
7573
  });
7555
- apiRoutes3.post("/sync-subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7574
+ apiRoutes3.post("/sync-subscriptions", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7556
7575
  const user = c.get("user");
7557
7576
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7558
7577
  const db = c.env.DB;
@@ -7600,7 +7619,7 @@ apiRoutes3.post("/sync-subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c
7600
7619
  }, 500);
7601
7620
  }
7602
7621
  });
7603
- apiRoutes3.get("/events", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7622
+ apiRoutes3.get("/events", chunk7HHIZQNE_cjs.requireAuth(), async (c) => {
7604
7623
  const user = c.get("user");
7605
7624
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7606
7625
  const db = c.env.DB;
@@ -7666,7 +7685,7 @@ function createStripePlugin() {
7666
7685
  var stripePlugin = createStripePlugin();
7667
7686
 
7668
7687
  // src/middleware/plugin-menu.ts
7669
- var REGISTRY_MENU_PLUGINS = Object.values(chunk43AB4EH4_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
7688
+ var REGISTRY_MENU_PLUGINS = Object.values(chunkU6FOL6EO_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
7670
7689
  codeName: p.codeName,
7671
7690
  label: p.adminMenu.label,
7672
7691
  path: p.adminMenu.path,
@@ -7757,6 +7776,672 @@ function pluginMenuMiddleware() {
7757
7776
  };
7758
7777
  }
7759
7778
 
7779
+ // src/plugins/types.ts
7780
+ var HOOKS2 = {
7781
+ // Request lifecycle
7782
+ REQUEST_START: "request:start",
7783
+ REQUEST_END: "request:end",
7784
+ USER_LOGIN: "user:login"};
7785
+ chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
7786
+ var adminRoutes4 = new hono.Hono();
7787
+ adminRoutes4.use("*", chunk7HHIZQNE_cjs.requireAuth());
7788
+ adminRoutes4.use("*", async (c, next) => {
7789
+ const user = c.get("user");
7790
+ if (user?.role !== "admin") {
7791
+ return c.text("Access denied", 403);
7792
+ }
7793
+ return next();
7794
+ });
7795
+ adminRoutes4.get("/", async (c) => {
7796
+ const user = c.get("user");
7797
+ const db = c.env.DB;
7798
+ let totalRequests = 0;
7799
+ let uniqueIPs = 0;
7800
+ let avgDuration = 0;
7801
+ let errorCount = 0;
7802
+ let topPages = [];
7803
+ let recentActivity = [];
7804
+ try {
7805
+ const now = Math.floor(Date.now() / 1e3);
7806
+ const dayAgo = now - 86400;
7807
+ const [requestsResult, ipsResult, durationResult, errorsResult, pagesResult, activityResult] = await Promise.all([
7808
+ db.prepare("SELECT COUNT(*) as count FROM system_logs WHERE category = ? AND created_at > ?").bind("api", dayAgo).first(),
7809
+ db.prepare("SELECT COUNT(DISTINCT ip_address) as count FROM system_logs WHERE category = ? AND created_at > ?").bind("api", dayAgo).first(),
7810
+ db.prepare("SELECT AVG(duration) as avg FROM system_logs WHERE category = ? AND created_at > ? AND duration IS NOT NULL").bind("api", dayAgo).first(),
7811
+ db.prepare("SELECT COUNT(*) as count FROM system_logs WHERE level IN (?, ?) AND created_at > ?").bind("error", "fatal", dayAgo).first(),
7812
+ db.prepare("SELECT url, COUNT(*) as views FROM system_logs WHERE category = ? AND created_at > ? AND url IS NOT NULL GROUP BY url ORDER BY views DESC LIMIT 10").bind("api", dayAgo).all(),
7813
+ db.prepare("SELECT url, method, status_code, duration, created_at FROM system_logs WHERE category = ? ORDER BY created_at DESC LIMIT 20").bind("api").all()
7814
+ ]);
7815
+ totalRequests = requestsResult?.count || 0;
7816
+ uniqueIPs = ipsResult?.count || 0;
7817
+ avgDuration = Math.round(durationResult?.avg || 0);
7818
+ errorCount = errorsResult?.count || 0;
7819
+ topPages = (pagesResult.results || []).map((r) => ({ path: r.url, views: r.views }));
7820
+ recentActivity = activityResult.results || [];
7821
+ } catch {
7822
+ }
7823
+ const content2 = `
7824
+ <div class="space-y-8">
7825
+ <div>
7826
+ <h1 class="text-2xl font-semibold text-zinc-950 dark:text-white">Analytics Dashboard</h1>
7827
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Last 24 hours overview from system logs</p>
7828
+ </div>
7829
+
7830
+ <!-- Stats Cards -->
7831
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
7832
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7833
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Total Requests</p>
7834
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${totalRequests.toLocaleString()}</p>
7835
+ </div>
7836
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7837
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Unique Visitors</p>
7838
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${uniqueIPs.toLocaleString()}</p>
7839
+ </div>
7840
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7841
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Avg Response Time</p>
7842
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${avgDuration}ms</p>
7843
+ </div>
7844
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7845
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Errors</p>
7846
+ <p class="mt-2 text-3xl font-semibold ${errorCount > 0 ? "text-red-600 dark:text-red-400" : "text-zinc-950 dark:text-white"}">${errorCount.toLocaleString()}</p>
7847
+ </div>
7848
+ </div>
7849
+
7850
+ <!-- Top Pages -->
7851
+ <div class="rounded-lg bg-white dark:bg-zinc-800 ring-1 ring-zinc-950/5 dark:ring-white/10">
7852
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10">
7853
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">Top Pages</h2>
7854
+ </div>
7855
+ <div class="divide-y divide-zinc-950/5 dark:divide-white/10">
7856
+ ${topPages.length > 0 ? topPages.map((p) => `
7857
+ <div class="flex items-center justify-between px-6 py-3">
7858
+ <span class="text-sm text-zinc-700 dark:text-zinc-300 font-mono truncate">${escapeHtml3(p.path)}</span>
7859
+ <span class="text-sm font-medium text-zinc-500 dark:text-zinc-400">${p.views}</span>
7860
+ </div>
7861
+ `).join("") : `
7862
+ <div class="px-6 py-8 text-center text-sm text-zinc-500 dark:text-zinc-400">
7863
+ No page views recorded yet. Analytics data will appear once requests are logged.
7864
+ </div>
7865
+ `}
7866
+ </div>
7867
+ </div>
7868
+
7869
+ <!-- Recent Activity -->
7870
+ <div class="rounded-lg bg-white dark:bg-zinc-800 ring-1 ring-zinc-950/5 dark:ring-white/10">
7871
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10">
7872
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">Recent Activity</h2>
7873
+ </div>
7874
+ <div class="overflow-x-auto">
7875
+ <table class="w-full text-sm">
7876
+ <thead class="bg-zinc-50 dark:bg-zinc-800/50">
7877
+ <tr>
7878
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Path</th>
7879
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Method</th>
7880
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Status</th>
7881
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Duration</th>
7882
+ </tr>
7883
+ </thead>
7884
+ <tbody class="divide-y divide-zinc-950/5 dark:divide-white/10">
7885
+ ${recentActivity.length > 0 ? recentActivity.map((a) => `
7886
+ <tr>
7887
+ <td class="px-6 py-2 font-mono text-zinc-700 dark:text-zinc-300 truncate max-w-xs">${escapeHtml3(a.url || "")}</td>
7888
+ <td class="px-6 py-2"><span class="inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium ${a.method === "GET" ? "bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-400" : "bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}">${a.method || ""}</span></td>
7889
+ <td class="px-6 py-2"><span class="inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium ${(a.status_code || 0) >= 400 ? "bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-400" : "bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-400"}">${a.status_code || ""}</span></td>
7890
+ <td class="px-6 py-2 text-zinc-500 dark:text-zinc-400">${a.duration || 0}ms</td>
7891
+ </tr>
7892
+ `).join("") : `
7893
+ <tr>
7894
+ <td colspan="4" class="px-6 py-8 text-center text-zinc-500 dark:text-zinc-400">No activity recorded yet.</td>
7895
+ </tr>
7896
+ `}
7897
+ </tbody>
7898
+ </table>
7899
+ </div>
7900
+ </div>
7901
+ </div>
7902
+ `;
7903
+ return c.html(chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst({
7904
+ title: "Analytics",
7905
+ pageTitle: "Analytics Dashboard",
7906
+ currentPath: "/admin/analytics",
7907
+ version: c.get("appVersion"),
7908
+ user: user ? {
7909
+ name: user.email.split("@")[0] || "Admin",
7910
+ email: user.email,
7911
+ role: user.role
7912
+ } : void 0,
7913
+ content: content2,
7914
+ dynamicMenuItems: c.get("pluginMenuItems")
7915
+ }));
7916
+ });
7917
+ function escapeHtml3(str) {
7918
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7919
+ }
7920
+
7921
+ // src/plugins/core-plugins/analytics/index.ts
7922
+ function createAnalyticsPlugin() {
7923
+ const builder = chunk635JAMSE_cjs.PluginBuilder.create({
7924
+ name: "core-analytics",
7925
+ version: "1.0.0-beta.1",
7926
+ description: "Core analytics tracking and reporting plugin"
7927
+ });
7928
+ builder.metadata({
7929
+ author: {
7930
+ name: "SonicJS Team",
7931
+ email: "team@sonicjs.com"
7932
+ },
7933
+ license: "MIT",
7934
+ compatibility: "^0.1.0",
7935
+ dependencies: ["core-auth"]
7936
+ // Requires auth for admin access
7937
+ });
7938
+ const analyticsAPI = new hono.Hono();
7939
+ analyticsAPI.get("/stats", async (c) => {
7940
+ const timeRange = c.req.query("range") || "7d";
7941
+ c.req.query("metric") || "all";
7942
+ return c.json({
7943
+ message: "Analytics stats",
7944
+ data: {
7945
+ pageviews: 12500,
7946
+ uniqueVisitors: 3200,
7947
+ sessions: 4800,
7948
+ avgSessionDuration: 245,
7949
+ bounceRate: 0.35,
7950
+ topPages: [
7951
+ { path: "/", views: 3200 },
7952
+ { path: "/about", views: 1800 },
7953
+ { path: "/contact", views: 950 }
7954
+ ],
7955
+ timeRange
7956
+ }
7957
+ });
7958
+ });
7959
+ analyticsAPI.post("/track", async (c) => {
7960
+ const event = await c.req.json();
7961
+ console.info("Analytics event tracked:", event);
7962
+ return c.json({
7963
+ message: "Event tracked successfully",
7964
+ eventId: `event-${Date.now()}`
7965
+ });
7966
+ });
7967
+ analyticsAPI.get("/reports", async (c) => {
7968
+ const reportType = c.req.query("type") || "traffic";
7969
+ const startDate = c.req.query("start");
7970
+ const endDate = c.req.query("end");
7971
+ return c.json({
7972
+ message: "Analytics report",
7973
+ data: {
7974
+ reportType,
7975
+ dateRange: { start: startDate, end: endDate },
7976
+ data: []
7977
+ }
7978
+ });
7979
+ });
7980
+ analyticsAPI.get("/realtime", async (c) => {
7981
+ return c.json({
7982
+ message: "Real-time analytics",
7983
+ data: {
7984
+ activeUsers: 23,
7985
+ activePages: [
7986
+ { path: "/", users: 8 },
7987
+ { path: "/blog", users: 5 },
7988
+ { path: "/products", users: 4 }
7989
+ ],
7990
+ recentEvents: []
7991
+ }
7992
+ });
7993
+ });
7994
+ builder.addRoute("/api/analytics", analyticsAPI, {
7995
+ description: "Analytics tracking and reporting API",
7996
+ requiresAuth: true,
7997
+ roles: ["admin", "analytics:read"],
7998
+ priority: 3
7999
+ });
8000
+ builder.addRoute("/admin/analytics", adminRoutes4, {
8001
+ description: "Analytics admin dashboard",
8002
+ requiresAuth: true,
8003
+ priority: 50
8004
+ });
8005
+ builder.addSingleMiddleware("analytics-tracker", async (c, next) => {
8006
+ const start = Date.now();
8007
+ const path = c.req.path;
8008
+ const method = c.req.method;
8009
+ const userAgent = c.req.header("user-agent");
8010
+ const referer = c.req.header("referer");
8011
+ const ip = c.req.header("CF-Connecting-IP") || c.req.header("x-forwarded-for");
8012
+ await next();
8013
+ const duration = Date.now() - start;
8014
+ const status = c.res.status;
8015
+ const analyticsData = {
8016
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8017
+ path,
8018
+ method,
8019
+ status,
8020
+ duration,
8021
+ userAgent,
8022
+ referer,
8023
+ ip,
8024
+ responseSize: c.res.headers.get("content-length") || 0
8025
+ };
8026
+ console.debug("Analytics tracking:", analyticsData);
8027
+ }, {
8028
+ description: "Track page views and request analytics",
8029
+ global: true,
8030
+ priority: 99
8031
+ // Run last to capture response data
8032
+ });
8033
+ builder.addService("analyticsService", {
8034
+ trackEvent: async (event) => {
8035
+ console.info("Tracking event:", event);
8036
+ return { eventId: `event-${Date.now()}` };
8037
+ },
8038
+ trackPageView: async (data) => {
8039
+ console.info("Tracking pageview:", data.path);
8040
+ return { viewId: `view-${Date.now()}` };
8041
+ },
8042
+ getStats: async (_timeRange) => {
8043
+ return {
8044
+ pageviews: 12500,
8045
+ sessions: 4800,
8046
+ uniqueVisitors: 3200
8047
+ };
8048
+ },
8049
+ generateReport: async (type, options) => {
8050
+ console.info(`Generating ${type} report with options:`, options);
8051
+ return { reportId: `report-${Date.now()}` };
8052
+ }
8053
+ }, {
8054
+ description: "Core analytics tracking service",
8055
+ singleton: true
8056
+ });
8057
+ const pageViewSchema = chunk635JAMSE_cjs.PluginHelpers.createSchema([
8058
+ { name: "path", type: "string", optional: false },
8059
+ { name: "title", type: "string", optional: true },
8060
+ { name: "referrer", type: "string", optional: true },
8061
+ { name: "userAgent", type: "string", optional: true },
8062
+ { name: "ipAddress", type: "string", optional: true },
8063
+ { name: "sessionId", type: "string", optional: true },
8064
+ { name: "userId", type: "number", optional: true },
8065
+ { name: "duration", type: "number", optional: true }
8066
+ ]);
8067
+ const eventSchema = chunk635JAMSE_cjs.PluginHelpers.createSchema([
8068
+ { name: "eventType", type: "string", optional: false },
8069
+ { name: "eventName", type: "string", optional: false },
8070
+ { name: "eventData", type: "object", optional: true },
8071
+ { name: "path", type: "string", optional: true },
8072
+ { name: "sessionId", type: "string", optional: true },
8073
+ { name: "userId", type: "number", optional: true }
8074
+ ]);
8075
+ const pageViewMigration = chunk635JAMSE_cjs.PluginHelpers.createMigration("analytics_pageviews", [
8076
+ { name: "id", type: "INTEGER", primaryKey: true },
8077
+ { name: "path", type: "TEXT", nullable: false },
8078
+ { name: "title", type: "TEXT", nullable: true },
8079
+ { name: "referrer", type: "TEXT", nullable: true },
8080
+ { name: "user_agent", type: "TEXT", nullable: true },
8081
+ { name: "ip_address", type: "TEXT", nullable: true },
8082
+ { name: "session_id", type: "TEXT", nullable: true },
8083
+ { name: "user_id", type: "INTEGER", nullable: true },
8084
+ { name: "duration", type: "INTEGER", nullable: true }
8085
+ ]);
8086
+ const eventMigration = chunk635JAMSE_cjs.PluginHelpers.createMigration("analytics_events", [
8087
+ { name: "id", type: "INTEGER", primaryKey: true },
8088
+ { name: "event_type", type: "TEXT", nullable: false },
8089
+ { name: "event_name", type: "TEXT", nullable: false },
8090
+ { name: "event_data", type: "TEXT", nullable: true },
8091
+ { name: "path", type: "TEXT", nullable: true },
8092
+ { name: "session_id", type: "TEXT", nullable: true },
8093
+ { name: "user_id", type: "INTEGER", nullable: true }
8094
+ ]);
8095
+ builder.addModel("PageView", {
8096
+ tableName: "analytics_pageviews",
8097
+ schema: pageViewSchema,
8098
+ migrations: [pageViewMigration]
8099
+ });
8100
+ builder.addModel("AnalyticsEvent", {
8101
+ tableName: "analytics_events",
8102
+ schema: eventSchema,
8103
+ migrations: [eventMigration]
8104
+ });
8105
+ builder.addHook(HOOKS2.REQUEST_START, async (data, _context) => {
8106
+ data.analytics = {
8107
+ startTime: Date.now(),
8108
+ sessionId: `session-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
8109
+ };
8110
+ return data;
8111
+ }, {
8112
+ priority: 1,
8113
+ description: "Initialize analytics tracking for requests"
8114
+ });
8115
+ builder.addHook(HOOKS2.REQUEST_END, async (data, _context) => {
8116
+ if (data.analytics) {
8117
+ const duration = Date.now() - data.analytics.startTime;
8118
+ console.debug(`Request completed in ${duration}ms`);
8119
+ }
8120
+ return data;
8121
+ }, {
8122
+ priority: 1,
8123
+ description: "Complete analytics tracking for requests"
8124
+ });
8125
+ builder.addHook(HOOKS2.USER_LOGIN, async (data, context) => {
8126
+ await context.services?.analyticsService?.trackEvent({
8127
+ eventType: "auth",
8128
+ eventName: "user_login",
8129
+ userId: data.userId,
8130
+ eventData: { loginMethod: data.method }
8131
+ });
8132
+ return data;
8133
+ }, {
8134
+ priority: 8,
8135
+ description: "Track user login events"
8136
+ });
8137
+ builder.addHook("content:view", async (data, context) => {
8138
+ await context.services?.analyticsService?.trackEvent({
8139
+ eventType: "content",
8140
+ eventName: "content_view",
8141
+ eventData: {
8142
+ contentId: data.id,
8143
+ contentType: data.type,
8144
+ title: data.title
8145
+ }
8146
+ });
8147
+ return data;
8148
+ }, {
8149
+ priority: 8,
8150
+ description: "Track content view events"
8151
+ });
8152
+ builder.addAdminPage(
8153
+ "/analytics",
8154
+ "Analytics Dashboard",
8155
+ "AnalyticsDashboardView",
8156
+ {
8157
+ description: "View analytics overview and key metrics",
8158
+ permissions: ["admin", "analytics:read"],
8159
+ icon: "chart-bar"
8160
+ }
8161
+ );
8162
+ builder.addAdminPage(
8163
+ "/analytics/reports",
8164
+ "Analytics Reports",
8165
+ "AnalyticsReportsView",
8166
+ {
8167
+ description: "Generate and view detailed analytics reports",
8168
+ permissions: ["admin", "analytics:read"],
8169
+ icon: "document-report"
8170
+ }
8171
+ );
8172
+ builder.addAdminPage(
8173
+ "/analytics/realtime",
8174
+ "Real-time Analytics",
8175
+ "AnalyticsRealtimeView",
8176
+ {
8177
+ description: "View real-time visitor activity",
8178
+ permissions: ["admin", "analytics:read"],
8179
+ icon: "lightning-bolt"
8180
+ }
8181
+ );
8182
+ builder.addAdminPage(
8183
+ "/analytics/settings",
8184
+ "Analytics Settings",
8185
+ "AnalyticsSettingsView",
8186
+ {
8187
+ description: "Configure analytics tracking and data collection",
8188
+ permissions: ["admin", "analytics:configure"],
8189
+ icon: "cog"
8190
+ }
8191
+ );
8192
+ builder.addMenuItem("Analytics", "/admin/analytics", {
8193
+ icon: "chart-bar",
8194
+ order: 40,
8195
+ permissions: ["admin", "analytics:read"]
8196
+ });
8197
+ builder.addMenuItem("Dashboard", "/admin/analytics", {
8198
+ icon: "chart-bar",
8199
+ parent: "Analytics",
8200
+ order: 1,
8201
+ permissions: ["admin", "analytics:read"]
8202
+ });
8203
+ builder.addMenuItem("Reports", "/admin/analytics/reports", {
8204
+ icon: "document-report",
8205
+ parent: "Analytics",
8206
+ order: 2,
8207
+ permissions: ["admin", "analytics:read"]
8208
+ });
8209
+ builder.addMenuItem("Real-time", "/admin/analytics/realtime", {
8210
+ icon: "lightning-bolt",
8211
+ parent: "Analytics",
8212
+ order: 3,
8213
+ permissions: ["admin", "analytics:read"]
8214
+ });
8215
+ builder.addMenuItem("Settings", "/admin/analytics/settings", {
8216
+ icon: "cog",
8217
+ parent: "Analytics",
8218
+ order: 4,
8219
+ permissions: ["admin", "analytics:configure"]
8220
+ });
8221
+ builder.lifecycle({
8222
+ install: async () => {
8223
+ console.info("Installing analytics plugin...");
8224
+ },
8225
+ activate: async () => {
8226
+ console.info("Activating analytics plugin...");
8227
+ },
8228
+ deactivate: async () => {
8229
+ console.info("Deactivating analytics plugin...");
8230
+ },
8231
+ configure: async (config) => {
8232
+ console.info("Configuring analytics plugin...", config);
8233
+ }
8234
+ });
8235
+ return builder.build();
8236
+ }
8237
+ var analyticsPlugin = createAnalyticsPlugin();
8238
+
8239
+ // src/plugins/core-plugins/analytics/services/event-tracking-service.ts
8240
+ var EventTrackingService = class {
8241
+ constructor(db) {
8242
+ this.db = db;
8243
+ }
8244
+ async trackEvent(input) {
8245
+ const id = crypto.randomUUID();
8246
+ const category = input.category || "user-activity";
8247
+ await this.db.prepare(`
8248
+ INSERT INTO analytics_events (id, event, category, properties, user_id, session_id, ip_address, user_agent, path)
8249
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
8250
+ `).bind(
8251
+ id,
8252
+ input.event,
8253
+ category,
8254
+ input.properties ? JSON.stringify(input.properties) : null,
8255
+ input.userId || null,
8256
+ input.sessionId || null,
8257
+ input.ipAddress || null,
8258
+ input.userAgent || null,
8259
+ input.path || null
8260
+ ).run();
8261
+ return id;
8262
+ }
8263
+ async trackBatch(events) {
8264
+ const ids = [];
8265
+ const stmts = events.map((input) => {
8266
+ const id = crypto.randomUUID();
8267
+ ids.push(id);
8268
+ const category = input.category || "user-activity";
8269
+ return this.db.prepare(`
8270
+ INSERT INTO analytics_events (id, event, category, properties, user_id, session_id, ip_address, user_agent, path)
8271
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
8272
+ `).bind(
8273
+ id,
8274
+ input.event,
8275
+ category,
8276
+ input.properties ? JSON.stringify(input.properties) : null,
8277
+ input.userId || null,
8278
+ input.sessionId || null,
8279
+ input.ipAddress || null,
8280
+ input.userAgent || null,
8281
+ input.path || null
8282
+ );
8283
+ });
8284
+ await this.db.batch(stmts);
8285
+ return ids;
8286
+ }
8287
+ async queryEvents(filters = {}) {
8288
+ const conditions = [];
8289
+ const params = [];
8290
+ if (filters.event) {
8291
+ conditions.push("event = ?");
8292
+ params.push(filters.event);
8293
+ }
8294
+ if (filters.category) {
8295
+ conditions.push("category = ?");
8296
+ params.push(filters.category);
8297
+ }
8298
+ if (filters.userId) {
8299
+ conditions.push("user_id = ?");
8300
+ params.push(filters.userId);
8301
+ }
8302
+ if (filters.sessionId) {
8303
+ conditions.push("session_id = ?");
8304
+ params.push(filters.sessionId);
8305
+ }
8306
+ if (filters.startDate) {
8307
+ conditions.push("created_at >= ?");
8308
+ params.push(filters.startDate);
8309
+ }
8310
+ if (filters.endDate) {
8311
+ conditions.push("created_at <= ?");
8312
+ params.push(filters.endDate);
8313
+ }
8314
+ const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
8315
+ const limit = filters.limit || 50;
8316
+ const offset = filters.offset || 0;
8317
+ const [countResult, eventsResult] = await Promise.all([
8318
+ this.db.prepare(`SELECT COUNT(*) as total FROM analytics_events ${where}`).bind(...params).first(),
8319
+ this.db.prepare(`SELECT * FROM analytics_events ${where} ORDER BY created_at DESC LIMIT ? OFFSET ?`).bind(...params, limit, offset).all()
8320
+ ]);
8321
+ const events = (eventsResult.results || []).map((e) => ({
8322
+ ...e,
8323
+ properties: e.properties ? JSON.parse(e.properties) : null
8324
+ }));
8325
+ return { events, total: countResult?.total || 0 };
8326
+ }
8327
+ async getStats(startDate, endDate) {
8328
+ const conditions = [];
8329
+ const params = [];
8330
+ if (startDate) {
8331
+ conditions.push("created_at >= ?");
8332
+ params.push(startDate);
8333
+ }
8334
+ if (endDate) {
8335
+ conditions.push("created_at <= ?");
8336
+ params.push(endDate);
8337
+ }
8338
+ const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
8339
+ const [totals, topEvents] = await Promise.all([
8340
+ this.db.prepare(`
8341
+ SELECT
8342
+ COUNT(*) as total_events,
8343
+ COUNT(DISTINCT user_id) as unique_users,
8344
+ COUNT(DISTINCT session_id) as unique_sessions
8345
+ FROM analytics_events ${where}
8346
+ `).bind(...params).first(),
8347
+ this.db.prepare(`
8348
+ SELECT event, COUNT(*) as count
8349
+ FROM analytics_events ${where}
8350
+ GROUP BY event ORDER BY count DESC LIMIT 20
8351
+ `).bind(...params).all()
8352
+ ]);
8353
+ return {
8354
+ totalEvents: totals?.total_events || 0,
8355
+ uniqueUsers: totals?.unique_users || 0,
8356
+ uniqueSessions: totals?.unique_sessions || 0,
8357
+ topEvents: (topEvents.results || []).map((r) => ({ event: r.event, count: r.count }))
8358
+ };
8359
+ }
8360
+ };
8361
+
8362
+ // src/plugins/core-plugins/analytics/routes/api.ts
8363
+ var apiRoutes4 = new hono.Hono();
8364
+ apiRoutes4.post("/", async (c) => {
8365
+ const db = c.env.DB;
8366
+ const service = new EventTrackingService(db);
8367
+ const ip = c.req.header("cf-connecting-ip") || c.req.header("x-forwarded-for")?.split(",")[0]?.trim() || "unknown";
8368
+ const userAgent = c.req.header("user-agent") || "";
8369
+ const user = c.get("user");
8370
+ let body;
8371
+ try {
8372
+ body = await c.req.json();
8373
+ } catch {
8374
+ return c.json({ error: "Invalid JSON body" }, 400);
8375
+ }
8376
+ if (Array.isArray(body)) {
8377
+ if (body.length > 100) {
8378
+ return c.json({ error: "Batch size limit is 100 events" }, 400);
8379
+ }
8380
+ const events = body.map((e) => ({
8381
+ event: e.event,
8382
+ category: e.category || "user-activity",
8383
+ properties: e.properties,
8384
+ userId: user?.userId || e.userId,
8385
+ sessionId: e.sessionId,
8386
+ ipAddress: ip,
8387
+ userAgent,
8388
+ path: e.path
8389
+ }));
8390
+ const invalid = events.find((e) => !e.event || typeof e.event !== "string");
8391
+ if (invalid) {
8392
+ return c.json({ error: 'Each event must have an "event" string field' }, 400);
8393
+ }
8394
+ const ids = await service.trackBatch(events);
8395
+ return c.json({ success: true, eventIds: ids, count: ids.length });
8396
+ }
8397
+ if (!body.event || typeof body.event !== "string") {
8398
+ return c.json({ error: '"event" field is required and must be a string' }, 400);
8399
+ }
8400
+ const eventId = await service.trackEvent({
8401
+ event: body.event,
8402
+ category: body.category || "user-activity",
8403
+ properties: body.properties,
8404
+ userId: user?.userId || body.userId,
8405
+ sessionId: body.sessionId,
8406
+ ipAddress: ip,
8407
+ userAgent,
8408
+ path: body.path
8409
+ });
8410
+ return c.json({ success: true, eventId });
8411
+ });
8412
+ apiRoutes4.get("/", async (c) => {
8413
+ const user = c.get("user");
8414
+ if (!user || user.role !== "admin") {
8415
+ return c.json({ error: "Admin access required" }, 403);
8416
+ }
8417
+ const db = c.env.DB;
8418
+ const service = new EventTrackingService(db);
8419
+ const filters = {
8420
+ event: c.req.query("event") || void 0,
8421
+ category: c.req.query("category") || void 0,
8422
+ userId: c.req.query("userId") || void 0,
8423
+ sessionId: c.req.query("sessionId") || void 0,
8424
+ startDate: c.req.query("startDate") ? parseInt(c.req.query("startDate")) : void 0,
8425
+ endDate: c.req.query("endDate") ? parseInt(c.req.query("endDate")) : void 0,
8426
+ limit: c.req.query("limit") ? parseInt(c.req.query("limit")) : 50,
8427
+ offset: c.req.query("offset") ? parseInt(c.req.query("offset")) : 0
8428
+ };
8429
+ const result = await service.queryEvents(filters);
8430
+ return c.json(result);
8431
+ });
8432
+ apiRoutes4.get("/stats", async (c) => {
8433
+ const user = c.get("user");
8434
+ if (!user || user.role !== "admin") {
8435
+ return c.json({ error: "Admin access required" }, 403);
8436
+ }
8437
+ const db = c.env.DB;
8438
+ const service = new EventTrackingService(db);
8439
+ const startDate = c.req.query("startDate") ? parseInt(c.req.query("startDate")) : void 0;
8440
+ const endDate = c.req.query("endDate") ? parseInt(c.req.query("endDate")) : void 0;
8441
+ const stats = await service.getStats(startDate, endDate);
8442
+ return c.json(stats);
8443
+ });
8444
+
7760
8445
  // src/plugins/cache/services/cache-config.ts
7761
8446
  var CACHE_CONFIGS = {
7762
8447
  // Content (high read, low write)
@@ -8898,7 +9583,7 @@ function renderCacheDashboard(data) {
8898
9583
  </script>
8899
9584
 
8900
9585
  <!-- Confirmation Dialogs -->
8901
- ${chunk26HYU7MX_cjs.renderConfirmationDialog({
9586
+ ${chunkMZS33LLH_cjs.renderConfirmationDialog({
8902
9587
  id: "clear-all-cache-confirm",
8903
9588
  title: "Clear All Cache",
8904
9589
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -8909,7 +9594,7 @@ function renderCacheDashboard(data) {
8909
9594
  onConfirm: "performClearAllCaches()"
8910
9595
  })}
8911
9596
 
8912
- ${chunk26HYU7MX_cjs.renderConfirmationDialog({
9597
+ ${chunkMZS33LLH_cjs.renderConfirmationDialog({
8913
9598
  id: "clear-namespace-cache-confirm",
8914
9599
  title: "Clear Namespace Cache",
8915
9600
  message: "Clear cache for this namespace?",
@@ -8920,7 +9605,7 @@ function renderCacheDashboard(data) {
8920
9605
  onConfirm: "performClearNamespaceCache()"
8921
9606
  })}
8922
9607
 
8923
- ${chunk26HYU7MX_cjs.getConfirmationDialogScript()}
9608
+ ${chunkMZS33LLH_cjs.getConfirmationDialogScript()}
8924
9609
  `;
8925
9610
  const layoutData = {
8926
9611
  title: "Cache System",
@@ -9606,14 +10291,14 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
9606
10291
  // src/app.ts
9607
10292
  function createSonicJSApp(config = {}) {
9608
10293
  const app2 = new hono.Hono();
9609
- const appVersion = config.version || chunkVUISYUHY_cjs.getCoreVersion();
10294
+ const appVersion = config.version || chunkV76ERLX6_cjs.getCoreVersion();
9610
10295
  const appName = config.name || "SonicJS AI";
9611
10296
  app2.use("*", async (c, next) => {
9612
10297
  c.set("appVersion", appVersion);
9613
10298
  await next();
9614
10299
  });
9615
- app2.use("*", chunkUFPT5KCQ_cjs.metricsMiddleware());
9616
- app2.use("*", chunkUFPT5KCQ_cjs.bootstrapMiddleware(config));
10300
+ app2.use("*", chunk7HHIZQNE_cjs.metricsMiddleware());
10301
+ app2.use("*", chunk7HHIZQNE_cjs.bootstrapMiddleware(config));
9617
10302
  if (config.middleware?.beforeAuth) {
9618
10303
  for (const middleware of config.middleware.beforeAuth) {
9619
10304
  app2.use("*", middleware);
@@ -9622,29 +10307,32 @@ function createSonicJSApp(config = {}) {
9622
10307
  app2.use("*", async (_c, next) => {
9623
10308
  await next();
9624
10309
  });
9625
- app2.use("*", chunkUFPT5KCQ_cjs.securityHeadersMiddleware());
9626
- app2.use("*", chunkUFPT5KCQ_cjs.csrfProtection());
10310
+ app2.use("*", chunk7HHIZQNE_cjs.securityHeadersMiddleware());
10311
+ app2.use("*", chunk7HHIZQNE_cjs.csrfProtection());
9627
10312
  if (config.middleware?.afterAuth) {
9628
10313
  for (const middleware of config.middleware.afterAuth) {
9629
10314
  app2.use("*", middleware);
9630
10315
  }
9631
10316
  }
10317
+ const adminRoles = config.adminAccessRoles || ["admin"];
10318
+ app2.use("/admin/*", chunk7HHIZQNE_cjs.requireAuth());
10319
+ app2.use("/admin/*", chunk7HHIZQNE_cjs.requireRole(adminRoles));
9632
10320
  app2.use("/admin/*", pluginMenuMiddleware());
9633
- app2.route("/api", chunk26HYU7MX_cjs.api_default);
9634
- app2.route("/api/media", chunk26HYU7MX_cjs.api_media_default);
9635
- app2.route("/api/system", chunk26HYU7MX_cjs.api_system_default);
9636
- app2.route("/admin/api", chunk26HYU7MX_cjs.admin_api_default);
9637
- app2.route("/admin/dashboard", chunk26HYU7MX_cjs.router);
9638
- app2.route("/admin/collections", chunk26HYU7MX_cjs.adminCollectionsRoutes);
9639
- app2.route("/admin/forms", chunk26HYU7MX_cjs.adminFormsRoutes);
9640
- app2.route("/admin/settings", chunk26HYU7MX_cjs.adminSettingsRoutes);
9641
- app2.route("/forms", chunk26HYU7MX_cjs.public_forms_default);
9642
- app2.route("/api/forms", chunk26HYU7MX_cjs.public_forms_default);
9643
- app2.route("/admin/api-reference", chunk26HYU7MX_cjs.router2);
10321
+ app2.route("/api", chunkMZS33LLH_cjs.api_default);
10322
+ app2.route("/api/media", chunkMZS33LLH_cjs.api_media_default);
10323
+ app2.route("/api/system", chunkMZS33LLH_cjs.api_system_default);
10324
+ app2.route("/admin/api", chunkMZS33LLH_cjs.admin_api_default);
10325
+ app2.route("/admin/dashboard", chunkMZS33LLH_cjs.router);
10326
+ app2.route("/admin/collections", chunkMZS33LLH_cjs.adminCollectionsRoutes);
10327
+ app2.route("/admin/forms", chunkMZS33LLH_cjs.adminFormsRoutes);
10328
+ app2.route("/admin/settings", chunkMZS33LLH_cjs.adminSettingsRoutes);
10329
+ app2.route("/forms", chunkMZS33LLH_cjs.public_forms_default);
10330
+ app2.route("/api/forms", chunkMZS33LLH_cjs.public_forms_default);
10331
+ app2.route("/admin/api-reference", chunkMZS33LLH_cjs.router2);
9644
10332
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
9645
10333
  app2.route("/admin/seed-data", createSeedDataAdminRoutes());
9646
- app2.route("/admin/content", chunk26HYU7MX_cjs.admin_content_default);
9647
- app2.route("/admin/media", chunk26HYU7MX_cjs.adminMediaRoutes);
10334
+ app2.route("/admin/content", chunkMZS33LLH_cjs.admin_content_default);
10335
+ app2.route("/admin/media", chunkMZS33LLH_cjs.adminMediaRoutes);
9648
10336
  app2.use("/auth/*", securityAuditMiddleware());
9649
10337
  if (securityAuditPlugin.routes && securityAuditPlugin.routes.length > 0) {
9650
10338
  for (const route of securityAuditPlugin.routes) {
@@ -9662,8 +10350,8 @@ function createSonicJSApp(config = {}) {
9662
10350
  app2.route(route.path, route.handler);
9663
10351
  }
9664
10352
  }
9665
- if (chunk26HYU7MX_cjs.userProfilesPlugin.routes && chunk26HYU7MX_cjs.userProfilesPlugin.routes.length > 0) {
9666
- for (const route of chunk26HYU7MX_cjs.userProfilesPlugin.routes) {
10353
+ if (chunkMZS33LLH_cjs.userProfilesPlugin.routes && chunkMZS33LLH_cjs.userProfilesPlugin.routes.length > 0) {
10354
+ for (const route of chunkMZS33LLH_cjs.userProfilesPlugin.routes) {
9667
10355
  app2.route(route.path, route.handler);
9668
10356
  }
9669
10357
  }
@@ -9672,16 +10360,22 @@ function createSonicJSApp(config = {}) {
9672
10360
  app2.route(route.path, route.handler);
9673
10361
  }
9674
10362
  }
10363
+ if (analyticsPlugin.routes && analyticsPlugin.routes.length > 0) {
10364
+ for (const route of analyticsPlugin.routes) {
10365
+ app2.route(route.path, route.handler);
10366
+ }
10367
+ }
10368
+ app2.route("/api/events", apiRoutes4);
9675
10369
  if (stripePlugin.routes && stripePlugin.routes.length > 0) {
9676
10370
  for (const route of stripePlugin.routes) {
9677
10371
  app2.route(route.path, route.handler);
9678
10372
  }
9679
10373
  }
9680
- app2.route("/admin/plugins", chunk26HYU7MX_cjs.adminPluginRoutes);
9681
- app2.route("/admin/logs", chunk26HYU7MX_cjs.adminLogsRoutes);
9682
- app2.route("/admin", chunk26HYU7MX_cjs.userRoutes);
9683
- app2.route("/auth", chunk26HYU7MX_cjs.auth_default);
9684
- app2.route("/", chunk26HYU7MX_cjs.test_cleanup_default);
10374
+ app2.route("/admin/plugins", chunkMZS33LLH_cjs.adminPluginRoutes);
10375
+ app2.route("/admin/logs", chunkMZS33LLH_cjs.adminLogsRoutes);
10376
+ app2.route("/admin", chunkMZS33LLH_cjs.userRoutes);
10377
+ app2.route("/auth", chunkMZS33LLH_cjs.auth_default);
10378
+ app2.route("/", chunkMZS33LLH_cjs.test_cleanup_default);
9685
10379
  if (emailPlugin.routes && emailPlugin.routes.length > 0) {
9686
10380
  for (const route of emailPlugin.routes) {
9687
10381
  app2.route(route.path, route.handler);
@@ -9765,99 +10459,99 @@ function createDb(d1$1) {
9765
10459
  }
9766
10460
 
9767
10461
  // src/index.ts
9768
- var VERSION = chunkVUISYUHY_cjs.package_default.version;
10462
+ var VERSION = chunkV76ERLX6_cjs.package_default.version;
9769
10463
 
9770
10464
  Object.defineProperty(exports, "ROUTES_INFO", {
9771
10465
  enumerable: true,
9772
- get: function () { return chunk26HYU7MX_cjs.ROUTES_INFO; }
10466
+ get: function () { return chunkMZS33LLH_cjs.ROUTES_INFO; }
9773
10467
  });
9774
10468
  Object.defineProperty(exports, "adminApiRoutes", {
9775
10469
  enumerable: true,
9776
- get: function () { return chunk26HYU7MX_cjs.admin_api_default; }
10470
+ get: function () { return chunkMZS33LLH_cjs.admin_api_default; }
9777
10471
  });
9778
10472
  Object.defineProperty(exports, "adminCheckboxRoutes", {
9779
10473
  enumerable: true,
9780
- get: function () { return chunk26HYU7MX_cjs.adminCheckboxRoutes; }
10474
+ get: function () { return chunkMZS33LLH_cjs.adminCheckboxRoutes; }
9781
10475
  });
9782
10476
  Object.defineProperty(exports, "adminCodeExamplesRoutes", {
9783
10477
  enumerable: true,
9784
- get: function () { return chunk26HYU7MX_cjs.admin_code_examples_default; }
10478
+ get: function () { return chunkMZS33LLH_cjs.admin_code_examples_default; }
9785
10479
  });
9786
10480
  Object.defineProperty(exports, "adminCollectionsRoutes", {
9787
10481
  enumerable: true,
9788
- get: function () { return chunk26HYU7MX_cjs.adminCollectionsRoutes; }
10482
+ get: function () { return chunkMZS33LLH_cjs.adminCollectionsRoutes; }
9789
10483
  });
9790
10484
  Object.defineProperty(exports, "adminContentRoutes", {
9791
10485
  enumerable: true,
9792
- get: function () { return chunk26HYU7MX_cjs.admin_content_default; }
10486
+ get: function () { return chunkMZS33LLH_cjs.admin_content_default; }
9793
10487
  });
9794
10488
  Object.defineProperty(exports, "adminDashboardRoutes", {
9795
10489
  enumerable: true,
9796
- get: function () { return chunk26HYU7MX_cjs.router; }
10490
+ get: function () { return chunkMZS33LLH_cjs.router; }
9797
10491
  });
9798
10492
  Object.defineProperty(exports, "adminDesignRoutes", {
9799
10493
  enumerable: true,
9800
- get: function () { return chunk26HYU7MX_cjs.adminDesignRoutes; }
10494
+ get: function () { return chunkMZS33LLH_cjs.adminDesignRoutes; }
9801
10495
  });
9802
10496
  Object.defineProperty(exports, "adminLogsRoutes", {
9803
10497
  enumerable: true,
9804
- get: function () { return chunk26HYU7MX_cjs.adminLogsRoutes; }
10498
+ get: function () { return chunkMZS33LLH_cjs.adminLogsRoutes; }
9805
10499
  });
9806
10500
  Object.defineProperty(exports, "adminMediaRoutes", {
9807
10501
  enumerable: true,
9808
- get: function () { return chunk26HYU7MX_cjs.adminMediaRoutes; }
10502
+ get: function () { return chunkMZS33LLH_cjs.adminMediaRoutes; }
9809
10503
  });
9810
10504
  Object.defineProperty(exports, "adminPluginRoutes", {
9811
10505
  enumerable: true,
9812
- get: function () { return chunk26HYU7MX_cjs.adminPluginRoutes; }
10506
+ get: function () { return chunkMZS33LLH_cjs.adminPluginRoutes; }
9813
10507
  });
9814
10508
  Object.defineProperty(exports, "adminSettingsRoutes", {
9815
10509
  enumerable: true,
9816
- get: function () { return chunk26HYU7MX_cjs.adminSettingsRoutes; }
10510
+ get: function () { return chunkMZS33LLH_cjs.adminSettingsRoutes; }
9817
10511
  });
9818
10512
  Object.defineProperty(exports, "adminTestimonialsRoutes", {
9819
10513
  enumerable: true,
9820
- get: function () { return chunk26HYU7MX_cjs.admin_testimonials_default; }
10514
+ get: function () { return chunkMZS33LLH_cjs.admin_testimonials_default; }
9821
10515
  });
9822
10516
  Object.defineProperty(exports, "adminUsersRoutes", {
9823
10517
  enumerable: true,
9824
- get: function () { return chunk26HYU7MX_cjs.userRoutes; }
10518
+ get: function () { return chunkMZS33LLH_cjs.userRoutes; }
9825
10519
  });
9826
10520
  Object.defineProperty(exports, "apiContentCrudRoutes", {
9827
10521
  enumerable: true,
9828
- get: function () { return chunk26HYU7MX_cjs.api_content_crud_default; }
10522
+ get: function () { return chunkMZS33LLH_cjs.api_content_crud_default; }
9829
10523
  });
9830
10524
  Object.defineProperty(exports, "apiMediaRoutes", {
9831
10525
  enumerable: true,
9832
- get: function () { return chunk26HYU7MX_cjs.api_media_default; }
10526
+ get: function () { return chunkMZS33LLH_cjs.api_media_default; }
9833
10527
  });
9834
10528
  Object.defineProperty(exports, "apiRoutes", {
9835
10529
  enumerable: true,
9836
- get: function () { return chunk26HYU7MX_cjs.api_default; }
10530
+ get: function () { return chunkMZS33LLH_cjs.api_default; }
9837
10531
  });
9838
10532
  Object.defineProperty(exports, "apiSystemRoutes", {
9839
10533
  enumerable: true,
9840
- get: function () { return chunk26HYU7MX_cjs.api_system_default; }
10534
+ get: function () { return chunkMZS33LLH_cjs.api_system_default; }
9841
10535
  });
9842
10536
  Object.defineProperty(exports, "authRoutes", {
9843
10537
  enumerable: true,
9844
- get: function () { return chunk26HYU7MX_cjs.auth_default; }
10538
+ get: function () { return chunkMZS33LLH_cjs.auth_default; }
9845
10539
  });
9846
10540
  Object.defineProperty(exports, "createUserProfilesPlugin", {
9847
10541
  enumerable: true,
9848
- get: function () { return chunk26HYU7MX_cjs.createUserProfilesPlugin; }
10542
+ get: function () { return chunkMZS33LLH_cjs.createUserProfilesPlugin; }
9849
10543
  });
9850
10544
  Object.defineProperty(exports, "defineUserProfile", {
9851
10545
  enumerable: true,
9852
- get: function () { return chunk26HYU7MX_cjs.defineUserProfile; }
10546
+ get: function () { return chunkMZS33LLH_cjs.defineUserProfile; }
9853
10547
  });
9854
10548
  Object.defineProperty(exports, "getUserProfileConfig", {
9855
10549
  enumerable: true,
9856
- get: function () { return chunk26HYU7MX_cjs.getUserProfileConfig; }
10550
+ get: function () { return chunkMZS33LLH_cjs.getUserProfileConfig; }
9857
10551
  });
9858
10552
  Object.defineProperty(exports, "userProfilesPlugin", {
9859
10553
  enumerable: true,
9860
- get: function () { return chunk26HYU7MX_cjs.userProfilesPlugin; }
10554
+ get: function () { return chunkMZS33LLH_cjs.userProfilesPlugin; }
9861
10555
  });
9862
10556
  Object.defineProperty(exports, "Logger", {
9863
10557
  enumerable: true,
@@ -10025,167 +10719,167 @@ Object.defineProperty(exports, "workflowHistory", {
10025
10719
  });
10026
10720
  Object.defineProperty(exports, "AuthManager", {
10027
10721
  enumerable: true,
10028
- get: function () { return chunkUFPT5KCQ_cjs.AuthManager; }
10722
+ get: function () { return chunk7HHIZQNE_cjs.AuthManager; }
10029
10723
  });
10030
10724
  Object.defineProperty(exports, "PermissionManager", {
10031
10725
  enumerable: true,
10032
- get: function () { return chunkUFPT5KCQ_cjs.PermissionManager; }
10726
+ get: function () { return chunk7HHIZQNE_cjs.PermissionManager; }
10033
10727
  });
10034
10728
  Object.defineProperty(exports, "bootstrapMiddleware", {
10035
10729
  enumerable: true,
10036
- get: function () { return chunkUFPT5KCQ_cjs.bootstrapMiddleware; }
10730
+ get: function () { return chunk7HHIZQNE_cjs.bootstrapMiddleware; }
10037
10731
  });
10038
10732
  Object.defineProperty(exports, "cacheHeaders", {
10039
10733
  enumerable: true,
10040
- get: function () { return chunkUFPT5KCQ_cjs.cacheHeaders; }
10734
+ get: function () { return chunk7HHIZQNE_cjs.cacheHeaders; }
10041
10735
  });
10042
10736
  Object.defineProperty(exports, "compressionMiddleware", {
10043
10737
  enumerable: true,
10044
- get: function () { return chunkUFPT5KCQ_cjs.compressionMiddleware; }
10738
+ get: function () { return chunk7HHIZQNE_cjs.compressionMiddleware; }
10045
10739
  });
10046
10740
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
10047
10741
  enumerable: true,
10048
- get: function () { return chunkUFPT5KCQ_cjs.detailedLoggingMiddleware; }
10742
+ get: function () { return chunk7HHIZQNE_cjs.detailedLoggingMiddleware; }
10049
10743
  });
10050
10744
  Object.defineProperty(exports, "getActivePlugins", {
10051
10745
  enumerable: true,
10052
- get: function () { return chunkUFPT5KCQ_cjs.getActivePlugins; }
10746
+ get: function () { return chunk7HHIZQNE_cjs.getActivePlugins; }
10053
10747
  });
10054
10748
  Object.defineProperty(exports, "isPluginActive", {
10055
10749
  enumerable: true,
10056
- get: function () { return chunkUFPT5KCQ_cjs.isPluginActive; }
10750
+ get: function () { return chunk7HHIZQNE_cjs.isPluginActive; }
10057
10751
  });
10058
10752
  Object.defineProperty(exports, "logActivity", {
10059
10753
  enumerable: true,
10060
- get: function () { return chunkUFPT5KCQ_cjs.logActivity; }
10754
+ get: function () { return chunk7HHIZQNE_cjs.logActivity; }
10061
10755
  });
10062
10756
  Object.defineProperty(exports, "loggingMiddleware", {
10063
10757
  enumerable: true,
10064
- get: function () { return chunkUFPT5KCQ_cjs.loggingMiddleware; }
10758
+ get: function () { return chunk7HHIZQNE_cjs.loggingMiddleware; }
10065
10759
  });
10066
10760
  Object.defineProperty(exports, "optionalAuth", {
10067
10761
  enumerable: true,
10068
- get: function () { return chunkUFPT5KCQ_cjs.optionalAuth; }
10762
+ get: function () { return chunk7HHIZQNE_cjs.optionalAuth; }
10069
10763
  });
10070
10764
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
10071
10765
  enumerable: true,
10072
- get: function () { return chunkUFPT5KCQ_cjs.performanceLoggingMiddleware; }
10766
+ get: function () { return chunk7HHIZQNE_cjs.performanceLoggingMiddleware; }
10073
10767
  });
10074
10768
  Object.defineProperty(exports, "requireActivePlugin", {
10075
10769
  enumerable: true,
10076
- get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugin; }
10770
+ get: function () { return chunk7HHIZQNE_cjs.requireActivePlugin; }
10077
10771
  });
10078
10772
  Object.defineProperty(exports, "requireActivePlugins", {
10079
10773
  enumerable: true,
10080
- get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugins; }
10774
+ get: function () { return chunk7HHIZQNE_cjs.requireActivePlugins; }
10081
10775
  });
10082
10776
  Object.defineProperty(exports, "requireAnyPermission", {
10083
10777
  enumerable: true,
10084
- get: function () { return chunkUFPT5KCQ_cjs.requireAnyPermission; }
10778
+ get: function () { return chunk7HHIZQNE_cjs.requireAnyPermission; }
10085
10779
  });
10086
10780
  Object.defineProperty(exports, "requireAuth", {
10087
10781
  enumerable: true,
10088
- get: function () { return chunkUFPT5KCQ_cjs.requireAuth; }
10782
+ get: function () { return chunk7HHIZQNE_cjs.requireAuth; }
10089
10783
  });
10090
10784
  Object.defineProperty(exports, "requirePermission", {
10091
10785
  enumerable: true,
10092
- get: function () { return chunkUFPT5KCQ_cjs.requirePermission; }
10786
+ get: function () { return chunk7HHIZQNE_cjs.requirePermission; }
10093
10787
  });
10094
10788
  Object.defineProperty(exports, "requireRole", {
10095
10789
  enumerable: true,
10096
- get: function () { return chunkUFPT5KCQ_cjs.requireRole; }
10790
+ get: function () { return chunk7HHIZQNE_cjs.requireRole; }
10097
10791
  });
10098
10792
  Object.defineProperty(exports, "securityHeaders", {
10099
10793
  enumerable: true,
10100
- get: function () { return chunkUFPT5KCQ_cjs.securityHeadersMiddleware; }
10794
+ get: function () { return chunk7HHIZQNE_cjs.securityHeadersMiddleware; }
10101
10795
  });
10102
10796
  Object.defineProperty(exports, "securityLoggingMiddleware", {
10103
10797
  enumerable: true,
10104
- get: function () { return chunkUFPT5KCQ_cjs.securityLoggingMiddleware; }
10798
+ get: function () { return chunk7HHIZQNE_cjs.securityLoggingMiddleware; }
10105
10799
  });
10106
10800
  Object.defineProperty(exports, "PluginBootstrapService", {
10107
10801
  enumerable: true,
10108
- get: function () { return chunk43AB4EH4_cjs.PluginBootstrapService; }
10802
+ get: function () { return chunkU6FOL6EO_cjs.PluginBootstrapService; }
10109
10803
  });
10110
10804
  Object.defineProperty(exports, "PluginServiceClass", {
10111
10805
  enumerable: true,
10112
- get: function () { return chunk43AB4EH4_cjs.PluginService; }
10806
+ get: function () { return chunkU6FOL6EO_cjs.PluginService; }
10113
10807
  });
10114
10808
  Object.defineProperty(exports, "backfillFormSubmissions", {
10115
10809
  enumerable: true,
10116
- get: function () { return chunk43AB4EH4_cjs.backfillFormSubmissions; }
10810
+ get: function () { return chunkU6FOL6EO_cjs.backfillFormSubmissions; }
10117
10811
  });
10118
10812
  Object.defineProperty(exports, "cleanupRemovedCollections", {
10119
10813
  enumerable: true,
10120
- get: function () { return chunk43AB4EH4_cjs.cleanupRemovedCollections; }
10814
+ get: function () { return chunkU6FOL6EO_cjs.cleanupRemovedCollections; }
10121
10815
  });
10122
10816
  Object.defineProperty(exports, "createContentFromSubmission", {
10123
10817
  enumerable: true,
10124
- get: function () { return chunk43AB4EH4_cjs.createContentFromSubmission; }
10818
+ get: function () { return chunkU6FOL6EO_cjs.createContentFromSubmission; }
10125
10819
  });
10126
10820
  Object.defineProperty(exports, "deriveCollectionSchemaFromFormio", {
10127
10821
  enumerable: true,
10128
- get: function () { return chunk43AB4EH4_cjs.deriveCollectionSchemaFromFormio; }
10822
+ get: function () { return chunkU6FOL6EO_cjs.deriveCollectionSchemaFromFormio; }
10129
10823
  });
10130
10824
  Object.defineProperty(exports, "deriveSubmissionTitle", {
10131
10825
  enumerable: true,
10132
- get: function () { return chunk43AB4EH4_cjs.deriveSubmissionTitle; }
10826
+ get: function () { return chunkU6FOL6EO_cjs.deriveSubmissionTitle; }
10133
10827
  });
10134
10828
  Object.defineProperty(exports, "fullCollectionSync", {
10135
10829
  enumerable: true,
10136
- get: function () { return chunk43AB4EH4_cjs.fullCollectionSync; }
10830
+ get: function () { return chunkU6FOL6EO_cjs.fullCollectionSync; }
10137
10831
  });
10138
10832
  Object.defineProperty(exports, "getAvailableCollectionNames", {
10139
10833
  enumerable: true,
10140
- get: function () { return chunk43AB4EH4_cjs.getAvailableCollectionNames; }
10834
+ get: function () { return chunkU6FOL6EO_cjs.getAvailableCollectionNames; }
10141
10835
  });
10142
10836
  Object.defineProperty(exports, "getManagedCollections", {
10143
10837
  enumerable: true,
10144
- get: function () { return chunk43AB4EH4_cjs.getManagedCollections; }
10838
+ get: function () { return chunkU6FOL6EO_cjs.getManagedCollections; }
10145
10839
  });
10146
10840
  Object.defineProperty(exports, "isCollectionManaged", {
10147
10841
  enumerable: true,
10148
- get: function () { return chunk43AB4EH4_cjs.isCollectionManaged; }
10842
+ get: function () { return chunkU6FOL6EO_cjs.isCollectionManaged; }
10149
10843
  });
10150
10844
  Object.defineProperty(exports, "loadCollectionConfig", {
10151
10845
  enumerable: true,
10152
- get: function () { return chunk43AB4EH4_cjs.loadCollectionConfig; }
10846
+ get: function () { return chunkU6FOL6EO_cjs.loadCollectionConfig; }
10153
10847
  });
10154
10848
  Object.defineProperty(exports, "loadCollectionConfigs", {
10155
10849
  enumerable: true,
10156
- get: function () { return chunk43AB4EH4_cjs.loadCollectionConfigs; }
10850
+ get: function () { return chunkU6FOL6EO_cjs.loadCollectionConfigs; }
10157
10851
  });
10158
10852
  Object.defineProperty(exports, "mapFormStatusToContentStatus", {
10159
10853
  enumerable: true,
10160
- get: function () { return chunk43AB4EH4_cjs.mapFormStatusToContentStatus; }
10854
+ get: function () { return chunkU6FOL6EO_cjs.mapFormStatusToContentStatus; }
10161
10855
  });
10162
10856
  Object.defineProperty(exports, "registerCollections", {
10163
10857
  enumerable: true,
10164
- get: function () { return chunk43AB4EH4_cjs.registerCollections; }
10858
+ get: function () { return chunkU6FOL6EO_cjs.registerCollections; }
10165
10859
  });
10166
10860
  Object.defineProperty(exports, "syncAllFormCollections", {
10167
10861
  enumerable: true,
10168
- get: function () { return chunk43AB4EH4_cjs.syncAllFormCollections; }
10862
+ get: function () { return chunkU6FOL6EO_cjs.syncAllFormCollections; }
10169
10863
  });
10170
10864
  Object.defineProperty(exports, "syncCollection", {
10171
10865
  enumerable: true,
10172
- get: function () { return chunk43AB4EH4_cjs.syncCollection; }
10866
+ get: function () { return chunkU6FOL6EO_cjs.syncCollection; }
10173
10867
  });
10174
10868
  Object.defineProperty(exports, "syncCollections", {
10175
10869
  enumerable: true,
10176
- get: function () { return chunk43AB4EH4_cjs.syncCollections; }
10870
+ get: function () { return chunkU6FOL6EO_cjs.syncCollections; }
10177
10871
  });
10178
10872
  Object.defineProperty(exports, "syncFormCollection", {
10179
10873
  enumerable: true,
10180
- get: function () { return chunk43AB4EH4_cjs.syncFormCollection; }
10874
+ get: function () { return chunkU6FOL6EO_cjs.syncFormCollection; }
10181
10875
  });
10182
10876
  Object.defineProperty(exports, "validateCollectionConfig", {
10183
10877
  enumerable: true,
10184
- get: function () { return chunk43AB4EH4_cjs.validateCollectionConfig; }
10878
+ get: function () { return chunkU6FOL6EO_cjs.validateCollectionConfig; }
10185
10879
  });
10186
10880
  Object.defineProperty(exports, "MigrationService", {
10187
10881
  enumerable: true,
10188
- get: function () { return chunkRVD7PLMU_cjs.MigrationService; }
10882
+ get: function () { return chunkHU4MN74Q_cjs.MigrationService; }
10189
10883
  });
10190
10884
  Object.defineProperty(exports, "renderFilterBar", {
10191
10885
  enumerable: true,
@@ -10253,31 +10947,31 @@ Object.defineProperty(exports, "PluginHelpers", {
10253
10947
  });
10254
10948
  Object.defineProperty(exports, "QueryFilterBuilder", {
10255
10949
  enumerable: true,
10256
- get: function () { return chunkVUISYUHY_cjs.QueryFilterBuilder; }
10950
+ get: function () { return chunkV76ERLX6_cjs.QueryFilterBuilder; }
10257
10951
  });
10258
10952
  Object.defineProperty(exports, "SONICJS_VERSION", {
10259
10953
  enumerable: true,
10260
- get: function () { return chunkVUISYUHY_cjs.SONICJS_VERSION; }
10954
+ get: function () { return chunkV76ERLX6_cjs.SONICJS_VERSION; }
10261
10955
  });
10262
10956
  Object.defineProperty(exports, "TemplateRenderer", {
10263
10957
  enumerable: true,
10264
- get: function () { return chunkVUISYUHY_cjs.TemplateRenderer; }
10958
+ get: function () { return chunkV76ERLX6_cjs.TemplateRenderer; }
10265
10959
  });
10266
10960
  Object.defineProperty(exports, "buildQuery", {
10267
10961
  enumerable: true,
10268
- get: function () { return chunkVUISYUHY_cjs.buildQuery; }
10962
+ get: function () { return chunkV76ERLX6_cjs.buildQuery; }
10269
10963
  });
10270
10964
  Object.defineProperty(exports, "getCoreVersion", {
10271
10965
  enumerable: true,
10272
- get: function () { return chunkVUISYUHY_cjs.getCoreVersion; }
10966
+ get: function () { return chunkV76ERLX6_cjs.getCoreVersion; }
10273
10967
  });
10274
10968
  Object.defineProperty(exports, "renderTemplate", {
10275
10969
  enumerable: true,
10276
- get: function () { return chunkVUISYUHY_cjs.renderTemplate; }
10970
+ get: function () { return chunkV76ERLX6_cjs.renderTemplate; }
10277
10971
  });
10278
10972
  Object.defineProperty(exports, "templateRenderer", {
10279
10973
  enumerable: true,
10280
- get: function () { return chunkVUISYUHY_cjs.templateRenderer; }
10974
+ get: function () { return chunkV76ERLX6_cjs.templateRenderer; }
10281
10975
  });
10282
10976
  Object.defineProperty(exports, "metricsTracker", {
10283
10977
  enumerable: true,