@oneuptime/common 12.0.30 → 12.0.32

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 (645) hide show
  1. package/Models/AnalyticsModels/SecurityEvent.ts +48 -16
  2. package/Models/AnalyticsModels/ThreatIntelIndicator.ts +10 -5
  3. package/Models/DatabaseModels/AlertSeverity.ts +44 -0
  4. package/Models/DatabaseModels/AlertState.ts +0 -2
  5. package/Models/DatabaseModels/DetectionRule.ts +16 -5
  6. package/Models/DatabaseModels/Domain.ts +1 -1
  7. package/Models/DatabaseModels/GoogleSecOpsConnection.ts +14 -5
  8. package/Models/DatabaseModels/Incident.ts +1 -1
  9. package/Models/DatabaseModels/IncidentSeverity.ts +44 -0
  10. package/Models/DatabaseModels/IncidentTemplate.ts +1 -1
  11. package/Models/DatabaseModels/Index.ts +4 -0
  12. package/Models/DatabaseModels/MetricType.ts +0 -2
  13. package/Models/DatabaseModels/MonitorStatusTimeline.ts +0 -2
  14. package/Models/DatabaseModels/MonitorTest.ts +0 -2
  15. package/Models/DatabaseModels/NetworkDevice.ts +234 -5
  16. package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +88 -0
  17. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +22 -0
  18. package/Models/DatabaseModels/NetworkDeviceOidTemplate.ts +501 -0
  19. package/Models/DatabaseModels/NetworkDeviceRole.ts +648 -0
  20. package/Models/DatabaseModels/ScheduledMaintenance.ts +1 -1
  21. package/Models/DatabaseModels/ScheduledMaintenanceTemplate.ts +1 -1
  22. package/Models/DatabaseModels/StatusPageAnnouncement.ts +0 -2
  23. package/Models/DatabaseModels/StatusPageAnnouncementTemplate.ts +0 -2
  24. package/Models/DatabaseModels/StatusPagePrivateUser.ts +0 -2
  25. package/Models/DatabaseModels/StatusPageResource.ts +0 -2
  26. package/Models/DatabaseModels/StatusPageSubscriber.ts +0 -2
  27. package/Models/DatabaseModels/ThreatIntelFeed.ts +16 -5
  28. package/Server/API/GlobalConfigAPI.ts +362 -183
  29. package/Server/API/TelemetryAPI.ts +42 -4
  30. package/Server/EnvironmentConfig.ts +112 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.ts +59 -0
  32. package/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.ts +25 -0
  33. package/Server/Infrastructure/Postgres/SchemaMigrations/1790800000000-AddNetworkDeviceRoleTable.ts +72 -0
  34. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
  35. package/Server/Middleware/MultipartFormData.ts +118 -32
  36. package/Server/Services/AlertEpisodeLabelRuleEngineService.ts +9 -1
  37. package/Server/Services/AlertEpisodeOnCallRuleEngineService.ts +9 -1
  38. package/Server/Services/AlertEpisodeOwnerRuleEngineService.ts +9 -1
  39. package/Server/Services/AlertEpisodePrivacyRuleEngineService.ts +9 -1
  40. package/Server/Services/AlertGroupingEngineService.ts +9 -1
  41. package/Server/Services/AlertLabelRuleEngineService.ts +9 -1
  42. package/Server/Services/AlertOnCallRuleEngineService.ts +9 -1
  43. package/Server/Services/AlertOwnerRuleEngineService.ts +9 -1
  44. package/Server/Services/AlertPrivacyRuleEngineService.ts +9 -1
  45. package/Server/Services/AlertReminderRuleService.ts +9 -1
  46. package/Server/Services/AutoRemediationRuleEngineService.ts +9 -1
  47. package/Server/Services/CephClusterLabelRuleEngineService.ts +9 -1
  48. package/Server/Services/CephClusterOwnerRuleEngineService.ts +9 -1
  49. package/Server/Services/CloudResourceLabelRuleEngineService.ts +9 -1
  50. package/Server/Services/CloudResourceOwnerRuleEngineService.ts +9 -1
  51. package/Server/Services/DashboardLabelRuleEngineService.ts +9 -1
  52. package/Server/Services/DashboardOwnerRuleEngineService.ts +9 -1
  53. package/Server/Services/DatabaseService.ts +39 -9
  54. package/Server/Services/DockerHostLabelRuleEngineService.ts +9 -1
  55. package/Server/Services/DockerHostOwnerRuleEngineService.ts +9 -1
  56. package/Server/Services/DockerSwarmClusterLabelRuleEngineService.ts +9 -1
  57. package/Server/Services/DockerSwarmClusterOwnerRuleEngineService.ts +9 -1
  58. package/Server/Services/HostLabelRuleEngineService.ts +9 -1
  59. package/Server/Services/HostOwnerRuleEngineService.ts +9 -1
  60. package/Server/Services/IncidentEpisodeLabelRuleEngineService.ts +9 -1
  61. package/Server/Services/IncidentEpisodeOnCallRuleEngineService.ts +9 -1
  62. package/Server/Services/IncidentEpisodeOwnerRuleEngineService.ts +9 -1
  63. package/Server/Services/IncidentEpisodePrivacyRuleEngineService.ts +9 -1
  64. package/Server/Services/IncidentGroupingEngineService.ts +9 -1
  65. package/Server/Services/IncidentLabelRuleEngineService.ts +9 -1
  66. package/Server/Services/IncidentOnCallRuleEngineService.ts +9 -1
  67. package/Server/Services/IncidentOwnerRuleEngineService.ts +9 -1
  68. package/Server/Services/IncidentPrivacyRuleEngineService.ts +9 -1
  69. package/Server/Services/IncidentReminderRuleService.ts +9 -1
  70. package/Server/Services/IncidentSlaRuleService.ts +9 -1
  71. package/Server/Services/IncomingCallPolicyLabelRuleEngineService.ts +9 -1
  72. package/Server/Services/IncomingCallPolicyOwnerRuleEngineService.ts +9 -1
  73. package/Server/Services/Index.ts +4 -0
  74. package/Server/Services/IoTFleetLabelRuleEngineService.ts +9 -1
  75. package/Server/Services/IoTFleetOwnerRuleEngineService.ts +9 -1
  76. package/Server/Services/KubernetesClusterLabelRuleEngineService.ts +9 -1
  77. package/Server/Services/KubernetesClusterOwnerRuleEngineService.ts +9 -1
  78. package/Server/Services/KubernetesResourceService.ts +5 -1
  79. package/Server/Services/MonitorLabelRuleEngineService.ts +9 -1
  80. package/Server/Services/MonitorOwnerRuleEngineService.ts +9 -1
  81. package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +35 -0
  82. package/Server/Services/NetworkDeviceAutoImportRuleService.ts +96 -0
  83. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +9 -1
  84. package/Server/Services/NetworkDeviceOidTemplateService.ts +201 -0
  85. package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +9 -1
  86. package/Server/Services/NetworkDeviceRoleService.ts +90 -0
  87. package/Server/Services/NetworkDeviceService.ts +209 -1
  88. package/Server/Services/OnCallDutyPolicyLabelRuleEngineService.ts +9 -1
  89. package/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.ts +9 -1
  90. package/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.ts +9 -1
  91. package/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.ts +9 -1
  92. package/Server/Services/PodmanHostLabelRuleEngineService.ts +9 -1
  93. package/Server/Services/PodmanHostOwnerRuleEngineService.ts +9 -1
  94. package/Server/Services/ProjectService.ts +85 -0
  95. package/Server/Services/ProxmoxClusterLabelRuleEngineService.ts +9 -1
  96. package/Server/Services/ProxmoxClusterOwnerRuleEngineService.ts +9 -1
  97. package/Server/Services/RumApplicationLabelRuleEngineService.ts +9 -1
  98. package/Server/Services/RumApplicationOwnerRuleEngineService.ts +9 -1
  99. package/Server/Services/RunbookLabelRuleEngineService.ts +9 -1
  100. package/Server/Services/RunbookOwnerRuleEngineService.ts +9 -1
  101. package/Server/Services/RunbookRuleEngineService.ts +9 -1
  102. package/Server/Services/ScheduledMaintenanceLabelRuleEngineService.ts +9 -1
  103. package/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.ts +9 -1
  104. package/Server/Services/ScheduledMaintenanceReminderRuleService.ts +9 -1
  105. package/Server/Services/ServerlessFunctionLabelRuleEngineService.ts +9 -1
  106. package/Server/Services/ServerlessFunctionOwnerRuleEngineService.ts +9 -1
  107. package/Server/Services/ServiceLabelRuleEngineService.ts +9 -1
  108. package/Server/Services/ServiceOwnerRuleEngineService.ts +9 -1
  109. package/Server/Services/StatusPageLabelRuleEngineService.ts +9 -1
  110. package/Server/Services/StatusPageMonitorRuleEngineService.ts +7 -0
  111. package/Server/Services/StatusPageOwnerRuleEngineService.ts +9 -1
  112. package/Server/Services/TelemetrySourceMapService.ts +266 -23
  113. package/Server/Services/UserNotificationSettingService.ts +0 -6
  114. package/Server/Services/UserService.ts +27 -0
  115. package/Server/Services/WorkflowLabelRuleEngineService.ts +9 -1
  116. package/Server/Services/WorkflowOwnerRuleEngineService.ts +9 -1
  117. package/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.ts +186 -0
  118. package/Server/Utils/Monitor/CapturedMetricAttributeUtil.ts +245 -0
  119. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +21 -2
  120. package/Server/Utils/Monitor/MonitorMetricUtil.ts +55 -21
  121. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +32 -0
  122. package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +15 -2
  123. package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +18 -1
  124. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +10 -0
  125. package/Server/Utils/Monitor/SeriesResourceLabels.ts +34 -0
  126. package/Server/Utils/Rules/RuleEngineRuleRead.ts +48 -0
  127. package/Server/Utils/Telemetry/ExceptionSanitizer.ts +14 -1
  128. package/Server/Utils/Telemetry/LogExceptionExtractor.ts +14 -2
  129. package/Server/Utils/Telemetry/SourceMapResolver.ts +16 -5
  130. package/Server/Utils/Telemetry/StackTraceParser.ts +399 -0
  131. package/Tests/App/Dashboard/AddNeighborToMonitoringModal.test.tsx +31 -1
  132. package/Tests/App/Dashboard/DashboardChartWidgetZoom.test.tsx +35 -8
  133. package/Tests/App/Dashboard/DashboardCommandPalette.test.tsx +107 -3
  134. package/Tests/App/Dashboard/DashboardWideChartZoom.test.tsx +401 -0
  135. package/Tests/App/Dashboard/EventOverlayHook.test.tsx +125 -0
  136. package/Tests/App/Dashboard/HeaderImageAssets.test.tsx +93 -0
  137. package/Tests/App/Dashboard/MonitorTemplateColumnAndFacet.test.tsx +318 -0
  138. package/Tests/App/Dashboard/NetworkDeviceBulkDelete.test.tsx +357 -0
  139. package/Tests/App/Dashboard/NetworkSideMenu.test.tsx +590 -0
  140. package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +3 -3
  141. package/Tests/App/Dashboard/SideMenuHarness.tsx +11 -3
  142. package/Tests/App/Dashboard/UserElementEmail.test.tsx +12 -4
  143. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +1 -1
  144. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +14 -0
  145. package/Tests/Models/DatabaseModels/ModelRegistryInvariants.test.ts +543 -0
  146. package/Tests/Models/SecurityDomainAccessControl.test.ts +429 -0
  147. package/Tests/Server/API/GlobalConfigLicense.test.ts +657 -0
  148. package/Tests/Server/API/SecurityEventAttributesAPI.test.ts +84 -6
  149. package/Tests/Server/API/TelemetryResolveStackTraceAPI.test.ts +805 -0
  150. package/Tests/Server/Infrastructure/Postgres/AddOnCallCalendarFeedsMigration.test.ts +32 -7
  151. package/Tests/Server/Infrastructure/Postgres/NetworkDeviceRoleTableMigration.test.ts +476 -0
  152. package/Tests/Server/Middleware/IdentityRateLimit.test.ts +1144 -0
  153. package/Tests/Server/Middleware/MultipartFormData.test.ts +618 -3
  154. package/Tests/Server/Services/DatabaseServiceGenerateSlug.test.ts +215 -0
  155. package/Tests/Server/Services/MonitorLabelRuleEngineScale.test.ts +520 -0
  156. package/Tests/Server/Services/NetworkDeviceOidTemplateService.test.ts +332 -0
  157. package/Tests/Server/Services/NetworkDeviceOidTemplateWriteGuards.test.ts +409 -0
  158. package/Tests/Server/Services/NetworkDeviceRoleModel.test.ts +672 -0
  159. package/Tests/Server/Services/NetworkDeviceRuleEngines.test.ts +1 -1
  160. package/Tests/Server/Services/ProjectServiceCreateSubscriptionStarted.test.ts +67 -4
  161. package/Tests/Server/Services/RuleEngineRuleFetchLimit.test.ts +239 -0
  162. package/Tests/Server/Services/ScheduledMaintenanceSubscriberEndTime.test.ts +369 -0
  163. package/Tests/Server/Services/TelemetrySourceMapService.test.ts +1210 -2
  164. package/Tests/Server/Services/UserNotificationSettingMonitorDefaults.test.ts +248 -0
  165. package/Tests/Server/Services/UserNotificationSettingWorkspaceChannels.test.ts +43 -2
  166. package/Tests/Server/Services/UserServiceSeatLimit.test.ts +182 -0
  167. package/Tests/Server/Types/AnalyticsDatabase/SecurityEventModelPermission.test.ts +255 -0
  168. package/Tests/Server/Types/Database/Permissions/ReadBlockPermission.test.ts +212 -0
  169. package/Tests/Server/Types/Database/Permissions/SecurityRoleAccess.test.ts +413 -0
  170. package/Tests/Server/Utils/BasicCron.test.ts +283 -0
  171. package/Tests/Server/Utils/CodeRepository.test.ts +689 -0
  172. package/Tests/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.test.ts +495 -0
  173. package/Tests/Server/Utils/ExceptionSanitizer.test.ts +77 -0
  174. package/Tests/Server/Utils/IncomingCallPhoneNumber.test.ts +174 -0
  175. package/Tests/Server/Utils/Monitor/CapturedMetricAttributeUtil.test.ts +284 -0
  176. package/Tests/Server/Utils/Monitor/MonitorCustomMetricAttributes.test.ts +503 -0
  177. package/Tests/Server/Utils/Monitor/MonitorTemplatePrototypePollution.test.ts +106 -0
  178. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkLogWritePath.test.ts +33 -4
  179. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +14 -4
  180. package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +44 -0
  181. package/Tests/Server/Utils/OpenAPISpec.test.ts +536 -0
  182. package/Tests/Server/Utils/Rules/RuleEngineRuleRead.test.ts +115 -0
  183. package/Tests/Server/Utils/StackTraceParser.test.ts +610 -0
  184. package/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.ts +0 -0
  185. package/Tests/Server/Utils/Telemetry/SourceMapLimits.test.ts +656 -0
  186. package/Tests/Server/Utils/Telemetry/SourceMapResolver.test.ts +100 -0
  187. package/Tests/Types/Monitor/SnmpMonitor/SnmpOidListUtil.test.ts +454 -0
  188. package/Tests/Types/NetworkDevice/DefaultNetworkDeviceRole.test.ts +417 -0
  189. package/Tests/Types/SecurityRolePermissions.test.ts +193 -0
  190. package/Tests/UI/Components/Charts/AnnotationLayout.test.ts +773 -0
  191. package/Tests/UI/Components/Charts/ChartAnnotationRail.test.tsx +789 -0
  192. package/Tests/UI/Components/Charts/ChartBucketIdentity.test.ts +254 -0
  193. package/Tests/UI/Components/Charts/ChartClickDoubleClickDisambiguation.test.tsx +221 -0
  194. package/Tests/UI/Components/Charts/ChartDoubleClickReset.test.tsx +220 -0
  195. package/Tests/UI/Components/Charts/TimeAnnotation.test.ts +471 -0
  196. package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +405 -0
  197. package/Tests/UI/Components/ErrorMessageRefreshControl.test.tsx +83 -0
  198. package/Tests/UI/Components/MarkdownConverters.test.ts +686 -0
  199. package/Tests/UI/Components/ModelTable/BaseModelTableBulkDelete.test.tsx +751 -0
  200. package/Tests/UI/Components/ModelTable/BaseModelTableColumnCustomization.test.tsx +475 -43
  201. package/Tests/UI/Components/ModelTable/BaseModelTableDeleteAndEmptyStates.test.tsx +341 -0
  202. package/Tests/UI/Components/ModelTable/ColumnPreference.test.ts +89 -0
  203. package/Tests/UI/Components/NavBarCommandKGating.test.tsx +103 -8
  204. package/Tests/UI/Components/OrderedStatesList.test.tsx +5 -5
  205. package/Tests/UI/Components/PendingProjectInvitations.test.tsx +1 -1
  206. package/Tests/UI/Components/SideMenuItem.test.tsx +30 -0
  207. package/Tests/UI/Components/TableSortAndMobileColumns.test.tsx +195 -0
  208. package/Tests/UI/Components/XAxis.test.ts +270 -5
  209. package/Tests/UI/Components/XAxisDaylightSaving.test.ts +113 -0
  210. package/Tests/UI/Styles/ChartFocusRing.test.ts +153 -0
  211. package/Tests/UI/Styles/ChartFocusRingCoverage.test.tsx +377 -0
  212. package/Tests/UI/Styles/ThemeStylesheet.ts +162 -0
  213. package/Tests/UI/Utils/TableColumnsToCsv.test.ts +30 -0
  214. package/Tests/UI/Utils/UseDashboardTimeRangeZoom.test.tsx +187 -0
  215. package/Tests/Utils/Dashboard/DashboardResourceListSharedArgs.test.ts +302 -0
  216. package/Tests/Utils/Dashboard/DashboardTimeRangeZoom.test.ts +242 -0
  217. package/Tests/Utils/EnterpriseLicenseSeats.test.ts +507 -0
  218. package/Tests/Utils/Monitor/NetworkDeviceRoleCatalog.test.ts +981 -0
  219. package/Tests/Utils/Monitor/NetworkTopologyRoleCatalog.test.ts +865 -0
  220. package/Tests/Utils/NetworkDevice/DeviceRoleKeyUtil.test.ts +538 -0
  221. package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +951 -1
  222. package/Tests/Utils/NetworkDiscovery/DiscoveredHostUtil.test.ts +238 -0
  223. package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +1056 -0
  224. package/Tests/Utils/NetworkDiscovery/ReverseDnsNameUtil.test.ts +882 -0
  225. package/Tests/Utils/Slo/SloEvaluation.test.ts +171 -0
  226. package/Tests/Utils/Slug.test.ts +61 -1
  227. package/Tests/jest.setup.ts +19 -0
  228. package/Types/Date.ts +39 -0
  229. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +61 -0
  230. package/Types/Monitor/SnmpMonitor/SnmpOidListUtil.ts +333 -0
  231. package/Types/NetworkDevice/DefaultNetworkDeviceRole.ts +145 -0
  232. package/Types/Permission.ts +141 -0
  233. package/Types/Rum/SessionReplay.ts +21 -0
  234. package/Types/Telemetry/SourceMap.ts +8 -0
  235. package/UI/Components/Charts/Area/AreaChart.tsx +7 -0
  236. package/UI/Components/Charts/Bar/BarChart.tsx +6 -0
  237. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +9 -1
  238. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.tsx +176 -0
  239. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.ts +745 -0
  240. package/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.tsx +576 -0
  241. package/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.tsx +204 -0
  242. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +554 -545
  243. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +337 -371
  244. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +549 -540
  245. package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +7 -3
  246. package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +14 -3
  247. package/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.ts +13 -0
  248. package/UI/Components/Charts/Line/LineChart.tsx +7 -0
  249. package/UI/Components/Charts/Types/ChartEventKind.ts +13 -0
  250. package/UI/Components/Charts/Types/ReferenceRegionProps.ts +6 -0
  251. package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +20 -3
  252. package/UI/Components/Charts/Utils/TimeAnnotation.ts +69 -35
  253. package/UI/Components/Charts/Utils/XAxis.ts +125 -18
  254. package/UI/Components/EditionLabel/EditionLabel.tsx +280 -26
  255. package/UI/Components/ErrorMessage/ErrorMessage.tsx +21 -10
  256. package/UI/Components/Feed/FeedItem.tsx +4 -5
  257. package/UI/Components/Header/HeaderIconDropdownButton.tsx +1 -2
  258. package/UI/Components/Header/UserProfile/UserProfile.tsx +1 -2
  259. package/UI/Components/Image/Image.tsx +20 -3
  260. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  261. package/UI/Components/MemberRoleAssignment/MemberRoleAssignment.tsx +1 -2
  262. package/UI/Components/ModelTable/BaseModelTable.tsx +200 -39
  263. package/UI/Components/Navbar/NavBar.tsx +62 -13
  264. package/UI/Components/Navbar/NavBarMenuModal.tsx +7 -2
  265. package/UI/Components/SideMenu/CountModelSideMenuItem.tsx +2 -0
  266. package/UI/Components/SideMenu/SideMenu.tsx +12 -2
  267. package/UI/Components/SideMenu/SideMenuItem.tsx +4 -1
  268. package/UI/Components/SideMenu/SideMenuSection.tsx +14 -2
  269. package/UI/Components/Table/TableHeader.tsx +64 -48
  270. package/UI/Components/Table/TableRow.tsx +13 -3
  271. package/UI/Styles/Theme.css +38 -0
  272. package/UI/Utils/UseDashboardTimeRangeZoom.ts +77 -0
  273. package/Utils/Dashboard/DashboardTimeRangeZoom.ts +118 -0
  274. package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +271 -0
  275. package/Utils/Monitor/NetworkDeviceRoleCatalog.ts +232 -0
  276. package/Utils/Monitor/NetworkDeviceRoleUtil.ts +2 -1
  277. package/Utils/Monitor/NetworkTopologyUtil.ts +116 -33
  278. package/Utils/NetworkDevice/DeviceRoleKeyUtil.ts +137 -0
  279. package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +6 -0
  280. package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +141 -10
  281. package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +55 -3
  282. package/Utils/NetworkDiscovery/ReverseDnsNameUtil.ts +151 -0
  283. package/Utils/Rules/RuleEngineLimits.ts +32 -0
  284. package/Utils/Rules/RulePatternMatchUtil.ts +1 -1
  285. package/Utils/Slug.ts +34 -1
  286. package/build/dist/Models/AnalyticsModels/SecurityEvent.js +48 -16
  287. package/build/dist/Models/AnalyticsModels/SecurityEvent.js.map +1 -1
  288. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js +10 -5
  289. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js.map +1 -1
  290. package/build/dist/Models/DatabaseModels/AlertSeverity.js +46 -1
  291. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  292. package/build/dist/Models/DatabaseModels/AlertState.js +0 -2
  293. package/build/dist/Models/DatabaseModels/AlertState.js.map +1 -1
  294. package/build/dist/Models/DatabaseModels/DetectionRule.js +16 -5
  295. package/build/dist/Models/DatabaseModels/DetectionRule.js.map +1 -1
  296. package/build/dist/Models/DatabaseModels/Domain.js +1 -1
  297. package/build/dist/Models/DatabaseModels/Domain.js.map +1 -1
  298. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js +14 -5
  299. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js.map +1 -1
  300. package/build/dist/Models/DatabaseModels/Incident.js +1 -1
  301. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  302. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +46 -1
  303. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  304. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +1 -1
  305. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  306. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  307. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  308. package/build/dist/Models/DatabaseModels/MetricType.js +0 -2
  309. package/build/dist/Models/DatabaseModels/MetricType.js.map +1 -1
  310. package/build/dist/Models/DatabaseModels/MonitorStatusTimeline.js +0 -2
  311. package/build/dist/Models/DatabaseModels/MonitorStatusTimeline.js.map +1 -1
  312. package/build/dist/Models/DatabaseModels/MonitorTest.js +0 -2
  313. package/build/dist/Models/DatabaseModels/MonitorTest.js.map +1 -1
  314. package/build/dist/Models/DatabaseModels/NetworkDevice.js +239 -6
  315. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  316. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +88 -0
  317. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -1
  318. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  319. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js +521 -0
  320. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js.map +1 -0
  321. package/build/dist/Models/DatabaseModels/NetworkDeviceRole.js +677 -0
  322. package/build/dist/Models/DatabaseModels/NetworkDeviceRole.js.map +1 -0
  323. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +1 -1
  324. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  325. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +1 -1
  326. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js.map +1 -1
  327. package/build/dist/Models/DatabaseModels/StatusPageAnnouncement.js +0 -2
  328. package/build/dist/Models/DatabaseModels/StatusPageAnnouncement.js.map +1 -1
  329. package/build/dist/Models/DatabaseModels/StatusPageAnnouncementTemplate.js +0 -2
  330. package/build/dist/Models/DatabaseModels/StatusPageAnnouncementTemplate.js.map +1 -1
  331. package/build/dist/Models/DatabaseModels/StatusPagePrivateUser.js +0 -2
  332. package/build/dist/Models/DatabaseModels/StatusPagePrivateUser.js.map +1 -1
  333. package/build/dist/Models/DatabaseModels/StatusPageResource.js +0 -2
  334. package/build/dist/Models/DatabaseModels/StatusPageResource.js.map +1 -1
  335. package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js +0 -2
  336. package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js.map +1 -1
  337. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js +16 -5
  338. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js.map +1 -1
  339. package/build/dist/Server/API/GlobalConfigAPI.js +293 -176
  340. package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
  341. package/build/dist/Server/API/TelemetryAPI.js +31 -3
  342. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  343. package/build/dist/Server/EnvironmentConfig.js +83 -0
  344. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  345. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js +26 -0
  346. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js.map +1 -0
  347. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js +14 -0
  348. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js.map +1 -0
  349. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790800000000-AddNetworkDeviceRoleTable.js +39 -0
  350. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790800000000-AddNetworkDeviceRoleTable.js.map +1 -0
  351. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
  352. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  353. package/build/dist/Server/Middleware/MultipartFormData.js +93 -28
  354. package/build/dist/Server/Middleware/MultipartFormData.js.map +1 -1
  355. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js +8 -1
  356. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js.map +1 -1
  357. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js +8 -1
  358. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js.map +1 -1
  359. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js +8 -1
  360. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js.map +1 -1
  361. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js +8 -1
  362. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js.map +1 -1
  363. package/build/dist/Server/Services/AlertGroupingEngineService.js +8 -1
  364. package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
  365. package/build/dist/Server/Services/AlertLabelRuleEngineService.js +8 -1
  366. package/build/dist/Server/Services/AlertLabelRuleEngineService.js.map +1 -1
  367. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js +8 -1
  368. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js.map +1 -1
  369. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js +8 -1
  370. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js.map +1 -1
  371. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js +8 -1
  372. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js.map +1 -1
  373. package/build/dist/Server/Services/AlertReminderRuleService.js +8 -1
  374. package/build/dist/Server/Services/AlertReminderRuleService.js.map +1 -1
  375. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +8 -1
  376. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  377. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js +8 -1
  378. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js.map +1 -1
  379. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js +8 -1
  380. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js.map +1 -1
  381. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js +8 -1
  382. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js.map +1 -1
  383. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js +8 -1
  384. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js.map +1 -1
  385. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js +8 -1
  386. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js.map +1 -1
  387. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js +8 -1
  388. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js.map +1 -1
  389. package/build/dist/Server/Services/DatabaseService.js +31 -5
  390. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  391. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js +8 -1
  392. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js.map +1 -1
  393. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js +8 -1
  394. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js.map +1 -1
  395. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js +8 -1
  396. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js.map +1 -1
  397. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js +8 -1
  398. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js.map +1 -1
  399. package/build/dist/Server/Services/HostLabelRuleEngineService.js +8 -1
  400. package/build/dist/Server/Services/HostLabelRuleEngineService.js.map +1 -1
  401. package/build/dist/Server/Services/HostOwnerRuleEngineService.js +8 -1
  402. package/build/dist/Server/Services/HostOwnerRuleEngineService.js.map +1 -1
  403. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js +8 -1
  404. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js.map +1 -1
  405. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js +8 -1
  406. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js.map +1 -1
  407. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js +8 -1
  408. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js.map +1 -1
  409. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js +8 -1
  410. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js.map +1 -1
  411. package/build/dist/Server/Services/IncidentGroupingEngineService.js +8 -1
  412. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  413. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js +8 -1
  414. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js.map +1 -1
  415. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js +8 -1
  416. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js.map +1 -1
  417. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js +8 -1
  418. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js.map +1 -1
  419. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js +8 -1
  420. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js.map +1 -1
  421. package/build/dist/Server/Services/IncidentReminderRuleService.js +8 -1
  422. package/build/dist/Server/Services/IncidentReminderRuleService.js.map +1 -1
  423. package/build/dist/Server/Services/IncidentSlaRuleService.js +8 -1
  424. package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
  425. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js +8 -1
  426. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js.map +1 -1
  427. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js +8 -1
  428. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js.map +1 -1
  429. package/build/dist/Server/Services/Index.js +4 -0
  430. package/build/dist/Server/Services/Index.js.map +1 -1
  431. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js +8 -1
  432. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js.map +1 -1
  433. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js +8 -1
  434. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js.map +1 -1
  435. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js +8 -1
  436. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js.map +1 -1
  437. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js +8 -1
  438. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js.map +1 -1
  439. package/build/dist/Server/Services/KubernetesResourceService.js +5 -1
  440. package/build/dist/Server/Services/KubernetesResourceService.js.map +1 -1
  441. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js +8 -1
  442. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js.map +1 -1
  443. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js +8 -1
  444. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js.map +1 -1
  445. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +30 -21
  446. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
  447. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +64 -0
  448. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -1
  449. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +8 -1
  450. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
  451. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js +180 -0
  452. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js.map +1 -0
  453. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +8 -1
  454. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -1
  455. package/build/dist/Server/Services/NetworkDeviceRoleService.js +70 -0
  456. package/build/dist/Server/Services/NetworkDeviceRoleService.js.map +1 -0
  457. package/build/dist/Server/Services/NetworkDeviceService.js +154 -1
  458. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  459. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js +8 -1
  460. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js.map +1 -1
  461. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js +8 -1
  462. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js.map +1 -1
  463. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js +8 -1
  464. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js.map +1 -1
  465. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js +8 -1
  466. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js.map +1 -1
  467. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js +8 -1
  468. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js.map +1 -1
  469. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js +8 -1
  470. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js.map +1 -1
  471. package/build/dist/Server/Services/ProjectService.js +65 -0
  472. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  473. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js +8 -1
  474. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js.map +1 -1
  475. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js +8 -1
  476. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js.map +1 -1
  477. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js +8 -1
  478. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js.map +1 -1
  479. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js +8 -1
  480. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js.map +1 -1
  481. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js +8 -1
  482. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js.map +1 -1
  483. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js +8 -1
  484. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js.map +1 -1
  485. package/build/dist/Server/Services/RunbookRuleEngineService.js +8 -1
  486. package/build/dist/Server/Services/RunbookRuleEngineService.js.map +1 -1
  487. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js +8 -1
  488. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js.map +1 -1
  489. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js +8 -1
  490. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js.map +1 -1
  491. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js +8 -1
  492. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js.map +1 -1
  493. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js +8 -1
  494. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js.map +1 -1
  495. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js +8 -1
  496. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js.map +1 -1
  497. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js +8 -1
  498. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js.map +1 -1
  499. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js +8 -1
  500. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js.map +1 -1
  501. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js +8 -1
  502. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js.map +1 -1
  503. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js +6 -0
  504. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js.map +1 -1
  505. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js +8 -1
  506. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js.map +1 -1
  507. package/build/dist/Server/Services/TelemetrySourceMapService.js +213 -19
  508. package/build/dist/Server/Services/TelemetrySourceMapService.js.map +1 -1
  509. package/build/dist/Server/Services/UserNotificationSettingService.js +0 -1
  510. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  511. package/build/dist/Server/Services/UserService.js +25 -0
  512. package/build/dist/Server/Services/UserService.js.map +1 -1
  513. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js +8 -1
  514. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js.map +1 -1
  515. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js +8 -1
  516. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js.map +1 -1
  517. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js +145 -0
  518. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js.map +1 -0
  519. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js +201 -0
  520. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js.map +1 -0
  521. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +19 -2
  522. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  523. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +42 -23
  524. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  525. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +29 -0
  526. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  527. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +11 -2
  528. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -1
  529. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +16 -1
  530. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -1
  531. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +10 -0
  532. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
  533. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +33 -0
  534. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
  535. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js +37 -0
  536. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js.map +1 -0
  537. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js +12 -1
  538. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js.map +1 -1
  539. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +14 -2
  540. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -1
  541. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js +15 -5
  542. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js.map +1 -1
  543. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js +307 -0
  544. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js.map +1 -1
  545. package/build/dist/Types/Date.js +27 -0
  546. package/build/dist/Types/Date.js.map +1 -1
  547. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js +253 -0
  548. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js.map +1 -0
  549. package/build/dist/Types/NetworkDevice/DefaultNetworkDeviceRole.js +105 -0
  550. package/build/dist/Types/NetworkDevice/DefaultNetworkDeviceRole.js.map +1 -0
  551. package/build/dist/Types/Permission.js +126 -0
  552. package/build/dist/Types/Permission.js.map +1 -1
  553. package/build/dist/Types/Rum/SessionReplay.js +19 -0
  554. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  555. package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
  556. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  557. package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
  558. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  559. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +6 -1
  560. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  561. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js +83 -0
  562. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js.map +1 -0
  563. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js +531 -0
  564. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js.map +1 -0
  565. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js +264 -0
  566. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js.map +1 -0
  567. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js +122 -0
  568. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js.map +1 -0
  569. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +262 -234
  570. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  571. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +146 -153
  572. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  573. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +261 -233
  574. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  575. package/build/dist/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.js +14 -0
  576. package/build/dist/UI/Components/Charts/ChartLibrary/Utils/DoubleClick.js.map +1 -0
  577. package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
  578. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  579. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js +14 -0
  580. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js.map +1 -0
  581. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +57 -28
  582. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -1
  583. package/build/dist/UI/Components/Charts/Utils/XAxis.js +103 -17
  584. package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
  585. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +198 -23
  586. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  587. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +15 -5
  588. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
  589. package/build/dist/UI/Components/Feed/FeedItem.js +4 -5
  590. package/build/dist/UI/Components/Feed/FeedItem.js.map +1 -1
  591. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -2
  592. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  593. package/build/dist/UI/Components/Header/UserProfile/UserProfile.js.map +1 -1
  594. package/build/dist/UI/Components/Image/Image.js +6 -1
  595. package/build/dist/UI/Components/Image/Image.js.map +1 -1
  596. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  597. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  598. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js +1 -2
  599. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js.map +1 -1
  600. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +143 -36
  601. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  602. package/build/dist/UI/Components/Navbar/NavBar.js +44 -9
  603. package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
  604. package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +2 -2
  605. package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
  606. package/build/dist/UI/Components/SideMenu/CountModelSideMenuItem.js +1 -1
  607. package/build/dist/UI/Components/SideMenu/CountModelSideMenuItem.js.map +1 -1
  608. package/build/dist/UI/Components/SideMenu/SideMenu.js +9 -6
  609. package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
  610. package/build/dist/UI/Components/SideMenu/SideMenuItem.js +1 -1
  611. package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
  612. package/build/dist/UI/Components/SideMenu/SideMenuSection.js +7 -2
  613. package/build/dist/UI/Components/SideMenu/SideMenuSection.js.map +1 -1
  614. package/build/dist/UI/Components/Table/TableHeader.js +20 -22
  615. package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
  616. package/build/dist/UI/Components/Table/TableRow.js +13 -4
  617. package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
  618. package/build/dist/UI/Utils/UseDashboardTimeRangeZoom.js +42 -0
  619. package/build/dist/UI/Utils/UseDashboardTimeRangeZoom.js.map +1 -0
  620. package/build/dist/Utils/Dashboard/DashboardTimeRangeZoom.js +74 -0
  621. package/build/dist/Utils/Dashboard/DashboardTimeRangeZoom.js.map +1 -0
  622. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +153 -0
  623. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +1 -0
  624. package/build/dist/Utils/Monitor/NetworkDeviceRoleCatalog.js +126 -0
  625. package/build/dist/Utils/Monitor/NetworkDeviceRoleCatalog.js.map +1 -0
  626. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +2 -1
  627. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -1
  628. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +67 -32
  629. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  630. package/build/dist/Utils/NetworkDevice/DeviceRoleKeyUtil.js +114 -0
  631. package/build/dist/Utils/NetworkDevice/DeviceRoleKeyUtil.js.map +1 -0
  632. package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -1
  633. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +127 -7
  634. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -1
  635. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +50 -3
  636. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -1
  637. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js +132 -0
  638. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js.map +1 -0
  639. package/build/dist/Utils/Rules/RuleEngineLimits.js +31 -0
  640. package/build/dist/Utils/Rules/RuleEngineLimits.js.map +1 -0
  641. package/build/dist/Utils/Rules/RulePatternMatchUtil.js +1 -1
  642. package/build/dist/Utils/Slug.js +31 -1
  643. package/build/dist/Utils/Slug.js.map +1 -1
  644. package/jest.config.json +1 -0
  645. package/package.json +2 -2
@@ -0,0 +1,805 @@
1
+ import CommonAPI from "../../../Server/API/CommonAPI";
2
+ import ProjectService from "../../../Server/Services/ProjectService";
3
+ import TelemetrySourceMapService from "../../../Server/Services/TelemetrySourceMapService";
4
+ import SourceMapResolver, {
5
+ MAX_FRAMES_PER_RESOLVE_REQUEST,
6
+ MAX_FRAMES_TO_RESOLVE,
7
+ } from "../../../Server/Utils/Telemetry/SourceMapResolver";
8
+ import {
9
+ ExpressRequest,
10
+ ExpressResponse,
11
+ NextFunction,
12
+ } from "../../../Server/Utils/Express";
13
+ import Response from "../../../Server/Utils/Response";
14
+ import DatabaseCommonInteractionProps from "../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
15
+ import Dictionary from "../../../Types/Dictionary";
16
+ import BadDataException from "../../../Types/Exception/BadDataException";
17
+ import Exception from "../../../Types/Exception/Exception";
18
+ import { JSONObject } from "../../../Types/JSON";
19
+ import ObjectID from "../../../Types/ObjectID";
20
+ import Permission, {
21
+ UserPermission,
22
+ UserTenantAccessPermission,
23
+ } from "../../../Types/Permission";
24
+ import {
25
+ MinifiedStackFrame,
26
+ ResolveStackTraceResult,
27
+ } from "../../../Types/Telemetry/SourceMap";
28
+ import UserType from "../../../Types/UserType";
29
+ import {
30
+ afterEach,
31
+ beforeAll,
32
+ beforeEach,
33
+ describe,
34
+ expect,
35
+ jest,
36
+ test,
37
+ } from "@jest/globals";
38
+
39
+ /*
40
+ * ---------------------------------------------------------------------------
41
+ * POST /telemetry/exceptions/resolve-stack-trace — the frames-array cap
42
+ * ---------------------------------------------------------------------------
43
+ *
44
+ * The handler takes a caller-supplied `frames` array and hands it to
45
+ * SourceMapResolver.sanitizeMinifiedStackFrames, which never throws and never
46
+ * truncates: it walks every element and returns one output frame per object it
47
+ * sees. Downstream, resolveFramesForService only *resolves* the first
48
+ * MAX_FRAMES_TO_RESOLVE frames, but it still copies the whole array into the
49
+ * response. So before this cap existed, the only bound on the work (and the
50
+ * response size) a single request could ask for was the body-size limit —
51
+ * ~200k frames of `{}` fit inside a few megabytes of JSON.
52
+ *
53
+ * MAX_FRAMES_PER_RESOLVE_REQUEST closes that. The cases below pin the three
54
+ * things that make it correct rather than merely present: it is a `>` bound
55
+ * (a full 10000-frame trace still resolves), it sits AFTER the Array.isArray
56
+ * guard (so a non-array keeps its own precise error), and it sits BEFORE
57
+ * sanitize (so an oversized array is refused instead of being quietly walked
58
+ * end to end and reduced to []).
59
+ */
60
+
61
+ type RouterFunction = (
62
+ req: ExpressRequest,
63
+ res: ExpressResponse,
64
+ next: NextFunction,
65
+ ) => void | Promise<void>;
66
+
67
+ type RecordedRoute = {
68
+ method: string;
69
+ uri: string;
70
+ handlers: Array<RouterFunction>;
71
+ };
72
+
73
+ const recordedRoutes: Array<RecordedRoute> = [];
74
+
75
+ type RecordRouteFunction = (
76
+ method: string,
77
+ ) => (uri: string, ...handlers: Array<RouterFunction>) => void;
78
+
79
+ const recordRoute: RecordRouteFunction = (method: string) => {
80
+ return (uri: string, ...handlers: Array<RouterFunction>): void => {
81
+ recordedRoutes.push({
82
+ method: method.toUpperCase(),
83
+ uri: uri,
84
+ handlers: handlers,
85
+ });
86
+ };
87
+ };
88
+
89
+ const telemetryRouter: JSONObject = {
90
+ get: recordRoute("get"),
91
+ post: recordRoute("post"),
92
+ put: recordRoute("put"),
93
+ delete: recordRoute("delete"),
94
+ } as unknown as JSONObject;
95
+
96
+ jest.mock("../../../Server/Utils/Express", () => {
97
+ return {
98
+ getRouter: () => {
99
+ return telemetryRouter;
100
+ },
101
+ getClientIp: () => {
102
+ return "203.0.113.7";
103
+ },
104
+ };
105
+ });
106
+
107
+ jest.mock("../../../Server/Utils/Response", () => {
108
+ return {
109
+ sendEntityArrayResponse: jest.fn(),
110
+ sendJsonObjectResponse: jest.fn(),
111
+ sendEmptySuccessResponse: jest.fn(),
112
+ sendEntityResponse: jest.fn(),
113
+ sendErrorResponse: jest.fn(),
114
+ };
115
+ });
116
+
117
+ const RESOLVE_ROUTE: string = "/telemetry/exceptions/resolve-stack-trace";
118
+
119
+ type FindRouteFunction = (uri: string) => RecordedRoute;
120
+
121
+ const findRoute: FindRouteFunction = (uri: string): RecordedRoute => {
122
+ const route: RecordedRoute | undefined = recordedRoutes.find(
123
+ (candidate: RecordedRoute): boolean => {
124
+ return candidate.method === "POST" && candidate.uri === uri;
125
+ },
126
+ );
127
+
128
+ if (!route) {
129
+ throw new Error(`Route not registered: ${uri}`);
130
+ }
131
+
132
+ return route;
133
+ };
134
+
135
+ type CallResult = {
136
+ /* Exception handed to Response.sendErrorResponse by a guard or the handler. */
137
+ deniedWith: Exception | undefined;
138
+ /* Exception thrown out of the handler into express' error path. */
139
+ thrownToNext: unknown;
140
+ /* True when the final route handler was actually entered. */
141
+ reachedHandler: boolean;
142
+ jsonBody: JSONObject | undefined;
143
+ };
144
+
145
+ /*
146
+ * Runs the recorded route's middleware chain for real, starting at
147
+ * requireUserAuthentication. Index 0 is getUserMiddleware, whose only job is
148
+ * to populate the session fields these fixtures set directly — running it
149
+ * would need a live session store and would prove nothing about the cap.
150
+ */
151
+ type CallRouteFunction = (data: {
152
+ request: JSONObject;
153
+ body: unknown;
154
+ }) => Promise<CallResult>;
155
+
156
+ const callRoute: CallRouteFunction = async (data: {
157
+ request: JSONObject;
158
+ body: unknown;
159
+ }): Promise<CallResult> => {
160
+ const route: RecordedRoute = findRoute(RESOLVE_ROUTE);
161
+
162
+ const req: ExpressRequest = {
163
+ ...data.request,
164
+ body: data.body,
165
+ params: {},
166
+ query: {},
167
+ headers: { "user-agent": "jest-agent" },
168
+ } as unknown as ExpressRequest;
169
+
170
+ const res: ExpressResponse = {
171
+ setHeader: (): void => {
172
+ // no-op
173
+ },
174
+ send: (): void => {
175
+ // no-op
176
+ },
177
+ status: jest.fn().mockReturnThis(),
178
+ json: jest.fn(),
179
+ } as unknown as ExpressResponse;
180
+
181
+ const outcome: { thrownToNext: unknown; reachedHandler: boolean } = {
182
+ thrownToNext: undefined,
183
+ reachedHandler: false,
184
+ };
185
+
186
+ for (let index: number = 1; index < route.handlers.length; index++) {
187
+ const handler: RouterFunction | undefined = route.handlers[index];
188
+
189
+ if (!handler) {
190
+ break;
191
+ }
192
+
193
+ if (index === route.handlers.length - 1) {
194
+ outcome.reachedHandler = true;
195
+ }
196
+
197
+ const step: { calledNext: boolean } = { calledNext: false };
198
+
199
+ const next: NextFunction = ((error?: unknown): void => {
200
+ step.calledNext = true;
201
+
202
+ if (error) {
203
+ outcome.thrownToNext = error;
204
+ }
205
+ }) as unknown as NextFunction;
206
+
207
+ await handler(req, res, next);
208
+
209
+ // A guard (or the handler) that answered the request never calls next.
210
+ if (!step.calledNext) {
211
+ break;
212
+ }
213
+ }
214
+
215
+ const sendErrorResponse: jest.Mock =
216
+ Response.sendErrorResponse as unknown as jest.Mock;
217
+ const sendJsonObjectResponse: jest.Mock =
218
+ Response.sendJsonObjectResponse as unknown as jest.Mock;
219
+
220
+ const errorCall: Array<unknown> | undefined = sendErrorResponse.mock
221
+ .calls[0] as Array<unknown> | undefined;
222
+ const jsonCall: Array<unknown> | undefined = sendJsonObjectResponse.mock
223
+ .calls[0] as Array<unknown> | undefined;
224
+
225
+ return {
226
+ deniedWith: errorCall ? (errorCall[2] as Exception) : undefined,
227
+ thrownToNext: outcome.thrownToNext,
228
+ reachedHandler: outcome.reachedHandler,
229
+ jsonBody: jsonCall ? (jsonCall[2] as JSONObject) : undefined,
230
+ };
231
+ };
232
+
233
+ type BuildPrincipalFunction = (data: {
234
+ projectId: ObjectID;
235
+ userId: ObjectID;
236
+ }) => JSONObject;
237
+
238
+ const buildPrincipal: BuildPrincipalFunction = (data: {
239
+ projectId: ObjectID;
240
+ userId: ObjectID;
241
+ }): JSONObject => {
242
+ /*
243
+ * isBlockPermission must be an explicit false: getUserPermissions filters
244
+ * tenant permissions with a strict `=== false`, so undefined would silently
245
+ * drop the permission this fixture grants and every case below would fail
246
+ * at the guard instead of exercising the handler.
247
+ */
248
+ const userPermissions: Array<UserPermission> = [
249
+ Permission.ReadTelemetryException,
250
+ ].map((permission: Permission): UserPermission => {
251
+ return {
252
+ _type: "UserPermission",
253
+ permission: permission,
254
+ labelIds: [],
255
+ isBlockPermission: false,
256
+ };
257
+ });
258
+
259
+ const tenantPermission: UserTenantAccessPermission = {
260
+ _type: "UserTenantAccessPermission",
261
+ projectId: data.projectId,
262
+ permissions: userPermissions,
263
+ };
264
+
265
+ const permissionMap: Dictionary<UserTenantAccessPermission> = {};
266
+ permissionMap[data.projectId.toString()] = tenantPermission;
267
+
268
+ return {
269
+ userType: UserType.User,
270
+ tenantId: data.projectId,
271
+ userTenantAccessPermission: permissionMap,
272
+ userAuthorization: { userId: data.userId },
273
+ } as unknown as JSONObject;
274
+ };
275
+
276
+ /*
277
+ * Well-formed frames. Every one is a distinct object so nothing about the
278
+ * cap can be an artifact of array element identity.
279
+ */
280
+ type MakeFramesFunction = (count: number) => Array<JSONObject>;
281
+
282
+ const makeFrames: MakeFramesFunction = (count: number): Array<JSONObject> => {
283
+ return Array.from(
284
+ { length: count },
285
+ (_unused: unknown, index: number): JSONObject => {
286
+ return {
287
+ functionName: `minified${index}`,
288
+ fileName: "https://app.example.com/assets/main.abc123.js",
289
+ lineNumber: 1,
290
+ columnNumber: index,
291
+ inApp: true,
292
+ };
293
+ },
294
+ );
295
+ };
296
+
297
+ /*
298
+ * Elements sanitize throws away entirely (null, primitives, nested arrays):
299
+ * a payload of these sanitizes to [] no matter how long it is, which is
300
+ * exactly the shape that has to be rejected on length rather than quietly
301
+ * accepted as an empty resolve.
302
+ */
303
+ type MakeJunkFramesFunction = (count: number) => Array<unknown>;
304
+
305
+ const makeJunkFrames: MakeJunkFramesFunction = (
306
+ count: number,
307
+ ): Array<unknown> => {
308
+ return Array.from({ length: count }, (_unused: unknown, index: number) => {
309
+ if (index % 3 === 0) {
310
+ return null;
311
+ }
312
+
313
+ if (index % 3 === 1) {
314
+ return "not-a-frame";
315
+ }
316
+
317
+ return [index];
318
+ });
319
+ };
320
+
321
+ const EMPTY_RESULT: ResolveStackTraceResult = {
322
+ frames: [],
323
+ resolvedCount: 0,
324
+ sourceMapCount: 0,
325
+ sourceMapsSkippedForSize: 0,
326
+ };
327
+
328
+ const TOO_MANY_FRAMES_MESSAGE: string = `frames must contain at most ${MAX_FRAMES_PER_RESOLVE_REQUEST} stack frames.`;
329
+ const NOT_AN_ARRAY_MESSAGE: string = "frames must be an array of stack frames";
330
+
331
+ describe("POST /telemetry/exceptions/resolve-stack-trace frames cap", () => {
332
+ let projectId: ObjectID;
333
+ let userId: ObjectID;
334
+ let serviceId: ObjectID;
335
+
336
+ interface Spy {
337
+ mock: { calls: Array<Array<unknown>> };
338
+ mockResolvedValue: (value: ResolveStackTraceResult) => unknown;
339
+ mockRejectedValue: (value: unknown) => unknown;
340
+ }
341
+
342
+ let resolveFramesForService: Spy;
343
+ let sanitizeMinifiedStackFrames: Spy;
344
+
345
+ beforeAll(() => {
346
+ recordedRoutes.length = 0;
347
+ /*
348
+ * Loaded lazily rather than with a top-level import: TelemetryAPI calls
349
+ * Express.getRouter() at module scope, so a static import would run the
350
+ * mock factory before `telemetryRouter` is initialised and die in the
351
+ * temporal dead zone.
352
+ */
353
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
354
+ require("../../../Server/API/TelemetryAPI");
355
+ });
356
+
357
+ beforeEach(() => {
358
+ jest.clearAllMocks();
359
+
360
+ projectId = ObjectID.generate();
361
+ userId = ObjectID.generate();
362
+ serviceId = ObjectID.generate();
363
+
364
+ /*
365
+ * CI runs the Common suite with BILLING_ENABLED=true (see test-setup.sh),
366
+ * so getDatabaseCommonInteractionProps resolves the caller's plan through
367
+ * ProjectService.getCurrentPlan. These fixtures use a project that never
368
+ * exists in the database, so the real lookup throws and the handler's
369
+ * catch swallows the request before it reaches the frames guard. Billing
370
+ * is orthogonal to the cap, so stub the plan lookup and let the rest run.
371
+ */
372
+ jest
373
+ .spyOn(ProjectService, "getCurrentPlan")
374
+ .mockResolvedValue({ plan: null, isSubscriptionUnpaid: false });
375
+
376
+ resolveFramesForService = jest.spyOn(
377
+ TelemetrySourceMapService,
378
+ "resolveFramesForService" as never,
379
+ ) as unknown as Spy;
380
+ resolveFramesForService.mockResolvedValue(EMPTY_RESULT);
381
+
382
+ /*
383
+ * Spied, not stubbed: the real implementation still runs, so the cases
384
+ * that assert what the handler forwards are exercising real sanitize
385
+ * output while the call log proves whether sanitize ran at all.
386
+ */
387
+ sanitizeMinifiedStackFrames = jest.spyOn(
388
+ SourceMapResolver,
389
+ "sanitizeMinifiedStackFrames" as never,
390
+ ) as unknown as Spy;
391
+ });
392
+
393
+ afterEach(() => {
394
+ jest.restoreAllMocks();
395
+ });
396
+
397
+ type CallFunction = (body: unknown) => Promise<CallResult>;
398
+
399
+ const call: CallFunction = (body: unknown): Promise<CallResult> => {
400
+ return callRoute({
401
+ request: buildPrincipal({ projectId: projectId, userId: userId }),
402
+ body: body,
403
+ });
404
+ };
405
+
406
+ type BodyWithFramesFunction = (frames: unknown) => JSONObject;
407
+
408
+ const bodyWithFrames: BodyWithFramesFunction = (
409
+ frames: unknown,
410
+ ): JSONObject => {
411
+ return {
412
+ serviceId: serviceId.toString(),
413
+ serviceVersion: "1.4.2",
414
+ frames: frames,
415
+ } as JSONObject;
416
+ };
417
+
418
+ type ForwardedFramesFunction = () => Array<MinifiedStackFrame>;
419
+
420
+ const forwardedFrames: ForwardedFramesFunction =
421
+ (): Array<MinifiedStackFrame> => {
422
+ const argument: JSONObject = resolveFramesForService.mock
423
+ .calls[0]![0] as JSONObject;
424
+
425
+ return argument["frames"] as unknown as Array<MinifiedStackFrame>;
426
+ };
427
+
428
+ describe("route registration", () => {
429
+ test("the route is registered as POST behind the exception-read guard chain", () => {
430
+ const route: RecordedRoute = findRoute(RESOLVE_ROUTE);
431
+
432
+ expect(route.uri).toBe(RESOLVE_ROUTE);
433
+ // getUserMiddleware, requireUserAuthentication, requirePermission, handler.
434
+ expect(route.handlers).toHaveLength(4);
435
+ });
436
+ });
437
+
438
+ describe("the limit itself", () => {
439
+ test("MAX_FRAMES_PER_RESOLVE_REQUEST is 10000", () => {
440
+ expect(MAX_FRAMES_PER_RESOLVE_REQUEST).toBe(10000);
441
+ });
442
+
443
+ /*
444
+ * The two bounds do different jobs and must not be confused for each
445
+ * other: MAX_FRAMES_TO_RESOLVE is how many frames get *resolved* against
446
+ * a map, this one is how many a caller may *submit*. If the request cap
447
+ * ever slid down to the resolve cap, browsers that send deep async traces
448
+ * would start getting 400s instead of a partially-resolved trace, so the
449
+ * gap between them is deliberate and worth pinning.
450
+ */
451
+ test("the request cap sits far above the per-request resolve cap", () => {
452
+ expect(MAX_FRAMES_PER_RESOLVE_REQUEST).toBeGreaterThan(
453
+ MAX_FRAMES_TO_RESOLVE,
454
+ );
455
+ expect(MAX_FRAMES_PER_RESOLVE_REQUEST).toBeGreaterThanOrEqual(
456
+ MAX_FRAMES_TO_RESOLVE * 10,
457
+ );
458
+ });
459
+ });
460
+
461
+ describe("accepted sizes", () => {
462
+ test("a single frame resolves", async () => {
463
+ const result: CallResult = await call(bodyWithFrames(makeFrames(1)));
464
+
465
+ expect(result.deniedWith).toBeUndefined();
466
+ expect(resolveFramesForService.mock.calls).toHaveLength(1);
467
+ expect(forwardedFrames()).toHaveLength(1);
468
+ });
469
+
470
+ test("one frame under the cap is accepted", async () => {
471
+ const result: CallResult = await call(
472
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST - 1)),
473
+ );
474
+
475
+ expect(result.deniedWith).toBeUndefined();
476
+ expect(resolveFramesForService.mock.calls).toHaveLength(1);
477
+ expect(forwardedFrames()).toHaveLength(
478
+ MAX_FRAMES_PER_RESOLVE_REQUEST - 1,
479
+ );
480
+ });
481
+
482
+ /*
483
+ * The boundary. The guard is a `>` comparison, so a trace of exactly the
484
+ * cap is a legal request; an off-by-one here would reject the very
485
+ * payload the constant advertises as the maximum.
486
+ */
487
+ test("exactly MAX_FRAMES_PER_RESOLVE_REQUEST frames is accepted, not rejected by the cap", async () => {
488
+ const result: CallResult = await call(
489
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST)),
490
+ );
491
+
492
+ expect(result.deniedWith).toBeUndefined();
493
+ expect(result.thrownToNext).toBeUndefined();
494
+ expect(resolveFramesForService.mock.calls).toHaveLength(1);
495
+ });
496
+
497
+ /*
498
+ * And it is accepted in full. sanitize does not truncate, and the handler
499
+ * does not either — which is precisely why the cap has to exist at this
500
+ * layer rather than being left to a downstream slice.
501
+ */
502
+ test("an at-cap request forwards all 10000 frames — nothing truncates on the way through", async () => {
503
+ await call(bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST)));
504
+
505
+ expect(forwardedFrames()).toHaveLength(MAX_FRAMES_PER_RESOLVE_REQUEST);
506
+ expect(forwardedFrames()).not.toHaveLength(MAX_FRAMES_TO_RESOLVE);
507
+ });
508
+
509
+ test("an empty frames array is accepted — the cap only bounds the top end", async () => {
510
+ const result: CallResult = await call(bodyWithFrames([]));
511
+
512
+ expect(result.deniedWith).toBeUndefined();
513
+ expect(resolveFramesForService.mock.calls).toHaveLength(1);
514
+ expect(forwardedFrames()).toHaveLength(0);
515
+ });
516
+
517
+ test("an accepted request returns the resolver's result to the caller", async () => {
518
+ const resolved: ResolveStackTraceResult = {
519
+ frames: [],
520
+ resolvedCount: 3,
521
+ sourceMapCount: 2,
522
+ sourceMapsSkippedForSize: 1,
523
+ };
524
+ resolveFramesForService.mockResolvedValue(resolved);
525
+
526
+ const result: CallResult = await call(
527
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST)),
528
+ );
529
+
530
+ expect(result.jsonBody).toMatchObject({
531
+ resolvedCount: 3,
532
+ sourceMapCount: 2,
533
+ sourceMapsSkippedForSize: 1,
534
+ });
535
+ });
536
+
537
+ test("the accepted request is scoped to the caller's tenant and body service", async () => {
538
+ await call(bodyWithFrames(makeFrames(10)));
539
+
540
+ const argument: JSONObject = resolveFramesForService.mock
541
+ .calls[0]![0] as JSONObject;
542
+
543
+ expect((argument["projectId"] as ObjectID).toString()).toBe(
544
+ projectId.toString(),
545
+ );
546
+ expect((argument["serviceId"] as ObjectID).toString()).toBe(
547
+ serviceId.toString(),
548
+ );
549
+ expect(argument["serviceVersion"]).toBe("1.4.2");
550
+ });
551
+ });
552
+
553
+ describe("rejected sizes", () => {
554
+ /*
555
+ * One over the boundary. This is the case the cap exists for, and the
556
+ * only place the off-by-one can be caught from the outside.
557
+ */
558
+ test("one frame over the cap is rejected with a BadDataException", async () => {
559
+ const result: CallResult = await call(
560
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
561
+ );
562
+
563
+ expect(result.deniedWith).toBeInstanceOf(BadDataException);
564
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
565
+ });
566
+
567
+ /*
568
+ * The message has to name the limit: the caller is a build tool or a
569
+ * browser SDK batching frames, and "too many frames" without the number
570
+ * gives it nothing to clamp to.
571
+ */
572
+ test("the rejection message names the limit", async () => {
573
+ const result: CallResult = await call(
574
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
575
+ );
576
+
577
+ expect(result.deniedWith?.message).toBe(TOO_MANY_FRAMES_MESSAGE);
578
+ expect(result.deniedWith?.message).toContain(
579
+ String(MAX_FRAMES_PER_RESOLVE_REQUEST),
580
+ );
581
+ });
582
+
583
+ test("a wildly oversized array is rejected the same way, not merely trimmed", async () => {
584
+ const result: CallResult = await call(
585
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST * 2)),
586
+ );
587
+
588
+ expect(result.deniedWith).toBeInstanceOf(BadDataException);
589
+ expect(result.deniedWith?.message).toBe(TOO_MANY_FRAMES_MESSAGE);
590
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
591
+ });
592
+
593
+ test("no response body is produced for a rejected request", async () => {
594
+ const result: CallResult = await call(
595
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
596
+ );
597
+
598
+ expect(result.jsonBody).toBeUndefined();
599
+ expect(result.thrownToNext).toBeUndefined();
600
+ });
601
+ });
602
+
603
+ describe("guard ordering: the cap runs AFTER the Array.isArray check", () => {
604
+ /*
605
+ * A non-array `frames` must keep its own precise error. If the length
606
+ * check were hoisted above the type check it would read `.length` off
607
+ * whatever the caller sent — and a string, or any array-like object,
608
+ * has a length — so a plainly malformed body would come back complaining
609
+ * about a limit it never approached.
610
+ */
611
+ test("a non-array frames value gets the array error, not the length error", async () => {
612
+ const result: CallResult = await call(bodyWithFrames({ zero: "frame" }));
613
+
614
+ expect(result.deniedWith).toBeInstanceOf(BadDataException);
615
+ expect(result.deniedWith?.message).toBe(NOT_AN_ARRAY_MESSAGE);
616
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
617
+ });
618
+
619
+ test("an array-like object longer than the cap still gets the array error", async () => {
620
+ const result: CallResult = await call(
621
+ bodyWithFrames({ length: MAX_FRAMES_PER_RESOLVE_REQUEST + 1 }),
622
+ );
623
+
624
+ expect(result.deniedWith?.message).toBe(NOT_AN_ARRAY_MESSAGE);
625
+ expect(result.deniedWith?.message).not.toBe(TOO_MANY_FRAMES_MESSAGE);
626
+ });
627
+
628
+ test("a string longer than the cap still gets the array error", async () => {
629
+ const result: CallResult = await call(
630
+ bodyWithFrames("f".repeat(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
631
+ );
632
+
633
+ expect(result.deniedWith?.message).toBe(NOT_AN_ARRAY_MESSAGE);
634
+ expect(result.deniedWith?.message).not.toBe(TOO_MANY_FRAMES_MESSAGE);
635
+ });
636
+
637
+ test("a missing frames field gets the array error", async () => {
638
+ const result: CallResult = await call({
639
+ serviceId: serviceId.toString(),
640
+ serviceVersion: "1.4.2",
641
+ });
642
+
643
+ expect(result.deniedWith?.message).toBe(NOT_AN_ARRAY_MESSAGE);
644
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
645
+ });
646
+
647
+ test("a null frames field gets the array error", async () => {
648
+ const result: CallResult = await call(bodyWithFrames(null));
649
+
650
+ expect(result.deniedWith?.message).toBe(NOT_AN_ARRAY_MESSAGE);
651
+ });
652
+ });
653
+
654
+ describe("guard ordering: the cap runs BEFORE sanitize", () => {
655
+ /*
656
+ * The regression this ordering fixes. sanitize walks every element and
657
+ * silently drops the ones that are not objects, so an oversized array of
658
+ * pure junk sanitizes to [] — and a cap placed after sanitize would see
659
+ * a length of 0, wave the request through, and only then have done the
660
+ * per-element work the cap was supposed to prevent. The caller would get
661
+ * a cheerful empty resolve for a payload the server should have refused.
662
+ */
663
+ test("an oversized array of junk is rejected on length, not silently sanitized to []", async () => {
664
+ const result: CallResult = await call(
665
+ bodyWithFrames(makeJunkFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
666
+ );
667
+
668
+ expect(result.deniedWith).toBeInstanceOf(BadDataException);
669
+ expect(result.deniedWith?.message).toBe(TOO_MANY_FRAMES_MESSAGE);
670
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
671
+ });
672
+
673
+ test("sanitize is never invoked for an oversized array", async () => {
674
+ await call(
675
+ bodyWithFrames(makeJunkFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
676
+ );
677
+
678
+ expect(sanitizeMinifiedStackFrames.mock.calls).toHaveLength(0);
679
+ });
680
+
681
+ test("sanitize is never invoked for an oversized array of well-formed frames either", async () => {
682
+ await call(
683
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
684
+ );
685
+
686
+ expect(sanitizeMinifiedStackFrames.mock.calls).toHaveLength(0);
687
+ });
688
+
689
+ /*
690
+ * The other half of the ordering: under the cap, sanitize still runs and
691
+ * still does its filtering. The guard bounds the work; it does not
692
+ * replace the type coercion.
693
+ */
694
+ test("an under-cap array of junk does reach sanitize and comes out empty", async () => {
695
+ const result: CallResult = await call(
696
+ bodyWithFrames(makeJunkFrames(MAX_FRAMES_PER_RESOLVE_REQUEST)),
697
+ );
698
+
699
+ expect(result.deniedWith).toBeUndefined();
700
+ expect(sanitizeMinifiedStackFrames.mock.calls).toHaveLength(1);
701
+ expect(forwardedFrames()).toHaveLength(0);
702
+ });
703
+
704
+ test("an at-cap mixed array forwards only the object frames sanitize kept", async () => {
705
+ const mixed: Array<unknown> = [
706
+ ...makeFrames(4),
707
+ ...makeJunkFrames(MAX_FRAMES_PER_RESOLVE_REQUEST - 4),
708
+ ];
709
+
710
+ const result: CallResult = await call(bodyWithFrames(mixed));
711
+
712
+ expect(result.deniedWith).toBeUndefined();
713
+ expect(forwardedFrames()).toHaveLength(4);
714
+ });
715
+ });
716
+
717
+ describe("guard ordering: serviceId and serviceVersion are checked first", () => {
718
+ /*
719
+ * The identity checks stay in front of the cap. A request that is both
720
+ * oversized and missing its serviceId is not a limits problem — telling
721
+ * the caller about the frame limit would send them off trimming a trace
722
+ * when the actual defect is an unset field, and they would hit the same
723
+ * wall again with a shorter payload.
724
+ */
725
+ test("an oversized request missing serviceId is refused for serviceId", async () => {
726
+ const result: CallResult = await call({
727
+ serviceVersion: "1.4.2",
728
+ frames: makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1),
729
+ } as unknown as JSONObject);
730
+
731
+ expect(result.deniedWith?.message).toBe("serviceId is required");
732
+ expect(result.deniedWith?.message).not.toBe(TOO_MANY_FRAMES_MESSAGE);
733
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
734
+ });
735
+
736
+ test("an oversized request with a non-string serviceId is refused for serviceId", async () => {
737
+ const result: CallResult = await call({
738
+ serviceId: 42,
739
+ serviceVersion: "1.4.2",
740
+ frames: makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1),
741
+ } as unknown as JSONObject);
742
+
743
+ expect(result.deniedWith?.message).toBe("serviceId is required");
744
+ });
745
+
746
+ test("an oversized request missing serviceVersion is refused for serviceVersion", async () => {
747
+ const result: CallResult = await call({
748
+ serviceId: serviceId.toString(),
749
+ frames: makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1),
750
+ } as unknown as JSONObject);
751
+
752
+ expect(result.deniedWith?.message).toBe("serviceVersion is required");
753
+ expect(result.deniedWith?.message).not.toBe(TOO_MANY_FRAMES_MESSAGE);
754
+ });
755
+
756
+ /*
757
+ * And the tenant check stays in front of everything: an unscoped request
758
+ * must never get as far as reporting anything about its payload.
759
+ */
760
+ test("an oversized request without a tenant is refused for the project, not the frames", async () => {
761
+ jest
762
+ .spyOn(CommonAPI, "getDatabaseCommonInteractionProps")
763
+ .mockResolvedValue({
764
+ tenantId: undefined,
765
+ userType: UserType.User,
766
+ } as unknown as DatabaseCommonInteractionProps);
767
+
768
+ const result: CallResult = await call(
769
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
770
+ );
771
+
772
+ expect(result.deniedWith?.message).toBe("Invalid Project ID");
773
+ expect(resolveFramesForService.mock.calls).toHaveLength(0);
774
+ });
775
+ });
776
+
777
+ describe("the cap is a request guard, not an error handler", () => {
778
+ /*
779
+ * A rejected request answers the caller directly; it must not fall
780
+ * through to express' error path, which would turn a 400 into a 500.
781
+ */
782
+ test("an oversized request is answered, not thrown to next", async () => {
783
+ const result: CallResult = await call(
784
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST + 1)),
785
+ );
786
+
787
+ expect(result.thrownToNext).toBeUndefined();
788
+ expect(result.deniedWith).toBeDefined();
789
+ });
790
+
791
+ // A failure below the guard still goes to next, as it always did.
792
+ test("a resolver failure on an accepted request still reaches the error handler", async () => {
793
+ resolveFramesForService.mockRejectedValue(
794
+ new Error("clickhouse said no"),
795
+ );
796
+
797
+ const result: CallResult = await call(
798
+ bodyWithFrames(makeFrames(MAX_FRAMES_PER_RESOLVE_REQUEST)),
799
+ );
800
+
801
+ expect(result.thrownToNext).toBeDefined();
802
+ expect(result.jsonBody).toBeUndefined();
803
+ });
804
+ });
805
+ });