@oneuptime/common 12.0.30 → 12.0.31

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 (489) 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/DetectionRule.ts +16 -5
  5. package/Models/DatabaseModels/GoogleSecOpsConnection.ts +14 -5
  6. package/Models/DatabaseModels/IncidentSeverity.ts +44 -0
  7. package/Models/DatabaseModels/Index.ts +2 -0
  8. package/Models/DatabaseModels/NetworkDevice.ts +113 -3
  9. package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +88 -0
  10. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +22 -0
  11. package/Models/DatabaseModels/NetworkDeviceOidTemplate.ts +499 -0
  12. package/Models/DatabaseModels/ThreatIntelFeed.ts +16 -5
  13. package/Server/API/GlobalConfigAPI.ts +362 -183
  14. package/Server/API/TelemetryAPI.ts +42 -4
  15. package/Server/EnvironmentConfig.ts +112 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.ts +59 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.ts +25 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  19. package/Server/Middleware/MultipartFormData.ts +118 -32
  20. package/Server/Services/AlertEpisodeLabelRuleEngineService.ts +9 -1
  21. package/Server/Services/AlertEpisodeOnCallRuleEngineService.ts +9 -1
  22. package/Server/Services/AlertEpisodeOwnerRuleEngineService.ts +9 -1
  23. package/Server/Services/AlertEpisodePrivacyRuleEngineService.ts +9 -1
  24. package/Server/Services/AlertGroupingEngineService.ts +9 -1
  25. package/Server/Services/AlertLabelRuleEngineService.ts +9 -1
  26. package/Server/Services/AlertOnCallRuleEngineService.ts +9 -1
  27. package/Server/Services/AlertOwnerRuleEngineService.ts +9 -1
  28. package/Server/Services/AlertPrivacyRuleEngineService.ts +9 -1
  29. package/Server/Services/AlertReminderRuleService.ts +9 -1
  30. package/Server/Services/AutoRemediationRuleEngineService.ts +9 -1
  31. package/Server/Services/CephClusterLabelRuleEngineService.ts +9 -1
  32. package/Server/Services/CephClusterOwnerRuleEngineService.ts +9 -1
  33. package/Server/Services/CloudResourceLabelRuleEngineService.ts +9 -1
  34. package/Server/Services/CloudResourceOwnerRuleEngineService.ts +9 -1
  35. package/Server/Services/DashboardLabelRuleEngineService.ts +9 -1
  36. package/Server/Services/DashboardOwnerRuleEngineService.ts +9 -1
  37. package/Server/Services/DockerHostLabelRuleEngineService.ts +9 -1
  38. package/Server/Services/DockerHostOwnerRuleEngineService.ts +9 -1
  39. package/Server/Services/DockerSwarmClusterLabelRuleEngineService.ts +9 -1
  40. package/Server/Services/DockerSwarmClusterOwnerRuleEngineService.ts +9 -1
  41. package/Server/Services/HostLabelRuleEngineService.ts +9 -1
  42. package/Server/Services/HostOwnerRuleEngineService.ts +9 -1
  43. package/Server/Services/IncidentEpisodeLabelRuleEngineService.ts +9 -1
  44. package/Server/Services/IncidentEpisodeOnCallRuleEngineService.ts +9 -1
  45. package/Server/Services/IncidentEpisodeOwnerRuleEngineService.ts +9 -1
  46. package/Server/Services/IncidentEpisodePrivacyRuleEngineService.ts +9 -1
  47. package/Server/Services/IncidentGroupingEngineService.ts +9 -1
  48. package/Server/Services/IncidentLabelRuleEngineService.ts +9 -1
  49. package/Server/Services/IncidentOnCallRuleEngineService.ts +9 -1
  50. package/Server/Services/IncidentOwnerRuleEngineService.ts +9 -1
  51. package/Server/Services/IncidentPrivacyRuleEngineService.ts +9 -1
  52. package/Server/Services/IncidentReminderRuleService.ts +9 -1
  53. package/Server/Services/IncidentSlaRuleService.ts +9 -1
  54. package/Server/Services/IncomingCallPolicyLabelRuleEngineService.ts +9 -1
  55. package/Server/Services/IncomingCallPolicyOwnerRuleEngineService.ts +9 -1
  56. package/Server/Services/Index.ts +2 -0
  57. package/Server/Services/IoTFleetLabelRuleEngineService.ts +9 -1
  58. package/Server/Services/IoTFleetOwnerRuleEngineService.ts +9 -1
  59. package/Server/Services/KubernetesClusterLabelRuleEngineService.ts +9 -1
  60. package/Server/Services/KubernetesClusterOwnerRuleEngineService.ts +9 -1
  61. package/Server/Services/KubernetesResourceService.ts +5 -1
  62. package/Server/Services/MonitorLabelRuleEngineService.ts +9 -1
  63. package/Server/Services/MonitorOwnerRuleEngineService.ts +9 -1
  64. package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +35 -0
  65. package/Server/Services/NetworkDeviceAutoImportRuleService.ts +96 -0
  66. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +9 -1
  67. package/Server/Services/NetworkDeviceOidTemplateService.ts +201 -0
  68. package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +9 -1
  69. package/Server/Services/NetworkDeviceService.ts +209 -1
  70. package/Server/Services/OnCallDutyPolicyLabelRuleEngineService.ts +9 -1
  71. package/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.ts +9 -1
  72. package/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.ts +9 -1
  73. package/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.ts +9 -1
  74. package/Server/Services/PodmanHostLabelRuleEngineService.ts +9 -1
  75. package/Server/Services/PodmanHostOwnerRuleEngineService.ts +9 -1
  76. package/Server/Services/ProxmoxClusterLabelRuleEngineService.ts +9 -1
  77. package/Server/Services/ProxmoxClusterOwnerRuleEngineService.ts +9 -1
  78. package/Server/Services/RumApplicationLabelRuleEngineService.ts +9 -1
  79. package/Server/Services/RumApplicationOwnerRuleEngineService.ts +9 -1
  80. package/Server/Services/RunbookLabelRuleEngineService.ts +9 -1
  81. package/Server/Services/RunbookOwnerRuleEngineService.ts +9 -1
  82. package/Server/Services/RunbookRuleEngineService.ts +9 -1
  83. package/Server/Services/ScheduledMaintenanceLabelRuleEngineService.ts +9 -1
  84. package/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.ts +9 -1
  85. package/Server/Services/ScheduledMaintenanceReminderRuleService.ts +9 -1
  86. package/Server/Services/ServerlessFunctionLabelRuleEngineService.ts +9 -1
  87. package/Server/Services/ServerlessFunctionOwnerRuleEngineService.ts +9 -1
  88. package/Server/Services/ServiceLabelRuleEngineService.ts +9 -1
  89. package/Server/Services/ServiceOwnerRuleEngineService.ts +9 -1
  90. package/Server/Services/StatusPageLabelRuleEngineService.ts +9 -1
  91. package/Server/Services/StatusPageMonitorRuleEngineService.ts +7 -0
  92. package/Server/Services/StatusPageOwnerRuleEngineService.ts +9 -1
  93. package/Server/Services/TelemetrySourceMapService.ts +266 -23
  94. package/Server/Services/UserService.ts +27 -0
  95. package/Server/Services/WorkflowLabelRuleEngineService.ts +9 -1
  96. package/Server/Services/WorkflowOwnerRuleEngineService.ts +9 -1
  97. package/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.ts +186 -0
  98. package/Server/Utils/Monitor/CapturedMetricAttributeUtil.ts +245 -0
  99. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +21 -2
  100. package/Server/Utils/Monitor/MonitorMetricUtil.ts +55 -21
  101. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +32 -0
  102. package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +15 -2
  103. package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +18 -1
  104. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +10 -0
  105. package/Server/Utils/Monitor/SeriesResourceLabels.ts +34 -0
  106. package/Server/Utils/Rules/RuleEngineRuleRead.ts +48 -0
  107. package/Server/Utils/Telemetry/ExceptionSanitizer.ts +14 -1
  108. package/Server/Utils/Telemetry/LogExceptionExtractor.ts +14 -2
  109. package/Server/Utils/Telemetry/SourceMapResolver.ts +16 -5
  110. package/Server/Utils/Telemetry/StackTraceParser.ts +399 -0
  111. package/Tests/App/Dashboard/EventOverlayHook.test.tsx +125 -0
  112. package/Tests/App/Dashboard/HeaderImageAssets.test.tsx +93 -0
  113. package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +3 -3
  114. package/Tests/App/Dashboard/UserElementEmail.test.tsx +12 -4
  115. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +1 -1
  116. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +14 -0
  117. package/Tests/Models/DatabaseModels/ModelRegistryInvariants.test.ts +469 -0
  118. package/Tests/Models/SecurityDomainAccessControl.test.ts +429 -0
  119. package/Tests/Server/API/GlobalConfigLicense.test.ts +657 -0
  120. package/Tests/Server/API/SecurityEventAttributesAPI.test.ts +84 -6
  121. package/Tests/Server/API/TelemetryResolveStackTraceAPI.test.ts +805 -0
  122. package/Tests/Server/Infrastructure/Postgres/AddOnCallCalendarFeedsMigration.test.ts +32 -7
  123. package/Tests/Server/Middleware/IdentityRateLimit.test.ts +1144 -0
  124. package/Tests/Server/Middleware/MultipartFormData.test.ts +618 -3
  125. package/Tests/Server/Services/MonitorLabelRuleEngineScale.test.ts +520 -0
  126. package/Tests/Server/Services/NetworkDeviceOidTemplateService.test.ts +332 -0
  127. package/Tests/Server/Services/NetworkDeviceOidTemplateWriteGuards.test.ts +409 -0
  128. package/Tests/Server/Services/RuleEngineRuleFetchLimit.test.ts +239 -0
  129. package/Tests/Server/Services/TelemetrySourceMapService.test.ts +1210 -2
  130. package/Tests/Server/Services/UserServiceSeatLimit.test.ts +182 -0
  131. package/Tests/Server/Types/AnalyticsDatabase/SecurityEventModelPermission.test.ts +255 -0
  132. package/Tests/Server/Types/Database/Permissions/ReadBlockPermission.test.ts +212 -0
  133. package/Tests/Server/Types/Database/Permissions/SecurityRoleAccess.test.ts +413 -0
  134. package/Tests/Server/Utils/CodeRepository.test.ts +689 -0
  135. package/Tests/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.test.ts +495 -0
  136. package/Tests/Server/Utils/ExceptionSanitizer.test.ts +77 -0
  137. package/Tests/Server/Utils/Monitor/CapturedMetricAttributeUtil.test.ts +284 -0
  138. package/Tests/Server/Utils/Monitor/MonitorCustomMetricAttributes.test.ts +503 -0
  139. package/Tests/Server/Utils/Monitor/MonitorTemplatePrototypePollution.test.ts +106 -0
  140. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkLogWritePath.test.ts +33 -4
  141. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +14 -4
  142. package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +44 -0
  143. package/Tests/Server/Utils/OpenAPISpec.test.ts +536 -0
  144. package/Tests/Server/Utils/Rules/RuleEngineRuleRead.test.ts +115 -0
  145. package/Tests/Server/Utils/StackTraceParser.test.ts +610 -0
  146. package/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.ts +0 -0
  147. package/Tests/Server/Utils/Telemetry/SourceMapLimits.test.ts +656 -0
  148. package/Tests/Server/Utils/Telemetry/SourceMapResolver.test.ts +100 -0
  149. package/Tests/Types/Monitor/SnmpMonitor/SnmpOidListUtil.test.ts +454 -0
  150. package/Tests/Types/SecurityRolePermissions.test.ts +193 -0
  151. package/Tests/UI/Components/Charts/AnnotationLayout.test.ts +773 -0
  152. package/Tests/UI/Components/Charts/ChartAnnotationRail.test.tsx +789 -0
  153. package/Tests/UI/Components/Charts/ChartBucketIdentity.test.ts +254 -0
  154. package/Tests/UI/Components/Charts/TimeAnnotation.test.ts +471 -0
  155. package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +405 -0
  156. package/Tests/UI/Components/ErrorMessageRefreshControl.test.tsx +83 -0
  157. package/Tests/UI/Components/MarkdownConverters.test.ts +686 -0
  158. package/Tests/UI/Components/ModelTable/BaseModelTableDeleteAndEmptyStates.test.tsx +341 -0
  159. package/Tests/UI/Components/OrderedStatesList.test.tsx +5 -5
  160. package/Tests/UI/Components/PendingProjectInvitations.test.tsx +1 -1
  161. package/Tests/UI/Components/TableSortAndMobileColumns.test.tsx +195 -0
  162. package/Tests/UI/Components/XAxis.test.ts +270 -5
  163. package/Tests/UI/Components/XAxisDaylightSaving.test.ts +113 -0
  164. package/Tests/UI/Styles/ChartFocusRing.test.ts +153 -0
  165. package/Tests/UI/Styles/ChartFocusRingCoverage.test.tsx +377 -0
  166. package/Tests/UI/Styles/ThemeStylesheet.ts +162 -0
  167. package/Tests/Utils/EnterpriseLicenseSeats.test.ts +507 -0
  168. package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +951 -1
  169. package/Tests/Utils/NetworkDiscovery/DiscoveredHostUtil.test.ts +238 -0
  170. package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +1056 -0
  171. package/Tests/Utils/NetworkDiscovery/ReverseDnsNameUtil.test.ts +882 -0
  172. package/Types/Date.ts +39 -0
  173. package/Types/Monitor/SnmpMonitor/SnmpOidListUtil.ts +333 -0
  174. package/Types/Permission.ts +96 -0
  175. package/Types/Rum/SessionReplay.ts +21 -0
  176. package/Types/Telemetry/SourceMap.ts +8 -0
  177. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.tsx +176 -0
  178. package/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.ts +745 -0
  179. package/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.tsx +576 -0
  180. package/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.tsx +204 -0
  181. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +491 -544
  182. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +324 -372
  183. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +487 -540
  184. package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +7 -3
  185. package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +14 -3
  186. package/UI/Components/Charts/Types/ChartEventKind.ts +13 -0
  187. package/UI/Components/Charts/Types/ReferenceRegionProps.ts +6 -0
  188. package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +20 -3
  189. package/UI/Components/Charts/Utils/TimeAnnotation.ts +69 -35
  190. package/UI/Components/Charts/Utils/XAxis.ts +125 -18
  191. package/UI/Components/EditionLabel/EditionLabel.tsx +280 -26
  192. package/UI/Components/ErrorMessage/ErrorMessage.tsx +21 -10
  193. package/UI/Components/Feed/FeedItem.tsx +4 -5
  194. package/UI/Components/Header/HeaderIconDropdownButton.tsx +1 -2
  195. package/UI/Components/Header/UserProfile/UserProfile.tsx +1 -2
  196. package/UI/Components/Image/Image.tsx +20 -3
  197. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  198. package/UI/Components/MemberRoleAssignment/MemberRoleAssignment.tsx +1 -2
  199. package/UI/Components/ModelTable/BaseModelTable.tsx +150 -24
  200. package/UI/Components/Table/TableHeader.tsx +64 -48
  201. package/UI/Components/Table/TableRow.tsx +13 -3
  202. package/UI/Styles/Theme.css +38 -0
  203. package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +271 -0
  204. package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +6 -0
  205. package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +141 -10
  206. package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +55 -3
  207. package/Utils/NetworkDiscovery/ReverseDnsNameUtil.ts +151 -0
  208. package/Utils/Rules/RuleEngineLimits.ts +32 -0
  209. package/build/dist/Models/AnalyticsModels/SecurityEvent.js +48 -16
  210. package/build/dist/Models/AnalyticsModels/SecurityEvent.js.map +1 -1
  211. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js +10 -5
  212. package/build/dist/Models/AnalyticsModels/ThreatIntelIndicator.js.map +1 -1
  213. package/build/dist/Models/DatabaseModels/AlertSeverity.js +46 -1
  214. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  215. package/build/dist/Models/DatabaseModels/DetectionRule.js +16 -5
  216. package/build/dist/Models/DatabaseModels/DetectionRule.js.map +1 -1
  217. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js +14 -5
  218. package/build/dist/Models/DatabaseModels/GoogleSecOpsConnection.js.map +1 -1
  219. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +46 -1
  220. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  221. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  222. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  223. package/build/dist/Models/DatabaseModels/NetworkDevice.js +115 -3
  224. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  225. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +88 -0
  226. package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -1
  227. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  228. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js +519 -0
  229. package/build/dist/Models/DatabaseModels/NetworkDeviceOidTemplate.js.map +1 -0
  230. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js +16 -5
  231. package/build/dist/Models/DatabaseModels/ThreatIntelFeed.js.map +1 -1
  232. package/build/dist/Server/API/GlobalConfigAPI.js +293 -176
  233. package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
  234. package/build/dist/Server/API/TelemetryAPI.js +31 -3
  235. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  236. package/build/dist/Server/EnvironmentConfig.js +83 -0
  237. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  238. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js +26 -0
  239. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790500000000-AddNetworkDeviceOidTemplate.js.map +1 -0
  240. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js +14 -0
  241. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790600000000-AddAutoImportRuleOidTemplate.js.map +1 -0
  242. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  243. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  244. package/build/dist/Server/Middleware/MultipartFormData.js +93 -28
  245. package/build/dist/Server/Middleware/MultipartFormData.js.map +1 -1
  246. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js +8 -1
  247. package/build/dist/Server/Services/AlertEpisodeLabelRuleEngineService.js.map +1 -1
  248. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js +8 -1
  249. package/build/dist/Server/Services/AlertEpisodeOnCallRuleEngineService.js.map +1 -1
  250. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js +8 -1
  251. package/build/dist/Server/Services/AlertEpisodeOwnerRuleEngineService.js.map +1 -1
  252. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js +8 -1
  253. package/build/dist/Server/Services/AlertEpisodePrivacyRuleEngineService.js.map +1 -1
  254. package/build/dist/Server/Services/AlertGroupingEngineService.js +8 -1
  255. package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
  256. package/build/dist/Server/Services/AlertLabelRuleEngineService.js +8 -1
  257. package/build/dist/Server/Services/AlertLabelRuleEngineService.js.map +1 -1
  258. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js +8 -1
  259. package/build/dist/Server/Services/AlertOnCallRuleEngineService.js.map +1 -1
  260. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js +8 -1
  261. package/build/dist/Server/Services/AlertOwnerRuleEngineService.js.map +1 -1
  262. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js +8 -1
  263. package/build/dist/Server/Services/AlertPrivacyRuleEngineService.js.map +1 -1
  264. package/build/dist/Server/Services/AlertReminderRuleService.js +8 -1
  265. package/build/dist/Server/Services/AlertReminderRuleService.js.map +1 -1
  266. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +8 -1
  267. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  268. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js +8 -1
  269. package/build/dist/Server/Services/CephClusterLabelRuleEngineService.js.map +1 -1
  270. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js +8 -1
  271. package/build/dist/Server/Services/CephClusterOwnerRuleEngineService.js.map +1 -1
  272. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js +8 -1
  273. package/build/dist/Server/Services/CloudResourceLabelRuleEngineService.js.map +1 -1
  274. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js +8 -1
  275. package/build/dist/Server/Services/CloudResourceOwnerRuleEngineService.js.map +1 -1
  276. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js +8 -1
  277. package/build/dist/Server/Services/DashboardLabelRuleEngineService.js.map +1 -1
  278. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js +8 -1
  279. package/build/dist/Server/Services/DashboardOwnerRuleEngineService.js.map +1 -1
  280. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js +8 -1
  281. package/build/dist/Server/Services/DockerHostLabelRuleEngineService.js.map +1 -1
  282. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js +8 -1
  283. package/build/dist/Server/Services/DockerHostOwnerRuleEngineService.js.map +1 -1
  284. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js +8 -1
  285. package/build/dist/Server/Services/DockerSwarmClusterLabelRuleEngineService.js.map +1 -1
  286. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js +8 -1
  287. package/build/dist/Server/Services/DockerSwarmClusterOwnerRuleEngineService.js.map +1 -1
  288. package/build/dist/Server/Services/HostLabelRuleEngineService.js +8 -1
  289. package/build/dist/Server/Services/HostLabelRuleEngineService.js.map +1 -1
  290. package/build/dist/Server/Services/HostOwnerRuleEngineService.js +8 -1
  291. package/build/dist/Server/Services/HostOwnerRuleEngineService.js.map +1 -1
  292. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js +8 -1
  293. package/build/dist/Server/Services/IncidentEpisodeLabelRuleEngineService.js.map +1 -1
  294. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js +8 -1
  295. package/build/dist/Server/Services/IncidentEpisodeOnCallRuleEngineService.js.map +1 -1
  296. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js +8 -1
  297. package/build/dist/Server/Services/IncidentEpisodeOwnerRuleEngineService.js.map +1 -1
  298. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js +8 -1
  299. package/build/dist/Server/Services/IncidentEpisodePrivacyRuleEngineService.js.map +1 -1
  300. package/build/dist/Server/Services/IncidentGroupingEngineService.js +8 -1
  301. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  302. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js +8 -1
  303. package/build/dist/Server/Services/IncidentLabelRuleEngineService.js.map +1 -1
  304. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js +8 -1
  305. package/build/dist/Server/Services/IncidentOnCallRuleEngineService.js.map +1 -1
  306. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js +8 -1
  307. package/build/dist/Server/Services/IncidentOwnerRuleEngineService.js.map +1 -1
  308. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js +8 -1
  309. package/build/dist/Server/Services/IncidentPrivacyRuleEngineService.js.map +1 -1
  310. package/build/dist/Server/Services/IncidentReminderRuleService.js +8 -1
  311. package/build/dist/Server/Services/IncidentReminderRuleService.js.map +1 -1
  312. package/build/dist/Server/Services/IncidentSlaRuleService.js +8 -1
  313. package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
  314. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js +8 -1
  315. package/build/dist/Server/Services/IncomingCallPolicyLabelRuleEngineService.js.map +1 -1
  316. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js +8 -1
  317. package/build/dist/Server/Services/IncomingCallPolicyOwnerRuleEngineService.js.map +1 -1
  318. package/build/dist/Server/Services/Index.js +2 -0
  319. package/build/dist/Server/Services/Index.js.map +1 -1
  320. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js +8 -1
  321. package/build/dist/Server/Services/IoTFleetLabelRuleEngineService.js.map +1 -1
  322. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js +8 -1
  323. package/build/dist/Server/Services/IoTFleetOwnerRuleEngineService.js.map +1 -1
  324. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js +8 -1
  325. package/build/dist/Server/Services/KubernetesClusterLabelRuleEngineService.js.map +1 -1
  326. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js +8 -1
  327. package/build/dist/Server/Services/KubernetesClusterOwnerRuleEngineService.js.map +1 -1
  328. package/build/dist/Server/Services/KubernetesResourceService.js +5 -1
  329. package/build/dist/Server/Services/KubernetesResourceService.js.map +1 -1
  330. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js +8 -1
  331. package/build/dist/Server/Services/MonitorLabelRuleEngineService.js.map +1 -1
  332. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js +8 -1
  333. package/build/dist/Server/Services/MonitorOwnerRuleEngineService.js.map +1 -1
  334. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +30 -21
  335. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
  336. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +64 -0
  337. package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -1
  338. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +8 -1
  339. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
  340. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js +180 -0
  341. package/build/dist/Server/Services/NetworkDeviceOidTemplateService.js.map +1 -0
  342. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +8 -1
  343. package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -1
  344. package/build/dist/Server/Services/NetworkDeviceService.js +154 -1
  345. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  346. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js +8 -1
  347. package/build/dist/Server/Services/OnCallDutyPolicyLabelRuleEngineService.js.map +1 -1
  348. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js +8 -1
  349. package/build/dist/Server/Services/OnCallDutyPolicyOwnerRuleEngineService.js.map +1 -1
  350. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js +8 -1
  351. package/build/dist/Server/Services/OnCallDutyPolicyScheduleLabelRuleEngineService.js.map +1 -1
  352. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js +8 -1
  353. package/build/dist/Server/Services/OnCallDutyPolicyScheduleOwnerRuleEngineService.js.map +1 -1
  354. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js +8 -1
  355. package/build/dist/Server/Services/PodmanHostLabelRuleEngineService.js.map +1 -1
  356. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js +8 -1
  357. package/build/dist/Server/Services/PodmanHostOwnerRuleEngineService.js.map +1 -1
  358. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js +8 -1
  359. package/build/dist/Server/Services/ProxmoxClusterLabelRuleEngineService.js.map +1 -1
  360. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js +8 -1
  361. package/build/dist/Server/Services/ProxmoxClusterOwnerRuleEngineService.js.map +1 -1
  362. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js +8 -1
  363. package/build/dist/Server/Services/RumApplicationLabelRuleEngineService.js.map +1 -1
  364. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js +8 -1
  365. package/build/dist/Server/Services/RumApplicationOwnerRuleEngineService.js.map +1 -1
  366. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js +8 -1
  367. package/build/dist/Server/Services/RunbookLabelRuleEngineService.js.map +1 -1
  368. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js +8 -1
  369. package/build/dist/Server/Services/RunbookOwnerRuleEngineService.js.map +1 -1
  370. package/build/dist/Server/Services/RunbookRuleEngineService.js +8 -1
  371. package/build/dist/Server/Services/RunbookRuleEngineService.js.map +1 -1
  372. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js +8 -1
  373. package/build/dist/Server/Services/ScheduledMaintenanceLabelRuleEngineService.js.map +1 -1
  374. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js +8 -1
  375. package/build/dist/Server/Services/ScheduledMaintenanceOwnerRuleEngineService.js.map +1 -1
  376. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js +8 -1
  377. package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js.map +1 -1
  378. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js +8 -1
  379. package/build/dist/Server/Services/ServerlessFunctionLabelRuleEngineService.js.map +1 -1
  380. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js +8 -1
  381. package/build/dist/Server/Services/ServerlessFunctionOwnerRuleEngineService.js.map +1 -1
  382. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js +8 -1
  383. package/build/dist/Server/Services/ServiceLabelRuleEngineService.js.map +1 -1
  384. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js +8 -1
  385. package/build/dist/Server/Services/ServiceOwnerRuleEngineService.js.map +1 -1
  386. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js +8 -1
  387. package/build/dist/Server/Services/StatusPageLabelRuleEngineService.js.map +1 -1
  388. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js +6 -0
  389. package/build/dist/Server/Services/StatusPageMonitorRuleEngineService.js.map +1 -1
  390. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js +8 -1
  391. package/build/dist/Server/Services/StatusPageOwnerRuleEngineService.js.map +1 -1
  392. package/build/dist/Server/Services/TelemetrySourceMapService.js +213 -19
  393. package/build/dist/Server/Services/TelemetrySourceMapService.js.map +1 -1
  394. package/build/dist/Server/Services/UserService.js +25 -0
  395. package/build/dist/Server/Services/UserService.js.map +1 -1
  396. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js +8 -1
  397. package/build/dist/Server/Services/WorkflowLabelRuleEngineService.js.map +1 -1
  398. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js +8 -1
  399. package/build/dist/Server/Services/WorkflowOwnerRuleEngineService.js.map +1 -1
  400. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js +145 -0
  401. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js.map +1 -0
  402. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js +201 -0
  403. package/build/dist/Server/Utils/Monitor/CapturedMetricAttributeUtil.js.map +1 -0
  404. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +19 -2
  405. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  406. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +42 -23
  407. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  408. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +29 -0
  409. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  410. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +11 -2
  411. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -1
  412. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +16 -1
  413. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -1
  414. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +10 -0
  415. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
  416. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +33 -0
  417. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
  418. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js +37 -0
  419. package/build/dist/Server/Utils/Rules/RuleEngineRuleRead.js.map +1 -0
  420. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js +12 -1
  421. package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js.map +1 -1
  422. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +14 -2
  423. package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -1
  424. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js +15 -5
  425. package/build/dist/Server/Utils/Telemetry/SourceMapResolver.js.map +1 -1
  426. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js +307 -0
  427. package/build/dist/Server/Utils/Telemetry/StackTraceParser.js.map +1 -1
  428. package/build/dist/Types/Date.js +27 -0
  429. package/build/dist/Types/Date.js.map +1 -1
  430. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js +253 -0
  431. package/build/dist/Types/Monitor/SnmpMonitor/SnmpOidListUtil.js.map +1 -0
  432. package/build/dist/Types/Permission.js +86 -0
  433. package/build/dist/Types/Permission.js.map +1 -1
  434. package/build/dist/Types/Rum/SessionReplay.js +19 -0
  435. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  436. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js +83 -0
  437. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationHoverCard.js.map +1 -0
  438. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js +531 -0
  439. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/AnnotationLayout.js.map +1 -0
  440. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js +264 -0
  441. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/ChartAnnotationLayer.js.map +1 -0
  442. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js +122 -0
  443. package/build/dist/UI/Components/Charts/ChartLibrary/Annotations/UseChartAnnotations.js.map +1 -0
  444. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +213 -233
  445. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  446. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +139 -152
  447. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  448. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +212 -232
  449. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  450. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js +14 -0
  451. package/build/dist/UI/Components/Charts/Types/ChartEventKind.js.map +1 -0
  452. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +57 -28
  453. package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -1
  454. package/build/dist/UI/Components/Charts/Utils/XAxis.js +103 -17
  455. package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
  456. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +198 -23
  457. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  458. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +15 -5
  459. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
  460. package/build/dist/UI/Components/Feed/FeedItem.js +4 -5
  461. package/build/dist/UI/Components/Feed/FeedItem.js.map +1 -1
  462. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -2
  463. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  464. package/build/dist/UI/Components/Header/UserProfile/UserProfile.js.map +1 -1
  465. package/build/dist/UI/Components/Image/Image.js +6 -1
  466. package/build/dist/UI/Components/Image/Image.js.map +1 -1
  467. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  468. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  469. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js +1 -2
  470. package/build/dist/UI/Components/MemberRoleAssignment/MemberRoleAssignment.js.map +1 -1
  471. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +104 -23
  472. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  473. package/build/dist/UI/Components/Table/TableHeader.js +20 -22
  474. package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
  475. package/build/dist/UI/Components/Table/TableRow.js +13 -4
  476. package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
  477. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +153 -0
  478. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +1 -0
  479. package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -1
  480. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +127 -7
  481. package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -1
  482. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +50 -3
  483. package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -1
  484. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js +132 -0
  485. package/build/dist/Utils/NetworkDiscovery/ReverseDnsNameUtil.js.map +1 -0
  486. package/build/dist/Utils/Rules/RuleEngineLimits.js +31 -0
  487. package/build/dist/Utils/Rules/RuleEngineLimits.js.map +1 -0
  488. package/jest.config.json +1 -0
  489. package/package.json +2 -2
@@ -0,0 +1,153 @@
1
+ export default class EnterpriseLicenseSeatsUtil {
2
+ /*
3
+ * How many seats are in use, and whether one more user fits.
4
+ *
5
+ * The awkward part is that a license is shared by every instance the
6
+ * customer runs, and only oneuptime.com can deduplicate users across them —
7
+ * the same person on staging and production is one seat. So this instance
8
+ * has two numbers and neither one is the answer on its own:
9
+ *
10
+ * localUserCount live, but blind to the customer's other instances.
11
+ * aggregatedUserCount complete, but up to a day old, so it does not know
12
+ * about anyone added since the last daily report —
13
+ * including the user being added right now.
14
+ *
15
+ * Combining them needs to know how much of the aggregate is NOT ours, which
16
+ * is what the per-instance breakdown is for: subtract our own last reported
17
+ * count from the aggregate and what is left is other instances. Add the live
18
+ * local count back and the result is current on this instance and complete
19
+ * on the others.
20
+ *
21
+ * When the breakdown does not say — an older license server that sends no
22
+ * instance list, an instance that has never registered — there is nothing to
23
+ * subtract, and the fallback is the larger of the two numbers on their own.
24
+ * That is the only case where the stale aggregate decides anything: with a
25
+ * usable breakdown it is deliberately NOT maxed in, because it would then
26
+ * outvote the live count in the one direction that hurts. Free twenty seats
27
+ * by deleting twenty users and a stale aggregate would go on refusing new
28
+ * ones until the next daily report.
29
+ *
30
+ * Which way it is allowed to be wrong: under-enforcing is recoverable (the
31
+ * next daily report corrects the count, and the breach emails already go
32
+ * out), over-enforcing locks a paying customer out of their own instance.
33
+ * So every "I cannot tell" branch below resolves towards under-enforcing.
34
+ */
35
+ static getSeatUsage(input) {
36
+ var _a;
37
+ const userLimit = this.parseUserLimit(input.userLimit);
38
+ const localUserCount = (_a = this.parseCount(input.localUserCount)) !== null && _a !== void 0 ? _a : 0;
39
+ const aggregatedUserCount = this.parseCount(input.aggregatedUserCount);
40
+ /*
41
+ * Null means the report is not complete enough to attribute seats to
42
+ * anybody, which is a different thing from attributing zero to them.
43
+ */
44
+ const otherInstanceSeats = this.getSeatsUsedByOtherInstances({
45
+ aggregatedUserCount: aggregatedUserCount,
46
+ instances: input.instances,
47
+ thisInstanceId: input.thisInstanceId,
48
+ });
49
+ const seatsUsedByOtherInstances = otherInstanceSeats !== null && otherInstanceSeats !== void 0 ? otherInstanceSeats : 0;
50
+ const seatsInUse = otherInstanceSeats === null
51
+ ? Math.max(localUserCount, aggregatedUserCount !== null && aggregatedUserCount !== void 0 ? aggregatedUserCount : 0)
52
+ : otherInstanceSeats + localUserCount;
53
+ if (userLimit === null) {
54
+ return {
55
+ isEnforced: false,
56
+ userLimit: null,
57
+ seatsInUse: seatsInUse,
58
+ seatsRemaining: null,
59
+ hasSeatForNewUser: true,
60
+ seatsUsedByOtherInstances: seatsUsedByOtherInstances,
61
+ };
62
+ }
63
+ return {
64
+ isEnforced: true,
65
+ userLimit: userLimit,
66
+ seatsInUse: seatsInUse,
67
+ seatsRemaining: Math.max(0, userLimit - seatsInUse),
68
+ hasSeatForNewUser: seatsInUse < userLimit,
69
+ seatsUsedByOtherInstances: seatsUsedByOtherInstances,
70
+ };
71
+ }
72
+ /*
73
+ * The message an administrator reads when a seat could not be taken. Built
74
+ * here rather than at each throw site so the invite form, the signup form
75
+ * and SSO/SCIM provisioning all explain the same thing the same way, and so
76
+ * the tests can assert on it without copying the wording.
77
+ */
78
+ static getSeatLimitReachedMessage(data) {
79
+ return (`This OneUptime installation has reached the ${data.userLimit.toLocaleString()}-user ` +
80
+ `limit of its enterprise license (${data.seatsInUse.toLocaleString()} in use). New users ` +
81
+ `cannot be invited, signed up or provisioned until a seat is freed up or the license is ` +
82
+ `expanded. Contact sales@oneuptime.com to add seats, then use "Refresh license" in the ` +
83
+ `edition dialog to apply the new limit.`);
84
+ }
85
+ /*
86
+ * The part of the aggregate that belongs to instances other than this one,
87
+ * or null when the report does not say.
88
+ *
89
+ * Null rather than zero, because the two lead somewhere different: zero means
90
+ * "this installation is the only one holding seats", and null means "the
91
+ * report cannot be decomposed, fall back to comparing the two totals". Every
92
+ * missing or unusable field lands on null.
93
+ *
94
+ * In particular, an instance list that does not contain us is NOT treated as
95
+ * "then all of the aggregate is somebody else's". That reading is right for a
96
+ * genuinely unregistered instance, and catastrophic for an instance whose id
97
+ * changed after its users were already counted under the old one: it would
98
+ * count this installation's users twice and lock it out.
99
+ */
100
+ static getSeatsUsedByOtherInstances(data) {
101
+ const aggregatedUserCount = data.aggregatedUserCount;
102
+ if (aggregatedUserCount === null) {
103
+ return null;
104
+ }
105
+ if (!Array.isArray(data.instances) || data.instances.length === 0) {
106
+ return null;
107
+ }
108
+ const thisInstanceId = typeof data.thisInstanceId === "string" ? data.thisInstanceId.trim() : "";
109
+ if (!thisInstanceId) {
110
+ return null;
111
+ }
112
+ const thisInstance = data.instances.find((instance) => {
113
+ return Boolean(instance) && instance.instanceId === thisInstanceId;
114
+ });
115
+ if (!thisInstance) {
116
+ return null;
117
+ }
118
+ const ownReportedCount = this.parseCount(thisInstance.userCount);
119
+ if (ownReportedCount === null) {
120
+ return null;
121
+ }
122
+ return Math.max(0, aggregatedUserCount - ownReportedCount);
123
+ }
124
+ /*
125
+ * A limit is only a limit when it is a positive whole number.
126
+ *
127
+ * Zero is deliberately read as "no limit" rather than "no seats at all",
128
+ * matching every other place in the product that measures seat usage
129
+ * (the license modal, the breach notification job). A license that really
130
+ * grants nobody an account is not a thing OneUptime issues, and reading a
131
+ * stray zero the other way would leave an installation unable to create even
132
+ * its first user.
133
+ */
134
+ static parseUserLimit(value) {
135
+ if (typeof value !== "number" ||
136
+ !Number.isFinite(value) ||
137
+ !Number.isInteger(value) ||
138
+ value <= 0) {
139
+ return null;
140
+ }
141
+ return value;
142
+ }
143
+ static parseCount(value) {
144
+ if (typeof value !== "number" ||
145
+ !Number.isFinite(value) ||
146
+ !Number.isInteger(value) ||
147
+ value < 0) {
148
+ return null;
149
+ }
150
+ return value;
151
+ }
152
+ }
153
+ //# sourceMappingURL=EnterpriseLicenseSeats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnterpriseLicenseSeats.js","sourceRoot":"","sources":["../../../../Utils/EnterpriseLicense/EnterpriseLicenseSeats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gBAAgB,GAAkB,IAAI,CAAC,UAAU,CACrD,YAAY,CAAC,SAAS,CACvB,CAAC;QAEF,IAAI,gBAAgB,KAAK,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACK,MAAM,CAAC,cAAc,CAAC,KAAc;QAC1C,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACvB,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACxB,KAAK,IAAI,CAAC,EACV,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,KAAc;QACtC,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACvB,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YACxB,KAAK,GAAG,CAAC,EACT,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoImportRuleMatcher.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/AutoImportRuleMatcher.ts"],"names":[],"mappings":"AACA,OAAO,6BAA6B,MAAM,yDAAyD,CAAC;AAEpG,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AA0D9C;;;;;;;;;;GAUG;AACH,MAAM,0BAA0B,GAAW,GAAG,CAAC;AAE/C,SAAS,YAAY,CAA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E,kBAAkB;YAClB,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,EACtE,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,YAAY,CACxB,KAAqC,EACrC,IAA6B;QAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IACE,IAAI,CAAC,WAAW;gBAChB,qBAAqB,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EACjD,CAAC;gBACD,OAAO;oBACL,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,EAAE;oBAChB,cAAc,EAAE,IAAI;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,YAAY,GAAmC,KAAK,CAAC,MAAM,CAC/D,CAAC,IAA6B,EAAW,EAAE;YACzC,OAAO,CACL,CAAC,IAAI,CAAC,WAAW,IAAI,qBAAqB,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CACvE,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,OAAO;YACL,YAAY,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;YACrC,YAAY,EAAE,YAAY;SAC3B,CAAC;IACJ,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"AutoImportRuleMatcher.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/AutoImportRuleMatcher.ts"],"names":[],"mappings":"AACA,OAAO,6BAA6B,MAAM,yDAAyD,CAAC;AAEpG,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAgE9C;;;;;;;;;;GAUG;AACH,MAAM,0BAA0B,GAAW,GAAG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KAAK,CAAC;QACf,CAAC;QAED,IACE,kBAAkB;YAClB,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,EACtE,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,YAAY,CACxB,KAAqC,EACrC,IAA6B;QAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IACE,IAAI,CAAC,WAAW;gBAChB,qBAAqB,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EACjD,CAAC;gBACD,OAAO;oBACL,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,EAAE;oBAChB,cAAc,EAAE,IAAI;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,YAAY,GAAmC,KAAK,CAAC,MAAM,CAC/D,CAAC,IAA6B,EAAW,EAAE;YACzC,OAAO,CACL,CAAC,IAAI,CAAC,WAAW,IAAI,qBAAqB,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CACvE,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,OAAO;YACL,YAAY,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;YACrC,YAAY,EAAE,YAAY;SAC3B,CAAC;IACJ,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
@@ -3,6 +3,7 @@ import NetworkDeviceMonitoringMethod from "../../Types/NetworkDevice/NetworkDevi
3
3
  import ObjectID from "../../Types/ObjectID";
4
4
  import SnmpScanConfigUtil from "./SnmpScanConfigUtil";
5
5
  import { monitoringMethodForDiscoveredHost } from "./DiscoveryImportEligibility";
6
+ import { normalizeReverseDnsName } from "./ReverseDnsNameUtil";
6
7
  /*
7
8
  * One discovered host -> one NetworkDevice, the same way everywhere.
8
9
  *
@@ -30,9 +31,76 @@ export const MAX_DEVICE_DESCRIPTION_LENGTH = 500;
30
31
  function truncate(value, maxLength) {
31
32
  return value.length > maxLength ? value.substring(0, maxLength) : value;
32
33
  }
33
- /** The name a discovered host imports under: its sysName, or its address. */
34
+ /**
35
+ * What a discovered host is CALLED — in the Review dialog, and (clamped by
36
+ * `buildDeviceName`) on the device it imports as.
37
+ *
38
+ * Three sources, in this order, first non-empty wins:
39
+ *
40
+ * 1. `sysName`, the name the device gives for itself over SNMP. It stays
41
+ * first because it always has been, and because it is the one name the
42
+ * device itself asserts: demoting it would silently rename devices that
43
+ * import correctly today, which nobody asked for.
44
+ * 2. `dnsHostname`, its reverse-DNS (PTR) name (OneUptime issue #3529).
45
+ * This is the whole point of the addition, and it lands exactly where
46
+ * the complaint was: a host with no readable SNMP has no sysName, so
47
+ * before this it fell straight through to its address. On an estate that
48
+ * keeps DNS records — the reporter's does — that turns a review list of
49
+ * "10.18.166.51, 10.18.166.53, ..." into names an operator recognises.
50
+ * 3. The address, unchanged, when neither name exists.
51
+ *
52
+ * Split out of `buildDeviceName` so the dashboard row and the device it
53
+ * creates cannot disagree: the operator ticks a box next to a name, and that
54
+ * is the name the device gets. Returned UNTRUNCATED, so a caller that wants
55
+ * the full name can have it; the Review dialog and the import both go through
56
+ * `buildDeviceName`, which clamps, so that what is shown is what is created.
57
+ *
58
+ * TWO CONSEQUENCES OF NAMING A DEVICE BY DNS, both accepted deliberately:
59
+ *
60
+ * - Anything that matches on `NetworkDevice.name` now sees a name the
61
+ * SCANNED NETWORK chose. NetworkSiteAssignmentRule and the label/owner
62
+ * rule engines are the live examples: a rule written against a naming
63
+ * convention will match differently for a host that used to be called
64
+ * "10.18.166.51" and is now called "core-gw.corp.example.com". That is
65
+ * inherent to the feature — the alternative is not naming devices by DNS —
66
+ * and it is why the name is put through ReverseDnsNameUtil rather than
67
+ * trusted. Rules keyed on `hostname` are unaffected: that stays the IP.
68
+ * - Names stop being unique per host. Addresses were; PTR names are not, and
69
+ * a wildcard reverse zone over a DHCP range gives every host in it the
70
+ * same answer. `buildFallbackDeviceName` is the answer to that, and BOTH
71
+ * import paths must use it — the rule engine does, and the dashboard's
72
+ * Review-dialog import does since the same wildcard case made collisions
73
+ * ordinary rather than rare.
74
+ */
75
+ export function getDiscoveredHostDisplayName(host) {
76
+ var _a;
77
+ /*
78
+ * The PTR name is re-normalised here rather than trusted from the column.
79
+ * `discoveredDevices` is jsonb stored verbatim from the probe's payload, so
80
+ * "the probe already checked it" holds only for the probe version that
81
+ * wrote the row — not for a result from an older or a modified probe, and
82
+ * not for a row written straight through the API. This function is the last
83
+ * point before the value becomes a rendered line and a slugified device
84
+ * name, so it is the right place to be sure. See ReverseDnsNameUtil.
85
+ */
86
+ /*
87
+ * `sysName` is read through a typeof guard rather than trusted, for the
88
+ * same reason `dnsHostname` is normalised: both come out of the same
89
+ * verbatim jsonb blob, where the declared TypeScript type is a description
90
+ * of what the probe SHOULD send rather than a guarantee about what is
91
+ * stored. `(42).trim()` is a TypeError, and since this function became the
92
+ * dashboard's name line that TypeError would be thrown during render —
93
+ * taking out the whole Review dialog rather than one row, which is
94
+ * precisely the failure normalizeDiscoveredHosts was written to end.
95
+ */
96
+ const sysName = typeof host.sysName === "string" ? host.sysName.trim() : "";
97
+ return (sysName ||
98
+ normalizeReverseDnsName(host.dnsHostname) ||
99
+ String((_a = host.ipAddress) !== null && _a !== void 0 ? _a : ""));
100
+ }
101
+ /** The name a discovered host imports under, clamped to the slug's ceiling. */
34
102
  export function buildDeviceName(host) {
35
- return truncate((host.sysName || "").trim() || host.ipAddress, MAX_DEVICE_NAME_LENGTH);
103
+ return truncate(getDiscoveredHostDisplayName(host), MAX_DEVICE_NAME_LENGTH);
36
104
  }
37
105
  /**
38
106
  * The fallback name when `buildDeviceName`'s answer is already taken.
@@ -44,10 +112,38 @@ export function buildDeviceName(host) {
44
112
  * ceiling.
45
113
  */
46
114
  export function buildFallbackDeviceName(host) {
47
- const suffix = ` (${host.ipAddress})`;
115
+ var _a;
116
+ /*
117
+ * The address is read through the SAME coercion the display path uses, not
118
+ * straight out of the jsonb.
119
+ *
120
+ * A raw template read turned a missing address into the literal
121
+ * " (undefined)" and an object one into " ([object Object])" — and those
122
+ * tokens are IDENTICAL for every such host, so the fallback produced the
123
+ * same name again and the retry failed on the very duplicate it was
124
+ * retrying. This function exists to break a name collision; a suffix that
125
+ * collides is worse than useless.
126
+ */
127
+ const address = String((_a = host.ipAddress) !== null && _a !== void 0 ? _a : "").trim();
128
+ /*
129
+ * An address-less host gets no suffix at all rather than an empty pair of
130
+ * brackets. There is nothing to tell it apart BY, so the honest outcome is
131
+ * the base name unchanged — the caller's create then fails on the duplicate,
132
+ * which is the truth, instead of succeeding under a name that pretends to
133
+ * carry an address.
134
+ */
135
+ const suffix = address ? ` (${address})` : "";
48
136
  const baseName = buildDeviceName(host);
49
- return (truncate(baseName, Math.max(1, MAX_DEVICE_NAME_LENGTH - suffix.length)) +
50
- suffix);
137
+ /*
138
+ * Clamped as a whole, not just the base. `Math.max(1, ...)` keeps a
139
+ * character of the base name however long the suffix is, so an absurd
140
+ * address — the field is never validated on this path, it is whatever the
141
+ * probe wrote — could compose a name past the ceiling and fail the create on
142
+ * the slug's own length, which is the exact overflow the ceiling exists to
143
+ * prevent.
144
+ */
145
+ return truncate(truncate(baseName, Math.max(1, MAX_DEVICE_NAME_LENGTH - suffix.length)) +
146
+ suffix, MAX_DEVICE_NAME_LENGTH);
51
147
  }
52
148
  /**
53
149
  * The NetworkDevice a discovered host imports as.
@@ -63,12 +159,33 @@ export function buildFallbackDeviceName(host) {
63
159
  * `buildFallbackDeviceName(host)` without re-deciding anything else.
64
160
  */
65
161
  export function buildNetworkDeviceFromDiscoveredHost(data) {
162
+ var _a;
66
163
  const host = data.host;
67
164
  const device = new NetworkDevice();
68
165
  device.projectId = data.projectId;
69
166
  device.name = data.name || buildDeviceName(host);
70
- // The address is the device's hostname AND the registered-host dedup key.
71
- device.hostname = host.ipAddress;
167
+ /*
168
+ * The address is the device's hostname AND the registered-host dedup key.
169
+ *
170
+ * It stays the ADDRESS even when the host resolved a PTR name, which is
171
+ * what issue #3529 asked for in as many words ("retain the IP address as
172
+ * the address/IP field"), and what the rest of the system needs: this
173
+ * column is what the ingest path matches a scan's results against
174
+ * (NetworkDeviceService.getRegisteredHostnames), what the SNMP poller
175
+ * dials, and what a trap's source IP is correlated to. Storing a name here
176
+ * would make a device stop polling the day its reverse zone changed, and
177
+ * would make the same host import twice — once by address, once by name.
178
+ * The PTR record names the device; it does not address it.
179
+ *
180
+ * COERCED, because the dedup key has to be a string. The value comes out of
181
+ * jsonb, and `getRegisteredHostnames` matches it with `Set.has()` against
182
+ * hostnames read back from the database — and `Set.has` does not coerce, so
183
+ * a numeric address stored raw would never match its own registered device
184
+ * and the host would import again on every review. The dashboard path is
185
+ * already covered by normalizeDiscoveredHosts; this makes the builder safe
186
+ * for the rule engine and for any future caller that holds a raw row.
187
+ */
188
+ device.hostname = String((_a = host.ipAddress) !== null && _a !== void 0 ? _a : "").trim();
72
189
  if (host.sysDescr) {
73
190
  device.description = truncate(host.sysDescr, MAX_DEVICE_DESCRIPTION_LENGTH);
74
191
  }
@@ -82,6 +199,9 @@ export function buildNetworkDeviceFromDiscoveredHost(data) {
82
199
  device.isPollingEnabled = false;
83
200
  return device;
84
201
  }
202
+ if (data.oidTemplateId) {
203
+ device.oidTemplateId = data.oidTemplateId;
204
+ }
85
205
  if (data.autoApplyVendorHealthTemplate) {
86
206
  device.autoApplyVendorHealthTemplate = true;
87
207
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DiscoveredDeviceBuilder.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2CAA2C,CAAC;AAEtE,OAAO,6BAA6B,MAAM,yDAAyD,CAAC;AACpG,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,kBAEN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B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AAM,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;IAClD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { normalizeReverseDnsName } from "./ReverseDnsNameUtil";
1
2
  /*
2
3
  * Normalisation for a scan's stored results, shared by every reader of the
3
4
  * `discoveredDevices` jsonb column: the dashboard's Review dialog and the
@@ -34,7 +35,12 @@ function isDiscoveredHostObject(host) {
34
35
  * import, so whether a device already in the inventory got created a
35
36
  * second time depended on which order the probe happened to list them in.
36
37
  *
37
- * All three are fixed here rather than at each call site, so the row the
38
+ * A fourth was added with reverse DNS (issue #3529) and is not a probe bug at
39
+ * all — `dnsHostname` is a value the SCANNED NETWORK chooses, so it is
40
+ * untrusted by construction rather than by accident, and it is normalised
41
+ * here for the same reason: one reading of the payload for every reader.
42
+ *
43
+ * All of them are fixed here rather than at each call site, so the row the
38
44
  * operator sees, the badge above it, the list Import walks, and the hosts an
39
45
  * auto-import rule evaluates can never be working from different readings of
40
46
  * the same payload.
@@ -50,9 +56,50 @@ export function normalizeDiscoveredHosts(hosts) {
50
56
  * truthy, so it used to pass selectability and import as a Network Device
51
57
  * whose hostname was a single space.
52
58
  */
53
- cleaned.push(Object.assign(Object.assign({}, host), { ipAddress: host.ipAddress === undefined || host.ipAddress === null
59
+ const normalized = Object.assign(Object.assign({}, host), { ipAddress: host.ipAddress === undefined || host.ipAddress === null
54
60
  ? ""
55
- : String(host.ipAddress).trim() }));
61
+ : String(host.ipAddress).trim() });
62
+ /*
63
+ * `sysName` is read straight out of the jsonb, its declared type is not
64
+ * enforced by anything, and every reader calls a string method on it. A
65
+ * numeric sysName reached getDiscoveredHostDisplayName and threw inside
66
+ * the Review dialog's render, taking out the whole modal rather than one
67
+ * row — the same failure the null-row case above is about.
68
+ *
69
+ * A non-string is blanked rather than STRINGIFIED, which is where this
70
+ * differs from the address above. `String(null)` is "null" and
71
+ * `String({})` is "[object Object]", and both are truthy — so stringifying
72
+ * would not merely fail to name the host, it would win the naming contest
73
+ * outright and create a device called "null", beating a perfectly good PTR
74
+ * record on the very same row. An empty string is falsy, so naming falls
75
+ * through to `dnsHostname` and then to the address, which is exactly what
76
+ * a host with no readable system name deserves.
77
+ *
78
+ * Only rewritten when it is NOT already a string, so a host that never had
79
+ * the key does not gain an empty one — `sysName` is optional and
80
+ * `"sysName" in host` is a question other code is entitled to ask.
81
+ */
82
+ if (host.sysName !== undefined && typeof host.sysName !== "string") {
83
+ normalized.sysName = "";
84
+ }
85
+ /*
86
+ * The PTR name gets the same treatment, for a sharper version of the same
87
+ * reason (OneUptime issue #3529): unlike every other field here, its
88
+ * value was chosen by whoever runs DNS for the scanned subnet — routinely
89
+ * not this project — and it is stored verbatim in jsonb. So the rules
90
+ * about what a name may contain are applied on the way OUT of the column
91
+ * as well as on the way in, and anything that fails them is DELETED
92
+ * rather than blanked, so a reader that checks `if (host.dnsHostname)`
93
+ * and a reader that checks `"dnsHostname" in host` cannot disagree.
94
+ */
95
+ const dnsHostname = normalizeReverseDnsName(host.dnsHostname);
96
+ if (dnsHostname) {
97
+ normalized.dnsHostname = dnsHostname;
98
+ }
99
+ else {
100
+ delete normalized.dnsHostname;
101
+ }
102
+ cleaned.push(normalized);
56
103
  }
57
104
  // An address the scan reports as registered is registered on every row.
58
105
  const registeredIpAddresses = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"DiscoveredHostUtil.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/DiscoveredHostUtil.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,IAAa;IAEb,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAqC;IAErC,MAAM,OAAO,GAAmC,EAAE,CAAC;IAEnD,KAAK,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B,EAAE,CAAC;YAC/C,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,IAAI,qBAAqB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAA6B,EAAE,EAAE;QACnD,IACE,IAAI,CAAC,mBAAmB;YACxB,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1C,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,uCAAY,IAAI,KAAE,mBAAmB,EAAE,IAAI,IAAG;IAChD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,132 @@
1
+ /*
2
+ * What a PTR record is allowed to become, shared by the probe that performs
3
+ * the lookup and by every reader of the name it stored (OneUptime issue
4
+ * #3529).
5
+ *
6
+ * A discovered host's `dnsHostname` is the ONLY field in a scan result whose
7
+ * value is chosen by the scanned network rather than by OneUptime or by the
8
+ * operator: it is whatever a PTR record on some resolver says, and a
9
+ * discovery scan is routinely pointed at a subnet nobody in the project
10
+ * administers. That value then becomes a NetworkDevice's name, its slug, and
11
+ * a line in the Review dialog — so it is normalised HERE, once, by a pure
12
+ * function both sides call, rather than trusted anywhere.
13
+ *
14
+ * Normalising on the probe alone would not be enough. `discoveredDevices` is
15
+ * jsonb written verbatim from the probe's payload (ProbeIngest/
16
+ * DiscoveryScan.ts), so the server's own copy of these rules is what holds
17
+ * for results stored by a probe running a different version, and for rows
18
+ * hand-written through the API. Normalising on the server alone would not be
19
+ * enough either: the probe should not spend a scan's storage on names it
20
+ * knows will be discarded. Both call this.
21
+ */
22
+ /*
23
+ * A DNS name is at most 255 octets on the wire; the presentation form tops
24
+ * out at 253 characters once the length prefixes and root label are removed.
25
+ * NetworkDevice.name is varchar(100) and DiscoveredDeviceBuilder clamps to 80
26
+ * for the slug's sake, so this ceiling never decides a device name on its own
27
+ * — it is here to reject a value that was never a DNS name to begin with.
28
+ */
29
+ export const MAX_REVERSE_DNS_NAME_LENGTH = 253;
30
+ // RFC 1035 section 2.3.4: labels are 63 octets or fewer.
31
+ export const MAX_REVERSE_DNS_LABEL_LENGTH = 63;
32
+ /*
33
+ * One label: letters, digits, hyphen — plus underscore, which is not legal in
34
+ * a hostname but IS common in the wild (Windows/DHCP-registered names, and
35
+ * plenty of hand-authored reverse zones), and rejecting it would throw away
36
+ * real names for a standards point nothing here depends on. A hyphen may not
37
+ * lead or trail.
38
+ *
39
+ * Everything else is refused, and the refusals are the point: a name is
40
+ * rendered in the dashboard, slugified into a URL, and written to a varchar.
41
+ * Whitespace, quotes, angle brackets, slashes, control characters and
42
+ * non-ASCII all mean the answer was not a hostname, and a scan of an
43
+ * untrusted subnet is exactly where that shows up.
44
+ */
45
+ const LABEL_PATTERN = /^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/;
46
+ /*
47
+ * The reverse-lookup zones themselves. A resolver that echoes the query name
48
+ * back — some do, on certain failure modes — hands us
49
+ * "51.166.18.10.in-addr.arpa", which passes every other rule here and is a
50
+ * strictly worse device name than the address it was derived from.
51
+ */
52
+ const REVERSE_LOOKUP_ZONES = ["in-addr.arpa", "ip6.arpa"];
53
+ /*
54
+ * True when every label is digits — "10.18.166.51", but also "51" and "1.2".
55
+ *
56
+ * This is what keeps a PTR that merely restates the address out of the name
57
+ * field. It matters more than it looks: the whole point of the feature is
58
+ * that a name is more useful than an address, so a "name" that IS the address
59
+ * must fall through to the address rather than be presented as a resolved
60
+ * hostname the operator can trust. Checked as "all labels numeric" rather
61
+ * than as a dotted-quad regex so "51" and "10.18" are caught too.
62
+ */
63
+ const NUMERIC_LABEL_PATTERN = /^[0-9]+$/;
64
+ function isAllNumericLabels(labels) {
65
+ return labels.every((label) => {
66
+ return NUMERIC_LABEL_PATTERN.test(label);
67
+ });
68
+ }
69
+ /**
70
+ * The hostname a PTR answer may be stored and displayed as, or undefined when
71
+ * the answer is not usable as one.
72
+ *
73
+ * Accepts `unknown` rather than `string` on purpose: on the server side the
74
+ * input is a value read out of a jsonb column, and "the probe sent a number"
75
+ * is a case that has to return undefined rather than throw inside a render.
76
+ *
77
+ * Case is PRESERVED. It is whatever the reverse zone was authored with, which
78
+ * is as close to the operator's intent as this data gets, and DNS's own
79
+ * case-insensitivity is not a reason to discard it.
80
+ */
81
+ export function normalizeReverseDnsName(value) {
82
+ if (typeof value !== "string") {
83
+ return undefined;
84
+ }
85
+ const trimmed = value.trim();
86
+ if (!trimmed) {
87
+ return undefined;
88
+ }
89
+ /*
90
+ * Exactly ONE trailing dot is dropped — the root label of a fully qualified
91
+ * name, which some resolvers include and some do not. A second one leaves
92
+ * an empty final label, which the per-label check below refuses; that is
93
+ * deliberate, because "foo.." is malformed rather than "foo." with a typo,
94
+ * and silently repairing it would be inventing a name.
95
+ */
96
+ const withoutRootLabel = trimmed.endsWith(".")
97
+ ? trimmed.substring(0, trimmed.length - 1)
98
+ : trimmed;
99
+ if (!withoutRootLabel) {
100
+ return undefined;
101
+ }
102
+ if (withoutRootLabel.length > MAX_REVERSE_DNS_NAME_LENGTH) {
103
+ return undefined;
104
+ }
105
+ const lowerCased = withoutRootLabel.toLowerCase();
106
+ for (const zone of REVERSE_LOOKUP_ZONES) {
107
+ /*
108
+ * The apex is checked as well as the suffix. `in-addr.arpa` on its own is
109
+ * a legal hostname string that passes every other rule here, and it is
110
+ * what a resolver echoing a truncated query name hands back — a strictly
111
+ * worse label for a device than the address it was derived from.
112
+ */
113
+ if (lowerCased === zone || lowerCased.endsWith(`.${zone}`)) {
114
+ return undefined;
115
+ }
116
+ }
117
+ const labels = withoutRootLabel.split(".");
118
+ for (const label of labels) {
119
+ if (!label || label.length > MAX_REVERSE_DNS_LABEL_LENGTH) {
120
+ return undefined;
121
+ }
122
+ if (!LABEL_PATTERN.test(label)) {
123
+ return undefined;
124
+ }
125
+ }
126
+ if (isAllNumericLabels(labels)) {
127
+ return undefined;
128
+ }
129
+ return withoutRootLabel;
130
+ }
131
+ export default normalizeReverseDnsName;
132
+ //# sourceMappingURL=ReverseDnsNameUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReverseDnsNameUtil.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/ReverseDnsNameUtil.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAW,GAAG,CAAC;AAEvD,yDAAyD;AACzD,MAAM,CAAC,MAAM,4BAA4B,GAAW,EAAE,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,aAAa,GAAW,+CAA+C,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,oBAAoB,GAAkB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,qBAAqB,GAAW,UAAU,CAAC;AAEjD,SAAS,kBAAkB,CAAC,MAAqB;IAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAa,EAAE,EAAE;QACpC,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAc;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAW,KAAK,CAAC,IAAI,EAAE,CAAC;IAErC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,gBAAgB,GAAW,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1C,CAAC,CAAC,OAAO,CAAC;IAEZ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,2BAA2B,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAW,gBAAgB,CAAC,WAAW,EAAE,CAAC;IAE1D,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;QACxC;;;;;WAKG;QACH,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3D,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAkB,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE1D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,4BAA4B,EAAE,CAAC;YAC1D,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
2
+ /*
3
+ * How many of a project's automation rules one engine run reads.
4
+ *
5
+ * Every rule engine — label, owner, on-call, privacy, auto-remediation,
6
+ * runbook — answers the same question when a resource is created: "which of
7
+ * this project's enabled rules match it?". That read used to be written as
8
+ * `limit: 100, skip: 0`, which is not a page of a paged walk but the whole
9
+ * evaluation: rule 101 and beyond were fetched by nobody and therefore
10
+ * matched nothing, forever.
11
+ *
12
+ * Nothing surfaced it. The engines have no queue, no cursor and no counter;
13
+ * they run inline in the resource's onCreateSuccess and log only what they
14
+ * attached. A project with 1,243 monitor label rules imported 1,000+ monitors
15
+ * and watched ~50-100 of them get labelled while the rest stayed bare, which
16
+ * reads exactly like a backlog draining slowly and is in fact 92% of the
17
+ * rules never being consulted at all (OneUptime/oneuptime#3506).
18
+ *
19
+ * The default sort on these reads is createdAt DESC, so the 100 that DID run
20
+ * were the newest — which is why a rule written early, against a naming
21
+ * convention the estate was later built on, is precisely the kind of rule
22
+ * that went quiet.
23
+ *
24
+ * LIMIT_PER_PROJECT is the codebase's existing bound for "every row of this
25
+ * kind in one project". Rules are hand-authored configuration, so this is a
26
+ * ceiling rather than a page size: a project would need 10,000 enabled rules
27
+ * of a single kind to reach it.
28
+ */
29
+ export const MAX_RULES_EVALUATED_PER_PROJECT = LIMIT_PER_PROJECT;
30
+ export default MAX_RULES_EVALUATED_PER_PROJECT;
31
+ //# sourceMappingURL=RuleEngineLimits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleEngineLimits.js","sourceRoot":"","sources":["../../../../Utils/Rules/RuleEngineLimits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAW,iBAAiB,CAAC;AAEzE,eAAe,+BAA+B,CAAC"}
package/jest.config.json CHANGED
@@ -48,6 +48,7 @@
48
48
  "testEnvironment": "<rootDir>/Tests/Utils/TimezoneEnvironment.js",
49
49
  "setupFilesAfterEnv": ["<rootDir>/Tests/jest.setup.ts"],
50
50
  "collectCoverage": false,
51
+ "testTimeout": 60000,
51
52
  "coverageReporters": ["text", "lcov"],
52
53
  "testRegex": "./Tests/(.*)\\.test\\.(ts|tsx)$",
53
54
  "collectCoverageFrom": ["./**/*.{ts,tsx}"],