@sonicjs-cms/core 3.0.0-beta.2 → 3.0.0-beta.21

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 (170) hide show
  1. package/README.md +48 -49
  2. package/dist/admin-documents-form.template-DDSH6ROU.js +6 -0
  3. package/dist/{admin-documents-form.template-NLSI6Z42.js.map → admin-documents-form.template-DDSH6ROU.js.map} +1 -1
  4. package/dist/admin-documents-form.template-LSZKGA5J.cjs +19 -0
  5. package/dist/{admin-layout-catalyst.template-WHJGSWWD.js.map → admin-documents-form.template-LSZKGA5J.cjs.map} +1 -1
  6. package/dist/{filter-bar.template-DlVYMk-T.d.ts → admin-layout-catalyst.template-DrwDUfsE.d.cts} +25 -1
  7. package/dist/{filter-bar.template-DlVYMk-T.d.cts → admin-layout-catalyst.template-DrwDUfsE.d.ts} +25 -1
  8. package/dist/admin-layout-catalyst.template-KDHKVLXR.cjs +21 -0
  9. package/dist/{admin-layout-catalyst.template-ZK5HD545.cjs.map → admin-layout-catalyst.template-KDHKVLXR.cjs.map} +1 -1
  10. package/dist/admin-layout-catalyst.template-YQ4EMF2J.js +7 -0
  11. package/dist/{admin-documents-form.template-KN7JF66Q.cjs.map → admin-layout-catalyst.template-YQ4EMF2J.js.map} +1 -1
  12. package/dist/{app-Bo0X1OWX.d.ts → app-01M0dIwt.d.ts} +1 -1
  13. package/dist/{app-Do66yCcV.d.cts → app-aj39TGHB.d.cts} +1 -1
  14. package/dist/{chunk-ZEZ245PW.js → chunk-2XAQTPAE.js} +4 -236
  15. package/dist/chunk-2XAQTPAE.js.map +1 -0
  16. package/dist/{chunk-BDDABDAB.cjs → chunk-36Z3AKX3.cjs} +3 -239
  17. package/dist/chunk-36Z3AKX3.cjs.map +1 -0
  18. package/dist/{chunk-BLMTL57B.js → chunk-3TMTYJAJ.js} +26 -4
  19. package/dist/chunk-3TMTYJAJ.js.map +1 -0
  20. package/dist/{chunk-ZGGXCFR6.js → chunk-4LVVMVQI.js} +282 -4
  21. package/dist/chunk-4LVVMVQI.js.map +1 -0
  22. package/dist/{chunk-RZ6H7OZK.js → chunk-4UYJPHSV.js} +87 -12
  23. package/dist/chunk-4UYJPHSV.js.map +1 -0
  24. package/dist/{chunk-NLJVSER2.js → chunk-5U75XP74.js} +3 -2
  25. package/dist/chunk-5U75XP74.js.map +1 -0
  26. package/dist/{chunk-H2AXVCLS.cjs → chunk-5UXU3LP4.cjs} +141 -74
  27. package/dist/chunk-5UXU3LP4.cjs.map +1 -0
  28. package/dist/{chunk-3TB6AT6X.js → chunk-5V62WT6M.js} +35 -4
  29. package/dist/chunk-5V62WT6M.js.map +1 -0
  30. package/dist/{chunk-6OUHGKFD.js → chunk-7OTOXWEB.js} +3 -3
  31. package/dist/{chunk-6OUHGKFD.js.map → chunk-7OTOXWEB.js.map} +1 -1
  32. package/dist/{chunk-VXE42MYF.cjs → chunk-7RUW244J.cjs} +710 -434
  33. package/dist/chunk-7RUW244J.cjs.map +1 -0
  34. package/dist/{chunk-XW56B23A.cjs → chunk-A4KUJ3LD.cjs} +4 -4
  35. package/dist/{chunk-XW56B23A.cjs.map → chunk-A4KUJ3LD.cjs.map} +1 -1
  36. package/dist/{chunk-LRZIAW7U.cjs → chunk-AOUVUF32.cjs} +3 -3
  37. package/dist/chunk-AOUVUF32.cjs.map +1 -0
  38. package/dist/{chunk-WULONYGB.cjs → chunk-CRGUD4KC.cjs} +9 -9
  39. package/dist/{chunk-WULONYGB.cjs.map → chunk-CRGUD4KC.cjs.map} +1 -1
  40. package/dist/{chunk-AAWNRBRB.cjs → chunk-FCLKX2OS.cjs} +95 -20
  41. package/dist/chunk-FCLKX2OS.cjs.map +1 -0
  42. package/dist/{chunk-YHSQVQXX.js → chunk-GICS5AIO.js} +135 -68
  43. package/dist/chunk-GICS5AIO.js.map +1 -0
  44. package/dist/{chunk-NUKJ54GA.cjs → chunk-GMMCCIQO.cjs} +6 -6
  45. package/dist/{chunk-NUKJ54GA.cjs.map → chunk-GMMCCIQO.cjs.map} +1 -1
  46. package/dist/{chunk-NMPEMSU4.js → chunk-JEX3UPZL.js} +3 -3
  47. package/dist/chunk-JEX3UPZL.js.map +1 -0
  48. package/dist/{chunk-6JQOUUOB.js → chunk-JQISFW6U.js} +3 -3
  49. package/dist/{chunk-6JQOUUOB.js.map → chunk-JQISFW6U.js.map} +1 -1
  50. package/dist/{chunk-NAVPFIG5.cjs → chunk-K623Q6WD.cjs} +35 -3
  51. package/dist/chunk-K623Q6WD.cjs.map +1 -0
  52. package/dist/{chunk-JEQ7FLOD.cjs → chunk-KIGVVO6N.cjs} +16 -10
  53. package/dist/chunk-KIGVVO6N.cjs.map +1 -0
  54. package/dist/{chunk-QAYFOER6.cjs → chunk-KVBHB7QP.cjs} +285 -3
  55. package/dist/chunk-KVBHB7QP.cjs.map +1 -0
  56. package/dist/{chunk-2CB4KY7I.cjs → chunk-LTZ5WYOK.cjs} +29 -7
  57. package/dist/chunk-LTZ5WYOK.cjs.map +1 -0
  58. package/dist/{chunk-DNQCEKUK.cjs → chunk-N32OWET6.cjs} +5 -5
  59. package/dist/{chunk-DNQCEKUK.cjs.map → chunk-N32OWET6.cjs.map} +1 -1
  60. package/dist/{chunk-HDWE5FRJ.js → chunk-OBA2RYZN.js} +3 -3
  61. package/dist/{chunk-HDWE5FRJ.js.map → chunk-OBA2RYZN.js.map} +1 -1
  62. package/dist/{chunk-DSA4UX5B.cjs → chunk-OJC4G5JE.cjs} +3 -2
  63. package/dist/chunk-OJC4G5JE.cjs.map +1 -0
  64. package/dist/{chunk-MVIZJOO5.cjs → chunk-PXNTCCPE.cjs} +8 -8
  65. package/dist/{chunk-MVIZJOO5.cjs.map → chunk-PXNTCCPE.cjs.map} +1 -1
  66. package/dist/{chunk-EF2NQUIQ.js → chunk-RMRJGMDE.js} +3 -3
  67. package/dist/{chunk-EF2NQUIQ.js.map → chunk-RMRJGMDE.js.map} +1 -1
  68. package/dist/{chunk-IVPRUGTY.js → chunk-SOZUG52O.js} +4 -4
  69. package/dist/{chunk-IVPRUGTY.js.map → chunk-SOZUG52O.js.map} +1 -1
  70. package/dist/{chunk-GCDZZNIN.js → chunk-UWUP2VMT.js} +16 -10
  71. package/dist/chunk-UWUP2VMT.js.map +1 -0
  72. package/dist/{chunk-IESEVHXL.js → chunk-VVYVFCML.js} +12 -3
  73. package/dist/chunk-VVYVFCML.js.map +1 -0
  74. package/dist/{chunk-HIKBY7MS.cjs → chunk-XWVDSM2L.cjs} +12 -3
  75. package/dist/chunk-XWVDSM2L.cjs.map +1 -0
  76. package/dist/{chunk-VD2EA3WT.js → chunk-ZP77LTN4.js} +343 -68
  77. package/dist/chunk-ZP77LTN4.js.map +1 -0
  78. package/dist/{collection-config-JgHOpFCG.d.ts → collection-config-BTzAvKt2.d.cts} +25 -0
  79. package/dist/{collection-config-JgHOpFCG.d.cts → collection-config-BTzAvKt2.d.ts} +25 -0
  80. package/dist/config-6FB2BXMP.js +6 -0
  81. package/dist/{config-HFXANXCC.js.map → config-6FB2BXMP.js.map} +1 -1
  82. package/dist/config-OCH7S4WK.cjs +19 -0
  83. package/dist/{config-ON6FNMYX.cjs.map → config-OCH7S4WK.cjs.map} +1 -1
  84. package/dist/{define-plugin-BzNHc1ZI.d.ts → define-plugin-BYIey6sp.d.ts} +1 -1
  85. package/dist/{define-plugin-IWDKYaVm.d.cts → define-plugin-DsKiGu1q.d.cts} +1 -1
  86. package/dist/document-projection-4HG75S5S.js +4 -0
  87. package/dist/{document-projection-YYMC6I4U.js.map → document-projection-4HG75S5S.js.map} +1 -1
  88. package/dist/document-projection-JQHSTSFD.cjs +13 -0
  89. package/dist/{document-projection-TDWRJX3Z.cjs.map → document-projection-JQHSTSFD.cjs.map} +1 -1
  90. package/dist/index.cjs +1119 -440
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.d.cts +200 -12
  93. package/dist/index.d.ts +200 -12
  94. package/dist/index.js +803 -137
  95. package/dist/index.js.map +1 -1
  96. package/dist/middleware.cjs +37 -34
  97. package/dist/middleware.d.cts +2 -2
  98. package/dist/middleware.d.ts +2 -2
  99. package/dist/middleware.js +8 -5
  100. package/dist/migrations-HMX5SPN2.js +4 -0
  101. package/dist/{migrations-WCAVBD7C.js.map → migrations-HMX5SPN2.js.map} +1 -1
  102. package/dist/migrations-V73ARYV5.cjs +13 -0
  103. package/dist/{migrations-NJJWQUKK.cjs.map → migrations-V73ARYV5.cjs.map} +1 -1
  104. package/dist/{plugin-bootstrap-B8ThJU21.d.cts → plugin-bootstrap-BHWQ2df8.d.cts} +1 -1
  105. package/dist/{plugin-bootstrap-qu8hJgUt.d.ts → plugin-bootstrap-Bj4fxX1q.d.ts} +1 -1
  106. package/dist/plugins.cjs +40 -40
  107. package/dist/plugins.d.cts +2 -2
  108. package/dist/plugins.d.ts +2 -2
  109. package/dist/plugins.js +3 -3
  110. package/dist/rbac-7QZ4JZ2E.cjs +14 -0
  111. package/dist/{rbac-VONLJJKB.cjs.map → rbac-7QZ4JZ2E.cjs.map} +1 -1
  112. package/dist/rbac-Y43IEQOP.js +5 -0
  113. package/dist/{rbac-O73MFKDA.js.map → rbac-Y43IEQOP.js.map} +1 -1
  114. package/dist/routes.cjs +34 -34
  115. package/dist/routes.d.cts +2 -2
  116. package/dist/routes.d.ts +2 -2
  117. package/dist/routes.js +14 -14
  118. package/dist/services.cjs +42 -42
  119. package/dist/services.d.cts +16 -3
  120. package/dist/services.d.ts +16 -3
  121. package/dist/services.js +3 -3
  122. package/dist/{telemetry-B9vIV4wh.d.cts → telemetry-Cku1ax74.d.cts} +1 -1
  123. package/dist/{telemetry-B9vIV4wh.d.ts → telemetry-Cku1ax74.d.ts} +1 -1
  124. package/dist/templates.cjs +17 -17
  125. package/dist/templates.d.cts +2 -24
  126. package/dist/templates.d.ts +2 -24
  127. package/dist/templates.js +3 -3
  128. package/dist/{types-Dea1eNxU.d.ts → types-DT7XN5TX.d.cts} +1 -1
  129. package/dist/{types-Dea1eNxU.d.cts → types-DT7XN5TX.d.ts} +1 -1
  130. package/dist/types.d.cts +2 -2
  131. package/dist/types.d.ts +2 -2
  132. package/dist/utils.cjs +8 -8
  133. package/dist/utils.d.cts +2 -2
  134. package/dist/utils.d.ts +2 -2
  135. package/dist/utils.js +2 -2
  136. package/package.json +1 -1
  137. package/dist/admin-documents-form.template-KN7JF66Q.cjs +0 -19
  138. package/dist/admin-documents-form.template-NLSI6Z42.js +0 -6
  139. package/dist/admin-layout-catalyst.template-WHJGSWWD.js +0 -7
  140. package/dist/admin-layout-catalyst.template-ZK5HD545.cjs +0 -17
  141. package/dist/chunk-2CB4KY7I.cjs.map +0 -1
  142. package/dist/chunk-3TB6AT6X.js.map +0 -1
  143. package/dist/chunk-AAWNRBRB.cjs.map +0 -1
  144. package/dist/chunk-BDDABDAB.cjs.map +0 -1
  145. package/dist/chunk-BLMTL57B.js.map +0 -1
  146. package/dist/chunk-DSA4UX5B.cjs.map +0 -1
  147. package/dist/chunk-GCDZZNIN.js.map +0 -1
  148. package/dist/chunk-H2AXVCLS.cjs.map +0 -1
  149. package/dist/chunk-HIKBY7MS.cjs.map +0 -1
  150. package/dist/chunk-IESEVHXL.js.map +0 -1
  151. package/dist/chunk-JEQ7FLOD.cjs.map +0 -1
  152. package/dist/chunk-LRZIAW7U.cjs.map +0 -1
  153. package/dist/chunk-NAVPFIG5.cjs.map +0 -1
  154. package/dist/chunk-NLJVSER2.js.map +0 -1
  155. package/dist/chunk-NMPEMSU4.js.map +0 -1
  156. package/dist/chunk-QAYFOER6.cjs.map +0 -1
  157. package/dist/chunk-RZ6H7OZK.js.map +0 -1
  158. package/dist/chunk-VD2EA3WT.js.map +0 -1
  159. package/dist/chunk-VXE42MYF.cjs.map +0 -1
  160. package/dist/chunk-YHSQVQXX.js.map +0 -1
  161. package/dist/chunk-ZEZ245PW.js.map +0 -1
  162. package/dist/chunk-ZGGXCFR6.js.map +0 -1
  163. package/dist/config-HFXANXCC.js +0 -6
  164. package/dist/config-ON6FNMYX.cjs +0 -19
  165. package/dist/document-projection-TDWRJX3Z.cjs +0 -13
  166. package/dist/document-projection-YYMC6I4U.js +0 -4
  167. package/dist/migrations-NJJWQUKK.cjs +0 -13
  168. package/dist/migrations-WCAVBD7C.js +0 -4
  169. package/dist/rbac-O73MFKDA.js +0 -5
  170. package/dist/rbac-VONLJJKB.cjs +0 -14
@@ -1,3 +1,4 @@
1
+ import { getTelemetryConfig, sanitizeErrorMessage, sanitizeRoute, generateInstallationId, generateProjectId } from './chunk-X7ZAEI5S.js';
1
2
  import { escapeHtml } from './chunk-TQABQWOP.js';
2
3
  import { getCookie } from 'hono/cookie';
3
4
 
@@ -423,6 +424,7 @@ var PluginService = class {
423
424
  constructor(db) {
424
425
  this.db = db;
425
426
  }
427
+ db;
426
428
  async getAllPlugins() {
427
429
  const { results } = await this.db.prepare(`
428
430
  SELECT * FROM documents
@@ -768,6 +770,31 @@ var PLUGIN_REGISTRY = {
768
770
  "order": 50
769
771
  }
770
772
  },
773
+ "api-keys": {
774
+ "id": "api-keys",
775
+ "codeName": "api-keys",
776
+ "displayName": "API Keys",
777
+ "description": "Programmatic API access keys for headless / server-to-server REST access. Long-lived per-user secrets, hashed at rest, managed from an admin page.",
778
+ "version": "1.0.0-beta.1",
779
+ "author": "SonicJS Team",
780
+ "category": "security",
781
+ "iconEmoji": "\u{1F511}",
782
+ "is_core": false,
783
+ "permissions": [
784
+ "api-keys:manage"
785
+ ],
786
+ "dependencies": [],
787
+ "defaultSettings": {
788
+ "maxKeysPerUser": 50,
789
+ "defaultExpiryDays": 0
790
+ },
791
+ "adminMenu": {
792
+ "label": "API Keys",
793
+ "icon": "key",
794
+ "path": "/admin/plugins/api-keys",
795
+ "order": 86
796
+ }
797
+ },
771
798
  "core-analytics": {
772
799
  "id": "core-analytics",
773
800
  "codeName": "core-analytics",
@@ -861,7 +888,6 @@ var PLUGIN_REGISTRY = {
861
888
  "category": "system",
862
889
  "iconEmoji": "\u26A1",
863
890
  "is_core": true,
864
- "defaultActive": true,
865
891
  "permissions": [
866
892
  "cache.view",
867
893
  "cache.clear",
@@ -1471,6 +1497,7 @@ var PluginBootstrapService = class {
1471
1497
  this.db = db;
1472
1498
  this.pluginService = new PluginService(db);
1473
1499
  }
1500
+ db;
1474
1501
  pluginService;
1475
1502
  /**
1476
1503
  * Core plugins derived from the auto-generated plugin registry.
@@ -1572,6 +1599,257 @@ var PluginBootstrapService = class {
1572
1599
  }
1573
1600
  };
1574
1601
 
1575
- export { CollectionRegistry, MULTI_TENANT_PLUGIN_ID, PLUGIN_REGISTRY, PluginBootstrapService, PluginService, TENANT_COOKIE, collectionRecordToRow, findPluginByCodeName, getAvailableCollectionNames, getCollectionRegistry, getVisibleCollections, invalidateTenantCache, isCodeCollectionInternal, isDbDocTypeInternal, loadCollectionConfig, loadCollectionConfigs, registerCollections, resetCollectionRegistry, tenantMiddleware, validateCollectionConfig };
1576
- //# sourceMappingURL=chunk-ZGGXCFR6.js.map
1577
- //# sourceMappingURL=chunk-ZGGXCFR6.js.map
1602
+ // src/services/telemetry-service.ts
1603
+ var TelemetryService = class {
1604
+ config;
1605
+ identity = null;
1606
+ enabled = true;
1607
+ eventQueue = [];
1608
+ isInitialized = false;
1609
+ constructor(config) {
1610
+ this.config = {
1611
+ ...getTelemetryConfig(),
1612
+ ...config
1613
+ };
1614
+ this.enabled = this.config.enabled;
1615
+ }
1616
+ /**
1617
+ * Initialize the telemetry service
1618
+ */
1619
+ async initialize(identity) {
1620
+ if (!this.enabled) {
1621
+ if (this.config.debug) {
1622
+ console.log("[Telemetry] Disabled via configuration");
1623
+ }
1624
+ return;
1625
+ }
1626
+ try {
1627
+ this.identity = identity;
1628
+ if (this.config.debug) {
1629
+ console.log("[Telemetry] Initialized with installation ID:", identity.installationId);
1630
+ }
1631
+ this.isInitialized = true;
1632
+ await this.flushQueue();
1633
+ } catch (error) {
1634
+ if (this.config.debug) {
1635
+ console.error("[Telemetry] Initialization failed:", error);
1636
+ }
1637
+ this.enabled = false;
1638
+ }
1639
+ }
1640
+ /**
1641
+ * Track a telemetry event
1642
+ */
1643
+ async track(event, properties) {
1644
+ if (!this.enabled) return;
1645
+ try {
1646
+ const sanitizedProps = this.sanitizeProperties(properties);
1647
+ const enrichedProps = {
1648
+ ...sanitizedProps,
1649
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1650
+ version: this.getVersion()
1651
+ };
1652
+ if (!this.isInitialized) {
1653
+ this.eventQueue.push({ event, properties: enrichedProps });
1654
+ if (this.config.debug) {
1655
+ console.log("[Telemetry] Queued event:", event, enrichedProps);
1656
+ }
1657
+ return;
1658
+ }
1659
+ if (this.identity && this.config.host) {
1660
+ const payload = {
1661
+ data: {
1662
+ installation_id: this.identity.installationId,
1663
+ event_type: event,
1664
+ properties: enrichedProps,
1665
+ timestamp: enrichedProps.timestamp
1666
+ }
1667
+ };
1668
+ fetch(`${this.config.host}/v1/events`, {
1669
+ method: "POST",
1670
+ headers: { "Content-Type": "application/json" },
1671
+ body: JSON.stringify(payload)
1672
+ }).catch(() => {
1673
+ });
1674
+ if (this.config.debug) {
1675
+ console.log("[Telemetry] Tracked event:", event, enrichedProps);
1676
+ }
1677
+ } else if (this.config.debug) {
1678
+ console.log("[Telemetry] Event (no endpoint):", event, enrichedProps);
1679
+ }
1680
+ } catch (error) {
1681
+ if (this.config.debug) {
1682
+ console.error("[Telemetry] Failed to track event:", error);
1683
+ }
1684
+ }
1685
+ }
1686
+ /**
1687
+ * Track installation started
1688
+ */
1689
+ async trackInstallationStarted(properties) {
1690
+ await this.track("installation_started", properties);
1691
+ }
1692
+ /**
1693
+ * Track installation completed
1694
+ */
1695
+ async trackInstallationCompleted(properties) {
1696
+ await this.track("installation_completed", properties);
1697
+ }
1698
+ /**
1699
+ * Track installation failed
1700
+ */
1701
+ async trackInstallationFailed(error, properties) {
1702
+ await this.track("installation_failed", {
1703
+ ...properties,
1704
+ errorType: sanitizeErrorMessage(error)
1705
+ });
1706
+ }
1707
+ /**
1708
+ * Track dev server started
1709
+ */
1710
+ async trackDevServerStarted(properties) {
1711
+ await this.track("dev_server_started", properties);
1712
+ }
1713
+ /**
1714
+ * Track page view in admin UI
1715
+ */
1716
+ async trackPageView(route, properties) {
1717
+ await this.track("page_viewed", {
1718
+ ...properties,
1719
+ route: sanitizeRoute(route)
1720
+ });
1721
+ }
1722
+ /**
1723
+ * Track error (sanitized)
1724
+ */
1725
+ async trackError(error, properties) {
1726
+ await this.track("error_occurred", {
1727
+ ...properties,
1728
+ errorType: sanitizeErrorMessage(error)
1729
+ });
1730
+ }
1731
+ /**
1732
+ * Track plugin activation
1733
+ */
1734
+ async trackPluginActivated(properties) {
1735
+ await this.track("plugin_activated", properties);
1736
+ }
1737
+ /**
1738
+ * Track migration run
1739
+ */
1740
+ async trackMigrationRun(properties) {
1741
+ await this.track("migration_run", properties);
1742
+ }
1743
+ /**
1744
+ * Track project snapshot — fired on bootstrap to capture runtime project shape.
1745
+ * Arrays serialized as JSON strings (sanitizeProperties strips objects/arrays).
1746
+ */
1747
+ async trackProjectSnapshot(data) {
1748
+ if (!this.identity) {
1749
+ this.identity = { installationId: data.installation_id };
1750
+ this.isInitialized = true;
1751
+ }
1752
+ await this.track("project_snapshot", {
1753
+ installation_id: data.installation_id,
1754
+ collection_names: JSON.stringify(data.collection_names),
1755
+ collection_counts: JSON.stringify(data.collection_counts),
1756
+ active_plugins: JSON.stringify(data.active_plugins),
1757
+ field_type_histogram: JSON.stringify(data.field_type_histogram),
1758
+ doc_total: data.doc_total,
1759
+ sonicjs_version: data.sonicjs_version
1760
+ });
1761
+ }
1762
+ /**
1763
+ * Flush queued events
1764
+ */
1765
+ async flushQueue() {
1766
+ if (this.eventQueue.length === 0) return;
1767
+ const queue = [...this.eventQueue];
1768
+ this.eventQueue = [];
1769
+ for (const { event, properties } of queue) {
1770
+ await this.track(event, properties);
1771
+ }
1772
+ }
1773
+ /**
1774
+ * Sanitize properties to ensure no PII
1775
+ */
1776
+ sanitizeProperties(properties) {
1777
+ if (!properties) return {};
1778
+ const sanitized = {};
1779
+ for (const [key, value] of Object.entries(properties)) {
1780
+ if (value === void 0) continue;
1781
+ if (key === "route" && typeof value === "string") {
1782
+ sanitized[key] = sanitizeRoute(value);
1783
+ continue;
1784
+ }
1785
+ if (key.toLowerCase().includes("error") && typeof value === "string") {
1786
+ sanitized[key] = sanitizeErrorMessage(value);
1787
+ continue;
1788
+ }
1789
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
1790
+ sanitized[key] = value;
1791
+ }
1792
+ }
1793
+ return sanitized;
1794
+ }
1795
+ /**
1796
+ * Get SonicJS version
1797
+ */
1798
+ getVersion() {
1799
+ try {
1800
+ if (typeof process !== "undefined" && process.env) {
1801
+ return process.env.SONICJS_VERSION || "2.0.0";
1802
+ }
1803
+ return "2.0.0";
1804
+ } catch {
1805
+ return "unknown";
1806
+ }
1807
+ }
1808
+ /**
1809
+ * Shutdown the telemetry service (no-op for fetch-based telemetry)
1810
+ */
1811
+ async shutdown() {
1812
+ }
1813
+ /**
1814
+ * Enable telemetry
1815
+ */
1816
+ enable() {
1817
+ this.enabled = true;
1818
+ }
1819
+ /**
1820
+ * Disable telemetry
1821
+ */
1822
+ disable() {
1823
+ this.enabled = false;
1824
+ }
1825
+ /**
1826
+ * Check if telemetry is enabled
1827
+ */
1828
+ isEnabled() {
1829
+ return this.enabled;
1830
+ }
1831
+ };
1832
+ var telemetryInstance = null;
1833
+ function getTelemetryService(config) {
1834
+ if (!telemetryInstance) {
1835
+ telemetryInstance = new TelemetryService(config);
1836
+ }
1837
+ return telemetryInstance;
1838
+ }
1839
+ async function initTelemetry(identity, config) {
1840
+ const service = getTelemetryService(config);
1841
+ await service.initialize(identity);
1842
+ return service;
1843
+ }
1844
+ function createInstallationIdentity(projectName) {
1845
+ const installationId = generateInstallationId();
1846
+ const identity = { installationId };
1847
+ if (projectName) {
1848
+ identity.projectId = generateProjectId(projectName);
1849
+ }
1850
+ return identity;
1851
+ }
1852
+
1853
+ export { CollectionRegistry, MULTI_TENANT_PLUGIN_ID, PLUGIN_REGISTRY, PluginBootstrapService, PluginService, TENANT_COOKIE, TelemetryService, collectionRecordToRow, createInstallationIdentity, findPluginByCodeName, getAvailableCollectionNames, getCollectionRegistry, getTelemetryService, getVisibleCollections, initTelemetry, invalidateTenantCache, isCodeCollectionInternal, isDbDocTypeInternal, loadCollectionConfig, loadCollectionConfigs, registerCollections, resetCollectionRegistry, tenantMiddleware, validateCollectionConfig };
1854
+ //# sourceMappingURL=chunk-4LVVMVQI.js.map
1855
+ //# sourceMappingURL=chunk-4LVVMVQI.js.map