@sonicjs-cms/core 2.15.0 → 2.16.0

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 (48) hide show
  1. package/dist/{chunk-26HYU7MX.cjs → chunk-6ENX7QSA.cjs} +114 -114
  2. package/dist/{chunk-26HYU7MX.cjs.map → chunk-6ENX7QSA.cjs.map} +1 -1
  3. package/dist/{chunk-UFPT5KCQ.cjs → chunk-CZ6BVQZX.cjs} +19 -9
  4. package/dist/chunk-CZ6BVQZX.cjs.map +1 -0
  5. package/dist/{chunk-G7XSN72O.js → chunk-INSDRCG3.js} +2 -2
  6. package/dist/{chunk-G7XSN72O.js.map → chunk-INSDRCG3.js.map} +1 -1
  7. package/dist/{chunk-EWXV2KG2.js → chunk-MVSCB4E3.js} +3 -3
  8. package/dist/{chunk-EWXV2KG2.js.map → chunk-MVSCB4E3.js.map} +1 -1
  9. package/dist/{chunk-RVD7PLMU.cjs → chunk-OCLUXJ7E.cjs} +9 -2
  10. package/dist/chunk-OCLUXJ7E.cjs.map +1 -0
  11. package/dist/{chunk-43AB4EH4.cjs → chunk-Q5VFZUXV.cjs} +2 -2
  12. package/dist/{chunk-43AB4EH4.cjs.map → chunk-Q5VFZUXV.cjs.map} +1 -1
  13. package/dist/{chunk-5SOFMH66.js → chunk-VFQUULAV.js} +9 -2
  14. package/dist/chunk-VFQUULAV.js.map +1 -0
  15. package/dist/{chunk-7MMD5WMK.js → chunk-WLSIUKNM.js} +9 -9
  16. package/dist/{chunk-7MMD5WMK.js.map → chunk-WLSIUKNM.js.map} +1 -1
  17. package/dist/{chunk-2BL2A62D.js → chunk-Y5EH32F5.js} +15 -5
  18. package/dist/chunk-Y5EH32F5.js.map +1 -0
  19. package/dist/{chunk-VUISYUHY.cjs → chunk-YQW2GCJ3.cjs} +3 -3
  20. package/dist/{chunk-VUISYUHY.cjs.map → chunk-YQW2GCJ3.cjs.map} +1 -1
  21. package/dist/index.cjs +812 -134
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +690 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/middleware.cjs +29 -29
  28. package/dist/middleware.js +3 -3
  29. package/dist/migrations-7HQ7LYAL.js +4 -0
  30. package/dist/{migrations-YB52SLW7.js.map → migrations-7HQ7LYAL.js.map} +1 -1
  31. package/dist/migrations-SVQTT7NV.cjs +13 -0
  32. package/dist/{migrations-APFGYCB6.cjs.map → migrations-SVQTT7NV.cjs.map} +1 -1
  33. package/dist/routes.cjs +28 -28
  34. package/dist/routes.js +5 -5
  35. package/dist/services.cjs +23 -23
  36. package/dist/services.d.cts +1 -1
  37. package/dist/services.d.ts +1 -1
  38. package/dist/services.js +2 -2
  39. package/dist/utils.cjs +11 -11
  40. package/dist/utils.js +1 -1
  41. package/migrations/036_analytics_events.sql +22 -0
  42. package/package.json +1 -1
  43. package/dist/chunk-2BL2A62D.js.map +0 -1
  44. package/dist/chunk-5SOFMH66.js.map +0 -1
  45. package/dist/chunk-RVD7PLMU.cjs.map +0 -1
  46. package/dist/chunk-UFPT5KCQ.cjs.map +0 -1
  47. package/dist/migrations-APFGYCB6.cjs +0 -13
  48. 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 chunk6ENX7QSA_cjs = require('./chunk-6ENX7QSA.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 chunkCZ6BVQZX_cjs = require('./chunk-CZ6BVQZX.cjs');
6
+ var chunkQ5VFZUXV_cjs = require('./chunk-Q5VFZUXV.cjs');
7
+ var chunkOCLUXJ7E_cjs = require('./chunk-OCLUXJ7E.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 chunkYQW2GCJ3_cjs = require('./chunk-YQW2GCJ3.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("*", chunkCZ6BVQZX_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 chunkCZ6BVQZX_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 chunkCZ6BVQZX_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
+ chunkCZ6BVQZX_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 chunkCZ6BVQZX_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
+ chunkCZ6BVQZX_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 chunkCZ6BVQZX_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
+ chunkCZ6BVQZX_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("*", chunkCZ6BVQZX_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 chunkCZ6BVQZX_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
+ chunkCZ6BVQZX_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("*", chunkCZ6BVQZX_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 chunkQ5VFZUXV_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 chunkQ5VFZUXV_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("*", chunkCZ6BVQZX_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 chunkQ5VFZUXV_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 chunkQ5VFZUXV_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;
@@ -6992,7 +6998,7 @@ var DEFAULT_SETTINGS3 = {
6992
6998
 
6993
6999
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
6994
7000
  var adminRoutes3 = new hono.Hono();
6995
- adminRoutes3.use("*", chunkUFPT5KCQ_cjs.requireAuth());
7001
+ adminRoutes3.use("*", chunkCZ6BVQZX_cjs.requireAuth());
6996
7002
  adminRoutes3.use("*", async (c, next) => {
6997
7003
  const user = c.get("user");
6998
7004
  if (user?.role !== "admin") {
@@ -7002,7 +7008,7 @@ adminRoutes3.use("*", async (c, next) => {
7002
7008
  });
7003
7009
  async function getSettings3(db) {
7004
7010
  try {
7005
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
7011
+ const pluginService = new chunkQ5VFZUXV_cjs.PluginService(db);
7006
7012
  const plugin2 = await pluginService.getPlugin("stripe");
7007
7013
  if (plugin2?.settings) {
7008
7014
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -7324,7 +7330,7 @@ function timingSafeEqual(a, b) {
7324
7330
  var apiRoutes3 = new hono.Hono();
7325
7331
  async function getSettings4(db) {
7326
7332
  try {
7327
- const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
7333
+ const pluginService = new chunkQ5VFZUXV_cjs.PluginService(db);
7328
7334
  const plugin2 = await pluginService.getPlugin("stripe");
7329
7335
  if (plugin2?.settings) {
7330
7336
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -7475,7 +7481,7 @@ apiRoutes3.post("/webhook", async (c) => {
7475
7481
  }
7476
7482
  return c.json({ received: true });
7477
7483
  });
7478
- apiRoutes3.post("/create-checkout-session", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7484
+ apiRoutes3.post("/create-checkout-session", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7479
7485
  const db = c.env.DB;
7480
7486
  const user = c.get("user");
7481
7487
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -7515,7 +7521,7 @@ apiRoutes3.post("/create-checkout-session", chunkUFPT5KCQ_cjs.requireAuth(), asy
7515
7521
  });
7516
7522
  return c.json({ sessionId: session.id, url: session.url });
7517
7523
  });
7518
- apiRoutes3.get("/subscription", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7524
+ apiRoutes3.get("/subscription", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7519
7525
  const user = c.get("user");
7520
7526
  if (!user) return c.json({ error: "Unauthorized" }, 401);
7521
7527
  const db = c.env.DB;
@@ -7527,7 +7533,7 @@ apiRoutes3.get("/subscription", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7527
7533
  }
7528
7534
  return c.json({ subscription });
7529
7535
  });
7530
- apiRoutes3.get("/subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7536
+ apiRoutes3.get("/subscriptions", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7531
7537
  const user = c.get("user");
7532
7538
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7533
7539
  const db = c.env.DB;
@@ -7543,7 +7549,7 @@ apiRoutes3.get("/subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7543
7549
  const result = await subscriptionService.list(filters);
7544
7550
  return c.json(result);
7545
7551
  });
7546
- apiRoutes3.get("/stats", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7552
+ apiRoutes3.get("/stats", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7547
7553
  const user = c.get("user");
7548
7554
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7549
7555
  const db = c.env.DB;
@@ -7552,7 +7558,7 @@ apiRoutes3.get("/stats", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7552
7558
  const stats = await subscriptionService.getStats();
7553
7559
  return c.json(stats);
7554
7560
  });
7555
- apiRoutes3.post("/sync-subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7561
+ apiRoutes3.post("/sync-subscriptions", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7556
7562
  const user = c.get("user");
7557
7563
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7558
7564
  const db = c.env.DB;
@@ -7600,7 +7606,7 @@ apiRoutes3.post("/sync-subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c
7600
7606
  }, 500);
7601
7607
  }
7602
7608
  });
7603
- apiRoutes3.get("/events", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
7609
+ apiRoutes3.get("/events", chunkCZ6BVQZX_cjs.requireAuth(), async (c) => {
7604
7610
  const user = c.get("user");
7605
7611
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
7606
7612
  const db = c.env.DB;
@@ -7666,7 +7672,7 @@ function createStripePlugin() {
7666
7672
  var stripePlugin = createStripePlugin();
7667
7673
 
7668
7674
  // src/middleware/plugin-menu.ts
7669
- var REGISTRY_MENU_PLUGINS = Object.values(chunk43AB4EH4_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
7675
+ var REGISTRY_MENU_PLUGINS = Object.values(chunkQ5VFZUXV_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
7670
7676
  codeName: p.codeName,
7671
7677
  label: p.adminMenu.label,
7672
7678
  path: p.adminMenu.path,
@@ -7757,6 +7763,672 @@ function pluginMenuMiddleware() {
7757
7763
  };
7758
7764
  }
7759
7765
 
7766
+ // src/plugins/types.ts
7767
+ var HOOKS2 = {
7768
+ // Request lifecycle
7769
+ REQUEST_START: "request:start",
7770
+ REQUEST_END: "request:end",
7771
+ USER_LOGIN: "user:login"};
7772
+ chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
7773
+ var adminRoutes4 = new hono.Hono();
7774
+ adminRoutes4.use("*", chunkCZ6BVQZX_cjs.requireAuth());
7775
+ adminRoutes4.use("*", async (c, next) => {
7776
+ const user = c.get("user");
7777
+ if (user?.role !== "admin") {
7778
+ return c.text("Access denied", 403);
7779
+ }
7780
+ return next();
7781
+ });
7782
+ adminRoutes4.get("/", async (c) => {
7783
+ const user = c.get("user");
7784
+ const db = c.env.DB;
7785
+ let totalRequests = 0;
7786
+ let uniqueIPs = 0;
7787
+ let avgDuration = 0;
7788
+ let errorCount = 0;
7789
+ let topPages = [];
7790
+ let recentActivity = [];
7791
+ try {
7792
+ const now = Math.floor(Date.now() / 1e3);
7793
+ const dayAgo = now - 86400;
7794
+ const [requestsResult, ipsResult, durationResult, errorsResult, pagesResult, activityResult] = await Promise.all([
7795
+ db.prepare("SELECT COUNT(*) as count FROM system_logs WHERE category = ? AND created_at > ?").bind("api", dayAgo).first(),
7796
+ db.prepare("SELECT COUNT(DISTINCT ip_address) as count FROM system_logs WHERE category = ? AND created_at > ?").bind("api", dayAgo).first(),
7797
+ db.prepare("SELECT AVG(duration) as avg FROM system_logs WHERE category = ? AND created_at > ? AND duration IS NOT NULL").bind("api", dayAgo).first(),
7798
+ db.prepare("SELECT COUNT(*) as count FROM system_logs WHERE level IN (?, ?) AND created_at > ?").bind("error", "fatal", dayAgo).first(),
7799
+ 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(),
7800
+ 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()
7801
+ ]);
7802
+ totalRequests = requestsResult?.count || 0;
7803
+ uniqueIPs = ipsResult?.count || 0;
7804
+ avgDuration = Math.round(durationResult?.avg || 0);
7805
+ errorCount = errorsResult?.count || 0;
7806
+ topPages = (pagesResult.results || []).map((r) => ({ path: r.url, views: r.views }));
7807
+ recentActivity = activityResult.results || [];
7808
+ } catch {
7809
+ }
7810
+ const content2 = `
7811
+ <div class="space-y-8">
7812
+ <div>
7813
+ <h1 class="text-2xl font-semibold text-zinc-950 dark:text-white">Analytics Dashboard</h1>
7814
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Last 24 hours overview from system logs</p>
7815
+ </div>
7816
+
7817
+ <!-- Stats Cards -->
7818
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
7819
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7820
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Total Requests</p>
7821
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${totalRequests.toLocaleString()}</p>
7822
+ </div>
7823
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7824
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Unique Visitors</p>
7825
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${uniqueIPs.toLocaleString()}</p>
7826
+ </div>
7827
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7828
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Avg Response Time</p>
7829
+ <p class="mt-2 text-3xl font-semibold text-zinc-950 dark:text-white">${avgDuration}ms</p>
7830
+ </div>
7831
+ <div class="rounded-lg bg-white dark:bg-zinc-800 p-6 ring-1 ring-zinc-950/5 dark:ring-white/10">
7832
+ <p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Errors</p>
7833
+ <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>
7834
+ </div>
7835
+ </div>
7836
+
7837
+ <!-- Top Pages -->
7838
+ <div class="rounded-lg bg-white dark:bg-zinc-800 ring-1 ring-zinc-950/5 dark:ring-white/10">
7839
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10">
7840
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">Top Pages</h2>
7841
+ </div>
7842
+ <div class="divide-y divide-zinc-950/5 dark:divide-white/10">
7843
+ ${topPages.length > 0 ? topPages.map((p) => `
7844
+ <div class="flex items-center justify-between px-6 py-3">
7845
+ <span class="text-sm text-zinc-700 dark:text-zinc-300 font-mono truncate">${escapeHtml3(p.path)}</span>
7846
+ <span class="text-sm font-medium text-zinc-500 dark:text-zinc-400">${p.views}</span>
7847
+ </div>
7848
+ `).join("") : `
7849
+ <div class="px-6 py-8 text-center text-sm text-zinc-500 dark:text-zinc-400">
7850
+ No page views recorded yet. Analytics data will appear once requests are logged.
7851
+ </div>
7852
+ `}
7853
+ </div>
7854
+ </div>
7855
+
7856
+ <!-- Recent Activity -->
7857
+ <div class="rounded-lg bg-white dark:bg-zinc-800 ring-1 ring-zinc-950/5 dark:ring-white/10">
7858
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10">
7859
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">Recent Activity</h2>
7860
+ </div>
7861
+ <div class="overflow-x-auto">
7862
+ <table class="w-full text-sm">
7863
+ <thead class="bg-zinc-50 dark:bg-zinc-800/50">
7864
+ <tr>
7865
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Path</th>
7866
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Method</th>
7867
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Status</th>
7868
+ <th class="px-6 py-2 text-left font-medium text-zinc-500 dark:text-zinc-400">Duration</th>
7869
+ </tr>
7870
+ </thead>
7871
+ <tbody class="divide-y divide-zinc-950/5 dark:divide-white/10">
7872
+ ${recentActivity.length > 0 ? recentActivity.map((a) => `
7873
+ <tr>
7874
+ <td class="px-6 py-2 font-mono text-zinc-700 dark:text-zinc-300 truncate max-w-xs">${escapeHtml3(a.url || "")}</td>
7875
+ <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>
7876
+ <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>
7877
+ <td class="px-6 py-2 text-zinc-500 dark:text-zinc-400">${a.duration || 0}ms</td>
7878
+ </tr>
7879
+ `).join("") : `
7880
+ <tr>
7881
+ <td colspan="4" class="px-6 py-8 text-center text-zinc-500 dark:text-zinc-400">No activity recorded yet.</td>
7882
+ </tr>
7883
+ `}
7884
+ </tbody>
7885
+ </table>
7886
+ </div>
7887
+ </div>
7888
+ </div>
7889
+ `;
7890
+ return c.html(chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst({
7891
+ title: "Analytics",
7892
+ pageTitle: "Analytics Dashboard",
7893
+ currentPath: "/admin/analytics",
7894
+ version: c.get("appVersion"),
7895
+ user: user ? {
7896
+ name: user.email.split("@")[0] || "Admin",
7897
+ email: user.email,
7898
+ role: user.role
7899
+ } : void 0,
7900
+ content: content2,
7901
+ dynamicMenuItems: c.get("pluginMenuItems")
7902
+ }));
7903
+ });
7904
+ function escapeHtml3(str) {
7905
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7906
+ }
7907
+
7908
+ // src/plugins/core-plugins/analytics/index.ts
7909
+ function createAnalyticsPlugin() {
7910
+ const builder = chunk635JAMSE_cjs.PluginBuilder.create({
7911
+ name: "core-analytics",
7912
+ version: "1.0.0-beta.1",
7913
+ description: "Core analytics tracking and reporting plugin"
7914
+ });
7915
+ builder.metadata({
7916
+ author: {
7917
+ name: "SonicJS Team",
7918
+ email: "team@sonicjs.com"
7919
+ },
7920
+ license: "MIT",
7921
+ compatibility: "^0.1.0",
7922
+ dependencies: ["core-auth"]
7923
+ // Requires auth for admin access
7924
+ });
7925
+ const analyticsAPI = new hono.Hono();
7926
+ analyticsAPI.get("/stats", async (c) => {
7927
+ const timeRange = c.req.query("range") || "7d";
7928
+ c.req.query("metric") || "all";
7929
+ return c.json({
7930
+ message: "Analytics stats",
7931
+ data: {
7932
+ pageviews: 12500,
7933
+ uniqueVisitors: 3200,
7934
+ sessions: 4800,
7935
+ avgSessionDuration: 245,
7936
+ bounceRate: 0.35,
7937
+ topPages: [
7938
+ { path: "/", views: 3200 },
7939
+ { path: "/about", views: 1800 },
7940
+ { path: "/contact", views: 950 }
7941
+ ],
7942
+ timeRange
7943
+ }
7944
+ });
7945
+ });
7946
+ analyticsAPI.post("/track", async (c) => {
7947
+ const event = await c.req.json();
7948
+ console.info("Analytics event tracked:", event);
7949
+ return c.json({
7950
+ message: "Event tracked successfully",
7951
+ eventId: `event-${Date.now()}`
7952
+ });
7953
+ });
7954
+ analyticsAPI.get("/reports", async (c) => {
7955
+ const reportType = c.req.query("type") || "traffic";
7956
+ const startDate = c.req.query("start");
7957
+ const endDate = c.req.query("end");
7958
+ return c.json({
7959
+ message: "Analytics report",
7960
+ data: {
7961
+ reportType,
7962
+ dateRange: { start: startDate, end: endDate },
7963
+ data: []
7964
+ }
7965
+ });
7966
+ });
7967
+ analyticsAPI.get("/realtime", async (c) => {
7968
+ return c.json({
7969
+ message: "Real-time analytics",
7970
+ data: {
7971
+ activeUsers: 23,
7972
+ activePages: [
7973
+ { path: "/", users: 8 },
7974
+ { path: "/blog", users: 5 },
7975
+ { path: "/products", users: 4 }
7976
+ ],
7977
+ recentEvents: []
7978
+ }
7979
+ });
7980
+ });
7981
+ builder.addRoute("/api/analytics", analyticsAPI, {
7982
+ description: "Analytics tracking and reporting API",
7983
+ requiresAuth: true,
7984
+ roles: ["admin", "analytics:read"],
7985
+ priority: 3
7986
+ });
7987
+ builder.addRoute("/admin/analytics", adminRoutes4, {
7988
+ description: "Analytics admin dashboard",
7989
+ requiresAuth: true,
7990
+ priority: 50
7991
+ });
7992
+ builder.addSingleMiddleware("analytics-tracker", async (c, next) => {
7993
+ const start = Date.now();
7994
+ const path = c.req.path;
7995
+ const method = c.req.method;
7996
+ const userAgent = c.req.header("user-agent");
7997
+ const referer = c.req.header("referer");
7998
+ const ip = c.req.header("CF-Connecting-IP") || c.req.header("x-forwarded-for");
7999
+ await next();
8000
+ const duration = Date.now() - start;
8001
+ const status = c.res.status;
8002
+ const analyticsData = {
8003
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8004
+ path,
8005
+ method,
8006
+ status,
8007
+ duration,
8008
+ userAgent,
8009
+ referer,
8010
+ ip,
8011
+ responseSize: c.res.headers.get("content-length") || 0
8012
+ };
8013
+ console.debug("Analytics tracking:", analyticsData);
8014
+ }, {
8015
+ description: "Track page views and request analytics",
8016
+ global: true,
8017
+ priority: 99
8018
+ // Run last to capture response data
8019
+ });
8020
+ builder.addService("analyticsService", {
8021
+ trackEvent: async (event) => {
8022
+ console.info("Tracking event:", event);
8023
+ return { eventId: `event-${Date.now()}` };
8024
+ },
8025
+ trackPageView: async (data) => {
8026
+ console.info("Tracking pageview:", data.path);
8027
+ return { viewId: `view-${Date.now()}` };
8028
+ },
8029
+ getStats: async (_timeRange) => {
8030
+ return {
8031
+ pageviews: 12500,
8032
+ sessions: 4800,
8033
+ uniqueVisitors: 3200
8034
+ };
8035
+ },
8036
+ generateReport: async (type, options) => {
8037
+ console.info(`Generating ${type} report with options:`, options);
8038
+ return { reportId: `report-${Date.now()}` };
8039
+ }
8040
+ }, {
8041
+ description: "Core analytics tracking service",
8042
+ singleton: true
8043
+ });
8044
+ const pageViewSchema = chunk635JAMSE_cjs.PluginHelpers.createSchema([
8045
+ { name: "path", type: "string", optional: false },
8046
+ { name: "title", type: "string", optional: true },
8047
+ { name: "referrer", type: "string", optional: true },
8048
+ { name: "userAgent", type: "string", optional: true },
8049
+ { name: "ipAddress", type: "string", optional: true },
8050
+ { name: "sessionId", type: "string", optional: true },
8051
+ { name: "userId", type: "number", optional: true },
8052
+ { name: "duration", type: "number", optional: true }
8053
+ ]);
8054
+ const eventSchema = chunk635JAMSE_cjs.PluginHelpers.createSchema([
8055
+ { name: "eventType", type: "string", optional: false },
8056
+ { name: "eventName", type: "string", optional: false },
8057
+ { name: "eventData", type: "object", optional: true },
8058
+ { name: "path", type: "string", optional: true },
8059
+ { name: "sessionId", type: "string", optional: true },
8060
+ { name: "userId", type: "number", optional: true }
8061
+ ]);
8062
+ const pageViewMigration = chunk635JAMSE_cjs.PluginHelpers.createMigration("analytics_pageviews", [
8063
+ { name: "id", type: "INTEGER", primaryKey: true },
8064
+ { name: "path", type: "TEXT", nullable: false },
8065
+ { name: "title", type: "TEXT", nullable: true },
8066
+ { name: "referrer", type: "TEXT", nullable: true },
8067
+ { name: "user_agent", type: "TEXT", nullable: true },
8068
+ { name: "ip_address", type: "TEXT", nullable: true },
8069
+ { name: "session_id", type: "TEXT", nullable: true },
8070
+ { name: "user_id", type: "INTEGER", nullable: true },
8071
+ { name: "duration", type: "INTEGER", nullable: true }
8072
+ ]);
8073
+ const eventMigration = chunk635JAMSE_cjs.PluginHelpers.createMigration("analytics_events", [
8074
+ { name: "id", type: "INTEGER", primaryKey: true },
8075
+ { name: "event_type", type: "TEXT", nullable: false },
8076
+ { name: "event_name", type: "TEXT", nullable: false },
8077
+ { name: "event_data", type: "TEXT", nullable: true },
8078
+ { name: "path", type: "TEXT", nullable: true },
8079
+ { name: "session_id", type: "TEXT", nullable: true },
8080
+ { name: "user_id", type: "INTEGER", nullable: true }
8081
+ ]);
8082
+ builder.addModel("PageView", {
8083
+ tableName: "analytics_pageviews",
8084
+ schema: pageViewSchema,
8085
+ migrations: [pageViewMigration]
8086
+ });
8087
+ builder.addModel("AnalyticsEvent", {
8088
+ tableName: "analytics_events",
8089
+ schema: eventSchema,
8090
+ migrations: [eventMigration]
8091
+ });
8092
+ builder.addHook(HOOKS2.REQUEST_START, async (data, _context) => {
8093
+ data.analytics = {
8094
+ startTime: Date.now(),
8095
+ sessionId: `session-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
8096
+ };
8097
+ return data;
8098
+ }, {
8099
+ priority: 1,
8100
+ description: "Initialize analytics tracking for requests"
8101
+ });
8102
+ builder.addHook(HOOKS2.REQUEST_END, async (data, _context) => {
8103
+ if (data.analytics) {
8104
+ const duration = Date.now() - data.analytics.startTime;
8105
+ console.debug(`Request completed in ${duration}ms`);
8106
+ }
8107
+ return data;
8108
+ }, {
8109
+ priority: 1,
8110
+ description: "Complete analytics tracking for requests"
8111
+ });
8112
+ builder.addHook(HOOKS2.USER_LOGIN, async (data, context) => {
8113
+ await context.services?.analyticsService?.trackEvent({
8114
+ eventType: "auth",
8115
+ eventName: "user_login",
8116
+ userId: data.userId,
8117
+ eventData: { loginMethod: data.method }
8118
+ });
8119
+ return data;
8120
+ }, {
8121
+ priority: 8,
8122
+ description: "Track user login events"
8123
+ });
8124
+ builder.addHook("content:view", async (data, context) => {
8125
+ await context.services?.analyticsService?.trackEvent({
8126
+ eventType: "content",
8127
+ eventName: "content_view",
8128
+ eventData: {
8129
+ contentId: data.id,
8130
+ contentType: data.type,
8131
+ title: data.title
8132
+ }
8133
+ });
8134
+ return data;
8135
+ }, {
8136
+ priority: 8,
8137
+ description: "Track content view events"
8138
+ });
8139
+ builder.addAdminPage(
8140
+ "/analytics",
8141
+ "Analytics Dashboard",
8142
+ "AnalyticsDashboardView",
8143
+ {
8144
+ description: "View analytics overview and key metrics",
8145
+ permissions: ["admin", "analytics:read"],
8146
+ icon: "chart-bar"
8147
+ }
8148
+ );
8149
+ builder.addAdminPage(
8150
+ "/analytics/reports",
8151
+ "Analytics Reports",
8152
+ "AnalyticsReportsView",
8153
+ {
8154
+ description: "Generate and view detailed analytics reports",
8155
+ permissions: ["admin", "analytics:read"],
8156
+ icon: "document-report"
8157
+ }
8158
+ );
8159
+ builder.addAdminPage(
8160
+ "/analytics/realtime",
8161
+ "Real-time Analytics",
8162
+ "AnalyticsRealtimeView",
8163
+ {
8164
+ description: "View real-time visitor activity",
8165
+ permissions: ["admin", "analytics:read"],
8166
+ icon: "lightning-bolt"
8167
+ }
8168
+ );
8169
+ builder.addAdminPage(
8170
+ "/analytics/settings",
8171
+ "Analytics Settings",
8172
+ "AnalyticsSettingsView",
8173
+ {
8174
+ description: "Configure analytics tracking and data collection",
8175
+ permissions: ["admin", "analytics:configure"],
8176
+ icon: "cog"
8177
+ }
8178
+ );
8179
+ builder.addMenuItem("Analytics", "/admin/analytics", {
8180
+ icon: "chart-bar",
8181
+ order: 40,
8182
+ permissions: ["admin", "analytics:read"]
8183
+ });
8184
+ builder.addMenuItem("Dashboard", "/admin/analytics", {
8185
+ icon: "chart-bar",
8186
+ parent: "Analytics",
8187
+ order: 1,
8188
+ permissions: ["admin", "analytics:read"]
8189
+ });
8190
+ builder.addMenuItem("Reports", "/admin/analytics/reports", {
8191
+ icon: "document-report",
8192
+ parent: "Analytics",
8193
+ order: 2,
8194
+ permissions: ["admin", "analytics:read"]
8195
+ });
8196
+ builder.addMenuItem("Real-time", "/admin/analytics/realtime", {
8197
+ icon: "lightning-bolt",
8198
+ parent: "Analytics",
8199
+ order: 3,
8200
+ permissions: ["admin", "analytics:read"]
8201
+ });
8202
+ builder.addMenuItem("Settings", "/admin/analytics/settings", {
8203
+ icon: "cog",
8204
+ parent: "Analytics",
8205
+ order: 4,
8206
+ permissions: ["admin", "analytics:configure"]
8207
+ });
8208
+ builder.lifecycle({
8209
+ install: async () => {
8210
+ console.info("Installing analytics plugin...");
8211
+ },
8212
+ activate: async () => {
8213
+ console.info("Activating analytics plugin...");
8214
+ },
8215
+ deactivate: async () => {
8216
+ console.info("Deactivating analytics plugin...");
8217
+ },
8218
+ configure: async (config) => {
8219
+ console.info("Configuring analytics plugin...", config);
8220
+ }
8221
+ });
8222
+ return builder.build();
8223
+ }
8224
+ var analyticsPlugin = createAnalyticsPlugin();
8225
+
8226
+ // src/plugins/core-plugins/analytics/services/event-tracking-service.ts
8227
+ var EventTrackingService = class {
8228
+ constructor(db) {
8229
+ this.db = db;
8230
+ }
8231
+ async trackEvent(input) {
8232
+ const id = crypto.randomUUID();
8233
+ const category = input.category || "user-activity";
8234
+ await this.db.prepare(`
8235
+ INSERT INTO analytics_events (id, event, category, properties, user_id, session_id, ip_address, user_agent, path)
8236
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
8237
+ `).bind(
8238
+ id,
8239
+ input.event,
8240
+ category,
8241
+ input.properties ? JSON.stringify(input.properties) : null,
8242
+ input.userId || null,
8243
+ input.sessionId || null,
8244
+ input.ipAddress || null,
8245
+ input.userAgent || null,
8246
+ input.path || null
8247
+ ).run();
8248
+ return id;
8249
+ }
8250
+ async trackBatch(events) {
8251
+ const ids = [];
8252
+ const stmts = events.map((input) => {
8253
+ const id = crypto.randomUUID();
8254
+ ids.push(id);
8255
+ const category = input.category || "user-activity";
8256
+ return this.db.prepare(`
8257
+ INSERT INTO analytics_events (id, event, category, properties, user_id, session_id, ip_address, user_agent, path)
8258
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
8259
+ `).bind(
8260
+ id,
8261
+ input.event,
8262
+ category,
8263
+ input.properties ? JSON.stringify(input.properties) : null,
8264
+ input.userId || null,
8265
+ input.sessionId || null,
8266
+ input.ipAddress || null,
8267
+ input.userAgent || null,
8268
+ input.path || null
8269
+ );
8270
+ });
8271
+ await this.db.batch(stmts);
8272
+ return ids;
8273
+ }
8274
+ async queryEvents(filters = {}) {
8275
+ const conditions = [];
8276
+ const params = [];
8277
+ if (filters.event) {
8278
+ conditions.push("event = ?");
8279
+ params.push(filters.event);
8280
+ }
8281
+ if (filters.category) {
8282
+ conditions.push("category = ?");
8283
+ params.push(filters.category);
8284
+ }
8285
+ if (filters.userId) {
8286
+ conditions.push("user_id = ?");
8287
+ params.push(filters.userId);
8288
+ }
8289
+ if (filters.sessionId) {
8290
+ conditions.push("session_id = ?");
8291
+ params.push(filters.sessionId);
8292
+ }
8293
+ if (filters.startDate) {
8294
+ conditions.push("created_at >= ?");
8295
+ params.push(filters.startDate);
8296
+ }
8297
+ if (filters.endDate) {
8298
+ conditions.push("created_at <= ?");
8299
+ params.push(filters.endDate);
8300
+ }
8301
+ const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
8302
+ const limit = filters.limit || 50;
8303
+ const offset = filters.offset || 0;
8304
+ const [countResult, eventsResult] = await Promise.all([
8305
+ this.db.prepare(`SELECT COUNT(*) as total FROM analytics_events ${where}`).bind(...params).first(),
8306
+ this.db.prepare(`SELECT * FROM analytics_events ${where} ORDER BY created_at DESC LIMIT ? OFFSET ?`).bind(...params, limit, offset).all()
8307
+ ]);
8308
+ const events = (eventsResult.results || []).map((e) => ({
8309
+ ...e,
8310
+ properties: e.properties ? JSON.parse(e.properties) : null
8311
+ }));
8312
+ return { events, total: countResult?.total || 0 };
8313
+ }
8314
+ async getStats(startDate, endDate) {
8315
+ const conditions = [];
8316
+ const params = [];
8317
+ if (startDate) {
8318
+ conditions.push("created_at >= ?");
8319
+ params.push(startDate);
8320
+ }
8321
+ if (endDate) {
8322
+ conditions.push("created_at <= ?");
8323
+ params.push(endDate);
8324
+ }
8325
+ const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
8326
+ const [totals, topEvents] = await Promise.all([
8327
+ this.db.prepare(`
8328
+ SELECT
8329
+ COUNT(*) as total_events,
8330
+ COUNT(DISTINCT user_id) as unique_users,
8331
+ COUNT(DISTINCT session_id) as unique_sessions
8332
+ FROM analytics_events ${where}
8333
+ `).bind(...params).first(),
8334
+ this.db.prepare(`
8335
+ SELECT event, COUNT(*) as count
8336
+ FROM analytics_events ${where}
8337
+ GROUP BY event ORDER BY count DESC LIMIT 20
8338
+ `).bind(...params).all()
8339
+ ]);
8340
+ return {
8341
+ totalEvents: totals?.total_events || 0,
8342
+ uniqueUsers: totals?.unique_users || 0,
8343
+ uniqueSessions: totals?.unique_sessions || 0,
8344
+ topEvents: (topEvents.results || []).map((r) => ({ event: r.event, count: r.count }))
8345
+ };
8346
+ }
8347
+ };
8348
+
8349
+ // src/plugins/core-plugins/analytics/routes/api.ts
8350
+ var apiRoutes4 = new hono.Hono();
8351
+ apiRoutes4.post("/", async (c) => {
8352
+ const db = c.env.DB;
8353
+ const service = new EventTrackingService(db);
8354
+ const ip = c.req.header("cf-connecting-ip") || c.req.header("x-forwarded-for")?.split(",")[0]?.trim() || "unknown";
8355
+ const userAgent = c.req.header("user-agent") || "";
8356
+ const user = c.get("user");
8357
+ let body;
8358
+ try {
8359
+ body = await c.req.json();
8360
+ } catch {
8361
+ return c.json({ error: "Invalid JSON body" }, 400);
8362
+ }
8363
+ if (Array.isArray(body)) {
8364
+ if (body.length > 100) {
8365
+ return c.json({ error: "Batch size limit is 100 events" }, 400);
8366
+ }
8367
+ const events = body.map((e) => ({
8368
+ event: e.event,
8369
+ category: e.category || "user-activity",
8370
+ properties: e.properties,
8371
+ userId: user?.userId || e.userId,
8372
+ sessionId: e.sessionId,
8373
+ ipAddress: ip,
8374
+ userAgent,
8375
+ path: e.path
8376
+ }));
8377
+ const invalid = events.find((e) => !e.event || typeof e.event !== "string");
8378
+ if (invalid) {
8379
+ return c.json({ error: 'Each event must have an "event" string field' }, 400);
8380
+ }
8381
+ const ids = await service.trackBatch(events);
8382
+ return c.json({ success: true, eventIds: ids, count: ids.length });
8383
+ }
8384
+ if (!body.event || typeof body.event !== "string") {
8385
+ return c.json({ error: '"event" field is required and must be a string' }, 400);
8386
+ }
8387
+ const eventId = await service.trackEvent({
8388
+ event: body.event,
8389
+ category: body.category || "user-activity",
8390
+ properties: body.properties,
8391
+ userId: user?.userId || body.userId,
8392
+ sessionId: body.sessionId,
8393
+ ipAddress: ip,
8394
+ userAgent,
8395
+ path: body.path
8396
+ });
8397
+ return c.json({ success: true, eventId });
8398
+ });
8399
+ apiRoutes4.get("/", async (c) => {
8400
+ const user = c.get("user");
8401
+ if (!user || user.role !== "admin") {
8402
+ return c.json({ error: "Admin access required" }, 403);
8403
+ }
8404
+ const db = c.env.DB;
8405
+ const service = new EventTrackingService(db);
8406
+ const filters = {
8407
+ event: c.req.query("event") || void 0,
8408
+ category: c.req.query("category") || void 0,
8409
+ userId: c.req.query("userId") || void 0,
8410
+ sessionId: c.req.query("sessionId") || void 0,
8411
+ startDate: c.req.query("startDate") ? parseInt(c.req.query("startDate")) : void 0,
8412
+ endDate: c.req.query("endDate") ? parseInt(c.req.query("endDate")) : void 0,
8413
+ limit: c.req.query("limit") ? parseInt(c.req.query("limit")) : 50,
8414
+ offset: c.req.query("offset") ? parseInt(c.req.query("offset")) : 0
8415
+ };
8416
+ const result = await service.queryEvents(filters);
8417
+ return c.json(result);
8418
+ });
8419
+ apiRoutes4.get("/stats", async (c) => {
8420
+ const user = c.get("user");
8421
+ if (!user || user.role !== "admin") {
8422
+ return c.json({ error: "Admin access required" }, 403);
8423
+ }
8424
+ const db = c.env.DB;
8425
+ const service = new EventTrackingService(db);
8426
+ const startDate = c.req.query("startDate") ? parseInt(c.req.query("startDate")) : void 0;
8427
+ const endDate = c.req.query("endDate") ? parseInt(c.req.query("endDate")) : void 0;
8428
+ const stats = await service.getStats(startDate, endDate);
8429
+ return c.json(stats);
8430
+ });
8431
+
7760
8432
  // src/plugins/cache/services/cache-config.ts
7761
8433
  var CACHE_CONFIGS = {
7762
8434
  // Content (high read, low write)
@@ -8898,7 +9570,7 @@ function renderCacheDashboard(data) {
8898
9570
  </script>
8899
9571
 
8900
9572
  <!-- Confirmation Dialogs -->
8901
- ${chunk26HYU7MX_cjs.renderConfirmationDialog({
9573
+ ${chunk6ENX7QSA_cjs.renderConfirmationDialog({
8902
9574
  id: "clear-all-cache-confirm",
8903
9575
  title: "Clear All Cache",
8904
9576
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -8909,7 +9581,7 @@ function renderCacheDashboard(data) {
8909
9581
  onConfirm: "performClearAllCaches()"
8910
9582
  })}
8911
9583
 
8912
- ${chunk26HYU7MX_cjs.renderConfirmationDialog({
9584
+ ${chunk6ENX7QSA_cjs.renderConfirmationDialog({
8913
9585
  id: "clear-namespace-cache-confirm",
8914
9586
  title: "Clear Namespace Cache",
8915
9587
  message: "Clear cache for this namespace?",
@@ -8920,7 +9592,7 @@ function renderCacheDashboard(data) {
8920
9592
  onConfirm: "performClearNamespaceCache()"
8921
9593
  })}
8922
9594
 
8923
- ${chunk26HYU7MX_cjs.getConfirmationDialogScript()}
9595
+ ${chunk6ENX7QSA_cjs.getConfirmationDialogScript()}
8924
9596
  `;
8925
9597
  const layoutData = {
8926
9598
  title: "Cache System",
@@ -9606,14 +10278,14 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
9606
10278
  // src/app.ts
9607
10279
  function createSonicJSApp(config = {}) {
9608
10280
  const app2 = new hono.Hono();
9609
- const appVersion = config.version || chunkVUISYUHY_cjs.getCoreVersion();
10281
+ const appVersion = config.version || chunkYQW2GCJ3_cjs.getCoreVersion();
9610
10282
  const appName = config.name || "SonicJS AI";
9611
10283
  app2.use("*", async (c, next) => {
9612
10284
  c.set("appVersion", appVersion);
9613
10285
  await next();
9614
10286
  });
9615
- app2.use("*", chunkUFPT5KCQ_cjs.metricsMiddleware());
9616
- app2.use("*", chunkUFPT5KCQ_cjs.bootstrapMiddleware(config));
10287
+ app2.use("*", chunkCZ6BVQZX_cjs.metricsMiddleware());
10288
+ app2.use("*", chunkCZ6BVQZX_cjs.bootstrapMiddleware(config));
9617
10289
  if (config.middleware?.beforeAuth) {
9618
10290
  for (const middleware of config.middleware.beforeAuth) {
9619
10291
  app2.use("*", middleware);
@@ -9622,29 +10294,29 @@ function createSonicJSApp(config = {}) {
9622
10294
  app2.use("*", async (_c, next) => {
9623
10295
  await next();
9624
10296
  });
9625
- app2.use("*", chunkUFPT5KCQ_cjs.securityHeadersMiddleware());
9626
- app2.use("*", chunkUFPT5KCQ_cjs.csrfProtection());
10297
+ app2.use("*", chunkCZ6BVQZX_cjs.securityHeadersMiddleware());
10298
+ app2.use("*", chunkCZ6BVQZX_cjs.csrfProtection());
9627
10299
  if (config.middleware?.afterAuth) {
9628
10300
  for (const middleware of config.middleware.afterAuth) {
9629
10301
  app2.use("*", middleware);
9630
10302
  }
9631
10303
  }
9632
10304
  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);
10305
+ app2.route("/api", chunk6ENX7QSA_cjs.api_default);
10306
+ app2.route("/api/media", chunk6ENX7QSA_cjs.api_media_default);
10307
+ app2.route("/api/system", chunk6ENX7QSA_cjs.api_system_default);
10308
+ app2.route("/admin/api", chunk6ENX7QSA_cjs.admin_api_default);
10309
+ app2.route("/admin/dashboard", chunk6ENX7QSA_cjs.router);
10310
+ app2.route("/admin/collections", chunk6ENX7QSA_cjs.adminCollectionsRoutes);
10311
+ app2.route("/admin/forms", chunk6ENX7QSA_cjs.adminFormsRoutes);
10312
+ app2.route("/admin/settings", chunk6ENX7QSA_cjs.adminSettingsRoutes);
10313
+ app2.route("/forms", chunk6ENX7QSA_cjs.public_forms_default);
10314
+ app2.route("/api/forms", chunk6ENX7QSA_cjs.public_forms_default);
10315
+ app2.route("/admin/api-reference", chunk6ENX7QSA_cjs.router2);
9644
10316
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
9645
10317
  app2.route("/admin/seed-data", createSeedDataAdminRoutes());
9646
- app2.route("/admin/content", chunk26HYU7MX_cjs.admin_content_default);
9647
- app2.route("/admin/media", chunk26HYU7MX_cjs.adminMediaRoutes);
10318
+ app2.route("/admin/content", chunk6ENX7QSA_cjs.admin_content_default);
10319
+ app2.route("/admin/media", chunk6ENX7QSA_cjs.adminMediaRoutes);
9648
10320
  app2.use("/auth/*", securityAuditMiddleware());
9649
10321
  if (securityAuditPlugin.routes && securityAuditPlugin.routes.length > 0) {
9650
10322
  for (const route of securityAuditPlugin.routes) {
@@ -9662,8 +10334,8 @@ function createSonicJSApp(config = {}) {
9662
10334
  app2.route(route.path, route.handler);
9663
10335
  }
9664
10336
  }
9665
- if (chunk26HYU7MX_cjs.userProfilesPlugin.routes && chunk26HYU7MX_cjs.userProfilesPlugin.routes.length > 0) {
9666
- for (const route of chunk26HYU7MX_cjs.userProfilesPlugin.routes) {
10337
+ if (chunk6ENX7QSA_cjs.userProfilesPlugin.routes && chunk6ENX7QSA_cjs.userProfilesPlugin.routes.length > 0) {
10338
+ for (const route of chunk6ENX7QSA_cjs.userProfilesPlugin.routes) {
9667
10339
  app2.route(route.path, route.handler);
9668
10340
  }
9669
10341
  }
@@ -9672,16 +10344,22 @@ function createSonicJSApp(config = {}) {
9672
10344
  app2.route(route.path, route.handler);
9673
10345
  }
9674
10346
  }
10347
+ if (analyticsPlugin.routes && analyticsPlugin.routes.length > 0) {
10348
+ for (const route of analyticsPlugin.routes) {
10349
+ app2.route(route.path, route.handler);
10350
+ }
10351
+ }
10352
+ app2.route("/api/events", apiRoutes4);
9675
10353
  if (stripePlugin.routes && stripePlugin.routes.length > 0) {
9676
10354
  for (const route of stripePlugin.routes) {
9677
10355
  app2.route(route.path, route.handler);
9678
10356
  }
9679
10357
  }
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);
10358
+ app2.route("/admin/plugins", chunk6ENX7QSA_cjs.adminPluginRoutes);
10359
+ app2.route("/admin/logs", chunk6ENX7QSA_cjs.adminLogsRoutes);
10360
+ app2.route("/admin", chunk6ENX7QSA_cjs.userRoutes);
10361
+ app2.route("/auth", chunk6ENX7QSA_cjs.auth_default);
10362
+ app2.route("/", chunk6ENX7QSA_cjs.test_cleanup_default);
9685
10363
  if (emailPlugin.routes && emailPlugin.routes.length > 0) {
9686
10364
  for (const route of emailPlugin.routes) {
9687
10365
  app2.route(route.path, route.handler);
@@ -9765,99 +10443,99 @@ function createDb(d1$1) {
9765
10443
  }
9766
10444
 
9767
10445
  // src/index.ts
9768
- var VERSION = chunkVUISYUHY_cjs.package_default.version;
10446
+ var VERSION = chunkYQW2GCJ3_cjs.package_default.version;
9769
10447
 
9770
10448
  Object.defineProperty(exports, "ROUTES_INFO", {
9771
10449
  enumerable: true,
9772
- get: function () { return chunk26HYU7MX_cjs.ROUTES_INFO; }
10450
+ get: function () { return chunk6ENX7QSA_cjs.ROUTES_INFO; }
9773
10451
  });
9774
10452
  Object.defineProperty(exports, "adminApiRoutes", {
9775
10453
  enumerable: true,
9776
- get: function () { return chunk26HYU7MX_cjs.admin_api_default; }
10454
+ get: function () { return chunk6ENX7QSA_cjs.admin_api_default; }
9777
10455
  });
9778
10456
  Object.defineProperty(exports, "adminCheckboxRoutes", {
9779
10457
  enumerable: true,
9780
- get: function () { return chunk26HYU7MX_cjs.adminCheckboxRoutes; }
10458
+ get: function () { return chunk6ENX7QSA_cjs.adminCheckboxRoutes; }
9781
10459
  });
9782
10460
  Object.defineProperty(exports, "adminCodeExamplesRoutes", {
9783
10461
  enumerable: true,
9784
- get: function () { return chunk26HYU7MX_cjs.admin_code_examples_default; }
10462
+ get: function () { return chunk6ENX7QSA_cjs.admin_code_examples_default; }
9785
10463
  });
9786
10464
  Object.defineProperty(exports, "adminCollectionsRoutes", {
9787
10465
  enumerable: true,
9788
- get: function () { return chunk26HYU7MX_cjs.adminCollectionsRoutes; }
10466
+ get: function () { return chunk6ENX7QSA_cjs.adminCollectionsRoutes; }
9789
10467
  });
9790
10468
  Object.defineProperty(exports, "adminContentRoutes", {
9791
10469
  enumerable: true,
9792
- get: function () { return chunk26HYU7MX_cjs.admin_content_default; }
10470
+ get: function () { return chunk6ENX7QSA_cjs.admin_content_default; }
9793
10471
  });
9794
10472
  Object.defineProperty(exports, "adminDashboardRoutes", {
9795
10473
  enumerable: true,
9796
- get: function () { return chunk26HYU7MX_cjs.router; }
10474
+ get: function () { return chunk6ENX7QSA_cjs.router; }
9797
10475
  });
9798
10476
  Object.defineProperty(exports, "adminDesignRoutes", {
9799
10477
  enumerable: true,
9800
- get: function () { return chunk26HYU7MX_cjs.adminDesignRoutes; }
10478
+ get: function () { return chunk6ENX7QSA_cjs.adminDesignRoutes; }
9801
10479
  });
9802
10480
  Object.defineProperty(exports, "adminLogsRoutes", {
9803
10481
  enumerable: true,
9804
- get: function () { return chunk26HYU7MX_cjs.adminLogsRoutes; }
10482
+ get: function () { return chunk6ENX7QSA_cjs.adminLogsRoutes; }
9805
10483
  });
9806
10484
  Object.defineProperty(exports, "adminMediaRoutes", {
9807
10485
  enumerable: true,
9808
- get: function () { return chunk26HYU7MX_cjs.adminMediaRoutes; }
10486
+ get: function () { return chunk6ENX7QSA_cjs.adminMediaRoutes; }
9809
10487
  });
9810
10488
  Object.defineProperty(exports, "adminPluginRoutes", {
9811
10489
  enumerable: true,
9812
- get: function () { return chunk26HYU7MX_cjs.adminPluginRoutes; }
10490
+ get: function () { return chunk6ENX7QSA_cjs.adminPluginRoutes; }
9813
10491
  });
9814
10492
  Object.defineProperty(exports, "adminSettingsRoutes", {
9815
10493
  enumerable: true,
9816
- get: function () { return chunk26HYU7MX_cjs.adminSettingsRoutes; }
10494
+ get: function () { return chunk6ENX7QSA_cjs.adminSettingsRoutes; }
9817
10495
  });
9818
10496
  Object.defineProperty(exports, "adminTestimonialsRoutes", {
9819
10497
  enumerable: true,
9820
- get: function () { return chunk26HYU7MX_cjs.admin_testimonials_default; }
10498
+ get: function () { return chunk6ENX7QSA_cjs.admin_testimonials_default; }
9821
10499
  });
9822
10500
  Object.defineProperty(exports, "adminUsersRoutes", {
9823
10501
  enumerable: true,
9824
- get: function () { return chunk26HYU7MX_cjs.userRoutes; }
10502
+ get: function () { return chunk6ENX7QSA_cjs.userRoutes; }
9825
10503
  });
9826
10504
  Object.defineProperty(exports, "apiContentCrudRoutes", {
9827
10505
  enumerable: true,
9828
- get: function () { return chunk26HYU7MX_cjs.api_content_crud_default; }
10506
+ get: function () { return chunk6ENX7QSA_cjs.api_content_crud_default; }
9829
10507
  });
9830
10508
  Object.defineProperty(exports, "apiMediaRoutes", {
9831
10509
  enumerable: true,
9832
- get: function () { return chunk26HYU7MX_cjs.api_media_default; }
10510
+ get: function () { return chunk6ENX7QSA_cjs.api_media_default; }
9833
10511
  });
9834
10512
  Object.defineProperty(exports, "apiRoutes", {
9835
10513
  enumerable: true,
9836
- get: function () { return chunk26HYU7MX_cjs.api_default; }
10514
+ get: function () { return chunk6ENX7QSA_cjs.api_default; }
9837
10515
  });
9838
10516
  Object.defineProperty(exports, "apiSystemRoutes", {
9839
10517
  enumerable: true,
9840
- get: function () { return chunk26HYU7MX_cjs.api_system_default; }
10518
+ get: function () { return chunk6ENX7QSA_cjs.api_system_default; }
9841
10519
  });
9842
10520
  Object.defineProperty(exports, "authRoutes", {
9843
10521
  enumerable: true,
9844
- get: function () { return chunk26HYU7MX_cjs.auth_default; }
10522
+ get: function () { return chunk6ENX7QSA_cjs.auth_default; }
9845
10523
  });
9846
10524
  Object.defineProperty(exports, "createUserProfilesPlugin", {
9847
10525
  enumerable: true,
9848
- get: function () { return chunk26HYU7MX_cjs.createUserProfilesPlugin; }
10526
+ get: function () { return chunk6ENX7QSA_cjs.createUserProfilesPlugin; }
9849
10527
  });
9850
10528
  Object.defineProperty(exports, "defineUserProfile", {
9851
10529
  enumerable: true,
9852
- get: function () { return chunk26HYU7MX_cjs.defineUserProfile; }
10530
+ get: function () { return chunk6ENX7QSA_cjs.defineUserProfile; }
9853
10531
  });
9854
10532
  Object.defineProperty(exports, "getUserProfileConfig", {
9855
10533
  enumerable: true,
9856
- get: function () { return chunk26HYU7MX_cjs.getUserProfileConfig; }
10534
+ get: function () { return chunk6ENX7QSA_cjs.getUserProfileConfig; }
9857
10535
  });
9858
10536
  Object.defineProperty(exports, "userProfilesPlugin", {
9859
10537
  enumerable: true,
9860
- get: function () { return chunk26HYU7MX_cjs.userProfilesPlugin; }
10538
+ get: function () { return chunk6ENX7QSA_cjs.userProfilesPlugin; }
9861
10539
  });
9862
10540
  Object.defineProperty(exports, "Logger", {
9863
10541
  enumerable: true,
@@ -10025,167 +10703,167 @@ Object.defineProperty(exports, "workflowHistory", {
10025
10703
  });
10026
10704
  Object.defineProperty(exports, "AuthManager", {
10027
10705
  enumerable: true,
10028
- get: function () { return chunkUFPT5KCQ_cjs.AuthManager; }
10706
+ get: function () { return chunkCZ6BVQZX_cjs.AuthManager; }
10029
10707
  });
10030
10708
  Object.defineProperty(exports, "PermissionManager", {
10031
10709
  enumerable: true,
10032
- get: function () { return chunkUFPT5KCQ_cjs.PermissionManager; }
10710
+ get: function () { return chunkCZ6BVQZX_cjs.PermissionManager; }
10033
10711
  });
10034
10712
  Object.defineProperty(exports, "bootstrapMiddleware", {
10035
10713
  enumerable: true,
10036
- get: function () { return chunkUFPT5KCQ_cjs.bootstrapMiddleware; }
10714
+ get: function () { return chunkCZ6BVQZX_cjs.bootstrapMiddleware; }
10037
10715
  });
10038
10716
  Object.defineProperty(exports, "cacheHeaders", {
10039
10717
  enumerable: true,
10040
- get: function () { return chunkUFPT5KCQ_cjs.cacheHeaders; }
10718
+ get: function () { return chunkCZ6BVQZX_cjs.cacheHeaders; }
10041
10719
  });
10042
10720
  Object.defineProperty(exports, "compressionMiddleware", {
10043
10721
  enumerable: true,
10044
- get: function () { return chunkUFPT5KCQ_cjs.compressionMiddleware; }
10722
+ get: function () { return chunkCZ6BVQZX_cjs.compressionMiddleware; }
10045
10723
  });
10046
10724
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
10047
10725
  enumerable: true,
10048
- get: function () { return chunkUFPT5KCQ_cjs.detailedLoggingMiddleware; }
10726
+ get: function () { return chunkCZ6BVQZX_cjs.detailedLoggingMiddleware; }
10049
10727
  });
10050
10728
  Object.defineProperty(exports, "getActivePlugins", {
10051
10729
  enumerable: true,
10052
- get: function () { return chunkUFPT5KCQ_cjs.getActivePlugins; }
10730
+ get: function () { return chunkCZ6BVQZX_cjs.getActivePlugins; }
10053
10731
  });
10054
10732
  Object.defineProperty(exports, "isPluginActive", {
10055
10733
  enumerable: true,
10056
- get: function () { return chunkUFPT5KCQ_cjs.isPluginActive; }
10734
+ get: function () { return chunkCZ6BVQZX_cjs.isPluginActive; }
10057
10735
  });
10058
10736
  Object.defineProperty(exports, "logActivity", {
10059
10737
  enumerable: true,
10060
- get: function () { return chunkUFPT5KCQ_cjs.logActivity; }
10738
+ get: function () { return chunkCZ6BVQZX_cjs.logActivity; }
10061
10739
  });
10062
10740
  Object.defineProperty(exports, "loggingMiddleware", {
10063
10741
  enumerable: true,
10064
- get: function () { return chunkUFPT5KCQ_cjs.loggingMiddleware; }
10742
+ get: function () { return chunkCZ6BVQZX_cjs.loggingMiddleware; }
10065
10743
  });
10066
10744
  Object.defineProperty(exports, "optionalAuth", {
10067
10745
  enumerable: true,
10068
- get: function () { return chunkUFPT5KCQ_cjs.optionalAuth; }
10746
+ get: function () { return chunkCZ6BVQZX_cjs.optionalAuth; }
10069
10747
  });
10070
10748
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
10071
10749
  enumerable: true,
10072
- get: function () { return chunkUFPT5KCQ_cjs.performanceLoggingMiddleware; }
10750
+ get: function () { return chunkCZ6BVQZX_cjs.performanceLoggingMiddleware; }
10073
10751
  });
10074
10752
  Object.defineProperty(exports, "requireActivePlugin", {
10075
10753
  enumerable: true,
10076
- get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugin; }
10754
+ get: function () { return chunkCZ6BVQZX_cjs.requireActivePlugin; }
10077
10755
  });
10078
10756
  Object.defineProperty(exports, "requireActivePlugins", {
10079
10757
  enumerable: true,
10080
- get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugins; }
10758
+ get: function () { return chunkCZ6BVQZX_cjs.requireActivePlugins; }
10081
10759
  });
10082
10760
  Object.defineProperty(exports, "requireAnyPermission", {
10083
10761
  enumerable: true,
10084
- get: function () { return chunkUFPT5KCQ_cjs.requireAnyPermission; }
10762
+ get: function () { return chunkCZ6BVQZX_cjs.requireAnyPermission; }
10085
10763
  });
10086
10764
  Object.defineProperty(exports, "requireAuth", {
10087
10765
  enumerable: true,
10088
- get: function () { return chunkUFPT5KCQ_cjs.requireAuth; }
10766
+ get: function () { return chunkCZ6BVQZX_cjs.requireAuth; }
10089
10767
  });
10090
10768
  Object.defineProperty(exports, "requirePermission", {
10091
10769
  enumerable: true,
10092
- get: function () { return chunkUFPT5KCQ_cjs.requirePermission; }
10770
+ get: function () { return chunkCZ6BVQZX_cjs.requirePermission; }
10093
10771
  });
10094
10772
  Object.defineProperty(exports, "requireRole", {
10095
10773
  enumerable: true,
10096
- get: function () { return chunkUFPT5KCQ_cjs.requireRole; }
10774
+ get: function () { return chunkCZ6BVQZX_cjs.requireRole; }
10097
10775
  });
10098
10776
  Object.defineProperty(exports, "securityHeaders", {
10099
10777
  enumerable: true,
10100
- get: function () { return chunkUFPT5KCQ_cjs.securityHeadersMiddleware; }
10778
+ get: function () { return chunkCZ6BVQZX_cjs.securityHeadersMiddleware; }
10101
10779
  });
10102
10780
  Object.defineProperty(exports, "securityLoggingMiddleware", {
10103
10781
  enumerable: true,
10104
- get: function () { return chunkUFPT5KCQ_cjs.securityLoggingMiddleware; }
10782
+ get: function () { return chunkCZ6BVQZX_cjs.securityLoggingMiddleware; }
10105
10783
  });
10106
10784
  Object.defineProperty(exports, "PluginBootstrapService", {
10107
10785
  enumerable: true,
10108
- get: function () { return chunk43AB4EH4_cjs.PluginBootstrapService; }
10786
+ get: function () { return chunkQ5VFZUXV_cjs.PluginBootstrapService; }
10109
10787
  });
10110
10788
  Object.defineProperty(exports, "PluginServiceClass", {
10111
10789
  enumerable: true,
10112
- get: function () { return chunk43AB4EH4_cjs.PluginService; }
10790
+ get: function () { return chunkQ5VFZUXV_cjs.PluginService; }
10113
10791
  });
10114
10792
  Object.defineProperty(exports, "backfillFormSubmissions", {
10115
10793
  enumerable: true,
10116
- get: function () { return chunk43AB4EH4_cjs.backfillFormSubmissions; }
10794
+ get: function () { return chunkQ5VFZUXV_cjs.backfillFormSubmissions; }
10117
10795
  });
10118
10796
  Object.defineProperty(exports, "cleanupRemovedCollections", {
10119
10797
  enumerable: true,
10120
- get: function () { return chunk43AB4EH4_cjs.cleanupRemovedCollections; }
10798
+ get: function () { return chunkQ5VFZUXV_cjs.cleanupRemovedCollections; }
10121
10799
  });
10122
10800
  Object.defineProperty(exports, "createContentFromSubmission", {
10123
10801
  enumerable: true,
10124
- get: function () { return chunk43AB4EH4_cjs.createContentFromSubmission; }
10802
+ get: function () { return chunkQ5VFZUXV_cjs.createContentFromSubmission; }
10125
10803
  });
10126
10804
  Object.defineProperty(exports, "deriveCollectionSchemaFromFormio", {
10127
10805
  enumerable: true,
10128
- get: function () { return chunk43AB4EH4_cjs.deriveCollectionSchemaFromFormio; }
10806
+ get: function () { return chunkQ5VFZUXV_cjs.deriveCollectionSchemaFromFormio; }
10129
10807
  });
10130
10808
  Object.defineProperty(exports, "deriveSubmissionTitle", {
10131
10809
  enumerable: true,
10132
- get: function () { return chunk43AB4EH4_cjs.deriveSubmissionTitle; }
10810
+ get: function () { return chunkQ5VFZUXV_cjs.deriveSubmissionTitle; }
10133
10811
  });
10134
10812
  Object.defineProperty(exports, "fullCollectionSync", {
10135
10813
  enumerable: true,
10136
- get: function () { return chunk43AB4EH4_cjs.fullCollectionSync; }
10814
+ get: function () { return chunkQ5VFZUXV_cjs.fullCollectionSync; }
10137
10815
  });
10138
10816
  Object.defineProperty(exports, "getAvailableCollectionNames", {
10139
10817
  enumerable: true,
10140
- get: function () { return chunk43AB4EH4_cjs.getAvailableCollectionNames; }
10818
+ get: function () { return chunkQ5VFZUXV_cjs.getAvailableCollectionNames; }
10141
10819
  });
10142
10820
  Object.defineProperty(exports, "getManagedCollections", {
10143
10821
  enumerable: true,
10144
- get: function () { return chunk43AB4EH4_cjs.getManagedCollections; }
10822
+ get: function () { return chunkQ5VFZUXV_cjs.getManagedCollections; }
10145
10823
  });
10146
10824
  Object.defineProperty(exports, "isCollectionManaged", {
10147
10825
  enumerable: true,
10148
- get: function () { return chunk43AB4EH4_cjs.isCollectionManaged; }
10826
+ get: function () { return chunkQ5VFZUXV_cjs.isCollectionManaged; }
10149
10827
  });
10150
10828
  Object.defineProperty(exports, "loadCollectionConfig", {
10151
10829
  enumerable: true,
10152
- get: function () { return chunk43AB4EH4_cjs.loadCollectionConfig; }
10830
+ get: function () { return chunkQ5VFZUXV_cjs.loadCollectionConfig; }
10153
10831
  });
10154
10832
  Object.defineProperty(exports, "loadCollectionConfigs", {
10155
10833
  enumerable: true,
10156
- get: function () { return chunk43AB4EH4_cjs.loadCollectionConfigs; }
10834
+ get: function () { return chunkQ5VFZUXV_cjs.loadCollectionConfigs; }
10157
10835
  });
10158
10836
  Object.defineProperty(exports, "mapFormStatusToContentStatus", {
10159
10837
  enumerable: true,
10160
- get: function () { return chunk43AB4EH4_cjs.mapFormStatusToContentStatus; }
10838
+ get: function () { return chunkQ5VFZUXV_cjs.mapFormStatusToContentStatus; }
10161
10839
  });
10162
10840
  Object.defineProperty(exports, "registerCollections", {
10163
10841
  enumerable: true,
10164
- get: function () { return chunk43AB4EH4_cjs.registerCollections; }
10842
+ get: function () { return chunkQ5VFZUXV_cjs.registerCollections; }
10165
10843
  });
10166
10844
  Object.defineProperty(exports, "syncAllFormCollections", {
10167
10845
  enumerable: true,
10168
- get: function () { return chunk43AB4EH4_cjs.syncAllFormCollections; }
10846
+ get: function () { return chunkQ5VFZUXV_cjs.syncAllFormCollections; }
10169
10847
  });
10170
10848
  Object.defineProperty(exports, "syncCollection", {
10171
10849
  enumerable: true,
10172
- get: function () { return chunk43AB4EH4_cjs.syncCollection; }
10850
+ get: function () { return chunkQ5VFZUXV_cjs.syncCollection; }
10173
10851
  });
10174
10852
  Object.defineProperty(exports, "syncCollections", {
10175
10853
  enumerable: true,
10176
- get: function () { return chunk43AB4EH4_cjs.syncCollections; }
10854
+ get: function () { return chunkQ5VFZUXV_cjs.syncCollections; }
10177
10855
  });
10178
10856
  Object.defineProperty(exports, "syncFormCollection", {
10179
10857
  enumerable: true,
10180
- get: function () { return chunk43AB4EH4_cjs.syncFormCollection; }
10858
+ get: function () { return chunkQ5VFZUXV_cjs.syncFormCollection; }
10181
10859
  });
10182
10860
  Object.defineProperty(exports, "validateCollectionConfig", {
10183
10861
  enumerable: true,
10184
- get: function () { return chunk43AB4EH4_cjs.validateCollectionConfig; }
10862
+ get: function () { return chunkQ5VFZUXV_cjs.validateCollectionConfig; }
10185
10863
  });
10186
10864
  Object.defineProperty(exports, "MigrationService", {
10187
10865
  enumerable: true,
10188
- get: function () { return chunkRVD7PLMU_cjs.MigrationService; }
10866
+ get: function () { return chunkOCLUXJ7E_cjs.MigrationService; }
10189
10867
  });
10190
10868
  Object.defineProperty(exports, "renderFilterBar", {
10191
10869
  enumerable: true,
@@ -10253,31 +10931,31 @@ Object.defineProperty(exports, "PluginHelpers", {
10253
10931
  });
10254
10932
  Object.defineProperty(exports, "QueryFilterBuilder", {
10255
10933
  enumerable: true,
10256
- get: function () { return chunkVUISYUHY_cjs.QueryFilterBuilder; }
10934
+ get: function () { return chunkYQW2GCJ3_cjs.QueryFilterBuilder; }
10257
10935
  });
10258
10936
  Object.defineProperty(exports, "SONICJS_VERSION", {
10259
10937
  enumerable: true,
10260
- get: function () { return chunkVUISYUHY_cjs.SONICJS_VERSION; }
10938
+ get: function () { return chunkYQW2GCJ3_cjs.SONICJS_VERSION; }
10261
10939
  });
10262
10940
  Object.defineProperty(exports, "TemplateRenderer", {
10263
10941
  enumerable: true,
10264
- get: function () { return chunkVUISYUHY_cjs.TemplateRenderer; }
10942
+ get: function () { return chunkYQW2GCJ3_cjs.TemplateRenderer; }
10265
10943
  });
10266
10944
  Object.defineProperty(exports, "buildQuery", {
10267
10945
  enumerable: true,
10268
- get: function () { return chunkVUISYUHY_cjs.buildQuery; }
10946
+ get: function () { return chunkYQW2GCJ3_cjs.buildQuery; }
10269
10947
  });
10270
10948
  Object.defineProperty(exports, "getCoreVersion", {
10271
10949
  enumerable: true,
10272
- get: function () { return chunkVUISYUHY_cjs.getCoreVersion; }
10950
+ get: function () { return chunkYQW2GCJ3_cjs.getCoreVersion; }
10273
10951
  });
10274
10952
  Object.defineProperty(exports, "renderTemplate", {
10275
10953
  enumerable: true,
10276
- get: function () { return chunkVUISYUHY_cjs.renderTemplate; }
10954
+ get: function () { return chunkYQW2GCJ3_cjs.renderTemplate; }
10277
10955
  });
10278
10956
  Object.defineProperty(exports, "templateRenderer", {
10279
10957
  enumerable: true,
10280
- get: function () { return chunkVUISYUHY_cjs.templateRenderer; }
10958
+ get: function () { return chunkYQW2GCJ3_cjs.templateRenderer; }
10281
10959
  });
10282
10960
  Object.defineProperty(exports, "metricsTracker", {
10283
10961
  enumerable: true,