@oneuptime/common 11.7.3 → 11.7.4

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 (365) hide show
  1. package/Models/DatabaseModels/AlertEpisodeStateTimeline.ts +1 -0
  2. package/Models/DatabaseModels/AlertStateTimeline.ts +1 -0
  3. package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +1 -0
  4. package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -0
  5. package/Models/DatabaseModels/Index.ts +5 -0
  6. package/Models/DatabaseModels/LogDropFilter.ts +89 -0
  7. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +13 -3
  8. package/Models/DatabaseModels/RecommendationDismissal.ts +463 -0
  9. package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.ts +1 -0
  10. package/Models/DatabaseModels/StatusPageGroup.ts +95 -0
  11. package/Models/DatabaseModels/TraceDropFilter.ts +89 -0
  12. package/Models/DatabaseModels/WorkflowVariable.ts +5 -1
  13. package/Server/API/AlertAPI.ts +32 -17
  14. package/Server/API/BaseAPI.ts +31 -2
  15. package/Server/API/BaseAnalyticsAPI.ts +36 -2
  16. package/Server/API/CommonAPI.ts +57 -0
  17. package/Server/API/IncidentAPI.ts +60 -33
  18. package/Server/API/IncidentEpisodeAPI.ts +31 -16
  19. package/Server/API/MonitorAPI.ts +30 -0
  20. package/Server/API/MonitorTemplateAPI.ts +8 -0
  21. package/Server/API/ProbeAPI.ts +196 -15
  22. package/Server/API/ProjectAPI.ts +79 -1
  23. package/Server/API/ScheduledMaintenanceAPI.ts +33 -18
  24. package/Server/API/StatusPageAPI.ts +74 -37
  25. package/Server/API/WorkspaceNotificationRuleAPI.ts +34 -4
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.ts +527 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.ts +31 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.ts +55 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.ts +53 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  31. package/Server/Services/AlertEpisodeService.ts +47 -0
  32. package/Server/Services/AlertService.ts +125 -0
  33. package/Server/Services/BillingService.ts +98 -0
  34. package/Server/Services/DatabaseService.ts +184 -20
  35. package/Server/Services/IncidentEpisodeService.ts +47 -0
  36. package/Server/Services/IncidentService.ts +123 -0
  37. package/Server/Services/IncidentTemplateService.ts +123 -1
  38. package/Server/Services/Index.ts +2 -0
  39. package/Server/Services/LogDropFilterService.ts +133 -0
  40. package/Server/Services/MonitorProbeService.ts +94 -4
  41. package/Server/Services/MonitorService.ts +48 -43
  42. package/Server/Services/NetworkDeviceDiscoveryScanService.ts +70 -0
  43. package/Server/Services/ProbeService.ts +66 -0
  44. package/Server/Services/ProjectService.ts +131 -7
  45. package/Server/Services/RecommendationDismissalService.ts +52 -0
  46. package/Server/Services/RunbookAgentJobService.ts +68 -7
  47. package/Server/Services/ScheduledMaintenanceService.ts +103 -0
  48. package/Server/Services/ScheduledMaintenanceTemplateService.ts +90 -0
  49. package/Server/Services/StatusPageGroupService.ts +186 -0
  50. package/Server/Services/TraceDropFilterService.ts +133 -0
  51. package/Server/Types/Workflow/Components/API/Delete.ts +12 -0
  52. package/Server/Types/Workflow/Components/API/Get.ts +12 -0
  53. package/Server/Types/Workflow/Components/API/Patch.ts +12 -0
  54. package/Server/Types/Workflow/Components/API/Post.ts +12 -0
  55. package/Server/Types/Workflow/Components/API/Put.ts +13 -0
  56. package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +212 -0
  57. package/Server/Utils/DropFilterValidation.ts +127 -0
  58. package/Server/Utils/Errors.ts +5 -0
  59. package/Server/Utils/Monitor/MonitorAlert.ts +28 -1
  60. package/Server/Utils/Monitor/MonitorIncident.ts +31 -2
  61. package/Server/Utils/Telemetry/AppMetrics.ts +31 -0
  62. package/Tests/Models/DatabaseModels/MonitorProbeColumnAccessControl.test.ts +196 -0
  63. package/Tests/Models/RecommendationDismissalModel.test.ts +269 -0
  64. package/Tests/Server/API/BaseAPIUpdatePayloadValidation.test.ts +320 -0
  65. package/Tests/Server/API/BaseAnalyticsAPIUpdatePayloadValidation.test.ts +293 -0
  66. package/Tests/Server/API/CommonAPIAuthGuard.test.ts +164 -0
  67. package/Tests/Server/API/ProbeAPI.test.ts +422 -53
  68. package/Tests/Server/API/ProjectAPI.test.ts +180 -0
  69. package/Tests/Server/API/ProjectAPIExtendTrialBillingDisabled.test.ts +138 -0
  70. package/Tests/Server/API/ProjectScopedCustomRouteAuth.test.ts +458 -0
  71. package/Tests/Server/Infrastructure/ContainerBootConfiguration.test.ts +359 -0
  72. package/Tests/Server/Infrastructure/ProcessSignalDelivery.test.ts +427 -0
  73. package/Tests/Server/Services/BillingServiceExtendTrial.test.ts +439 -0
  74. package/Tests/Server/Services/CrossProjectReferenceWriteGuard.test.ts +810 -0
  75. package/Tests/Server/Services/DatabaseServiceAtomicAddToColumns.test.ts +269 -0
  76. package/Tests/Server/Services/DatabaseServiceEmptyUpdate.test.ts +277 -0
  77. package/Tests/Server/Services/DatabaseServiceSortColumnSelect.test.ts +201 -0
  78. package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +81 -23
  79. package/Tests/Server/Services/DropFilterSaveValidation.test.ts +398 -0
  80. package/Tests/Server/Services/MonitorProbeDeleteHooks.test.ts +280 -0
  81. package/Tests/Server/Services/MonitorProbeServiceProbeTenancy.test.ts +304 -0
  82. package/Tests/Server/Services/NetworkDeviceDiscoveryScanService.test.ts +262 -0
  83. package/Tests/Server/Services/ProjectServiceExtendTrial.test.ts +614 -0
  84. package/Tests/Server/Services/RecommendationDismissalService.test.ts +306 -0
  85. package/Tests/Server/Services/RepairCrossProjectIncidentReferencesMigration.test.ts +528 -0
  86. package/Tests/Server/Services/StatusPageGroupNesting.test.ts +395 -0
  87. package/Tests/Server/TestingUtils/Services/BillingServiceHelper.ts +26 -21
  88. package/Tests/Server/Types/Database/Permissions/WorkflowVariableColumnPermission.test.ts +227 -0
  89. package/Tests/Server/Types/Workflow/Components/ApiComponentErrorPort.test.ts +285 -0
  90. package/Tests/Server/Utils/Database/ProjectScopedReferenceValidator.test.ts +463 -0
  91. package/Tests/Server/Utils/DropFilterValidation.test.ts +269 -0
  92. package/Tests/Server/Utils/Telemetry/SpanUtil.test.ts +94 -0
  93. package/Tests/Types/DateUserTimezone.test.ts +52 -0
  94. package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +177 -9
  95. package/Tests/Types/Monitor/MonitorStepDnsMonitor.test.ts +105 -0
  96. package/Tests/Types/Monitor/MonitorStepDnssecMonitor.test.ts +131 -0
  97. package/Tests/Types/Monitor/MonitorStepDomainMonitor.test.ts +60 -0
  98. package/Tests/Types/Monitor/MonitorStepExternalStatusPageMonitor.test.ts +82 -0
  99. package/Tests/Types/Monitor/MonitorStepInfrastructureMonitors.test.ts +268 -0
  100. package/Tests/Types/Monitor/MonitorStepMetricMonitor.test.ts +386 -0
  101. package/Tests/Types/Monitor/MonitorStepProfileMonitor.test.ts +185 -0
  102. package/Tests/Types/Monitor/MonitorStepSnmpMonitor.test.ts +156 -0
  103. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +371 -0
  104. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +901 -0
  105. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +607 -0
  106. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.test.ts +754 -0
  107. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +960 -0
  108. package/Tests/Types/RollingTime/RollingTimeUtil.test.ts +186 -0
  109. package/Tests/Types/Runbook/RunbookStepTimeout.test.ts +410 -0
  110. package/Tests/Types/Telemetry/DropFilterSampling.test.ts +241 -0
  111. package/Tests/Types/Workspace/NotificationRuleConditionUtil.test.ts +353 -0
  112. package/Tests/Types/Workspace/NotificationRuleUtil.test.ts +566 -0
  113. package/Tests/UI/Components/CodeEditor.test.tsx +174 -0
  114. package/Tests/UI/Components/ErrorBoundary.test.tsx +555 -24
  115. package/Tests/UI/Components/InfoCard.test.tsx +358 -0
  116. package/Tests/UI/Components/LogTimeRangePicker.test.tsx +138 -0
  117. package/Tests/UI/Components/Modal.test.tsx +43 -5
  118. package/Tests/UI/Components/ModelTable/BaseModelTableSearchLabels.test.tsx +397 -0
  119. package/Tests/UI/Components/ModelTable/ColumnCustomizationModal.test.tsx +427 -0
  120. package/Tests/UI/Components/Runbook/StepTimeoutInput.test.tsx +386 -0
  121. package/Tests/UI/Components/StatusPage/ResourceGroupSection.test.tsx +671 -0
  122. package/Tests/UI/Components/TelemetryTimeRangePicker.test.tsx +404 -0
  123. package/Tests/UI/Utils/DropdownAlignment.test.ts +306 -0
  124. package/Tests/UI/Utils/TableFilterUrlState.test.ts +292 -0
  125. package/Tests/Utils/Monitor/MonitorSummaryProbeUtil.test.ts +263 -0
  126. package/Tests/Utils/NetworkDiscovery/ScanTargetUtil.test.ts +583 -0
  127. package/Tests/Utils/StatusPage/GroupNestingLayout.test.ts +1072 -0
  128. package/Tests/Utils/StatusPage/GroupTree.test.ts +583 -0
  129. package/Tests/Utils/StatusPage/ResourceUptime.test.ts +411 -0
  130. package/Types/Date.ts +15 -6
  131. package/Types/Monitor/KubernetesAlertTemplates.ts +205 -0
  132. package/Types/Monitor/MonitorStep.ts +10 -1
  133. package/Types/Monitor/MonitorStepMetricMonitor.ts +46 -1
  134. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +413 -0
  135. package/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.ts +168 -0
  136. package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +175 -0
  137. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +743 -0
  138. package/Types/Permission.ts +45 -0
  139. package/Types/Recommendation/RecommendationType.ts +20 -0
  140. package/Types/Runbook/RunbookExecutionDeadline.ts +129 -0
  141. package/Types/Runbook/RunbookStepTimeout.ts +202 -0
  142. package/Types/Telemetry/DropFilterSampling.ts +92 -0
  143. package/UI/Components/AI/GenerateFromAIModal.tsx +0 -2
  144. package/UI/Components/Accordion/Accordion.tsx +10 -2
  145. package/UI/Components/BulkUpdate/BulkLabelActions.tsx +0 -1
  146. package/UI/Components/CodeEditor/CodeEditor.tsx +34 -20
  147. package/UI/Components/Date/RangeStartAndEndDateView.tsx +0 -1
  148. package/UI/Components/EditionLabel/EditionLabel.tsx +1 -27
  149. package/UI/Components/Error/PageError.tsx +0 -4
  150. package/UI/Components/ErrorBoundary.tsx +252 -15
  151. package/UI/Components/InfoCard/InfoCard.tsx +58 -1
  152. package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +34 -1
  153. package/UI/Components/Modal/Modal.tsx +16 -60
  154. package/UI/Components/ModelFormModal/ModelFormModal.tsx +0 -8
  155. package/UI/Components/ModelTable/BaseModelTable.tsx +116 -67
  156. package/UI/Components/ModelTable/ColumnCustomizationModal.tsx +150 -47
  157. package/UI/Components/Runbook/StepTimeoutInput.tsx +173 -0
  158. package/UI/Components/StatusPage/ResourceGroupSection.tsx +231 -0
  159. package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +34 -1
  160. package/UI/Utils/DropdownAlignment.ts +162 -0
  161. package/UI/Utils/TableFilterUrlState.ts +59 -20
  162. package/Utils/API.ts +106 -2
  163. package/Utils/Monitor/MonitorSummaryProbeUtil.ts +130 -0
  164. package/Utils/NetworkDiscovery/ScanTargetUtil.ts +434 -0
  165. package/Utils/StatusPage/GroupNestingLayout.ts +343 -0
  166. package/Utils/StatusPage/GroupTree.ts +307 -0
  167. package/Utils/StatusPage/ResourceUptime.ts +90 -17
  168. package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js +1 -0
  169. package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js.map +1 -1
  170. package/build/dist/Models/DatabaseModels/AlertStateTimeline.js +1 -0
  171. package/build/dist/Models/DatabaseModels/AlertStateTimeline.js.map +1 -1
  172. package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +1 -0
  173. package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -1
  174. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -0
  175. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
  176. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  177. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  178. package/build/dist/Models/DatabaseModels/LogDropFilter.js +91 -0
  179. package/build/dist/Models/DatabaseModels/LogDropFilter.js.map +1 -1
  180. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +14 -4
  181. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  182. package/build/dist/Models/DatabaseModels/RecommendationDismissal.js +484 -0
  183. package/build/dist/Models/DatabaseModels/RecommendationDismissal.js.map +1 -0
  184. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -0
  185. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js.map +1 -1
  186. package/build/dist/Models/DatabaseModels/StatusPageGroup.js +94 -0
  187. package/build/dist/Models/DatabaseModels/StatusPageGroup.js.map +1 -1
  188. package/build/dist/Models/DatabaseModels/TraceDropFilter.js +91 -0
  189. package/build/dist/Models/DatabaseModels/TraceDropFilter.js.map +1 -1
  190. package/build/dist/Models/DatabaseModels/WorkflowVariable.js +5 -1
  191. package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
  192. package/build/dist/Server/API/AlertAPI.js +22 -13
  193. package/build/dist/Server/API/AlertAPI.js.map +1 -1
  194. package/build/dist/Server/API/BaseAPI.js +22 -1
  195. package/build/dist/Server/API/BaseAPI.js.map +1 -1
  196. package/build/dist/Server/API/BaseAnalyticsAPI.js +24 -1
  197. package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
  198. package/build/dist/Server/API/CommonAPI.js +42 -0
  199. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  200. package/build/dist/Server/API/IncidentAPI.js +43 -26
  201. package/build/dist/Server/API/IncidentAPI.js.map +1 -1
  202. package/build/dist/Server/API/IncidentEpisodeAPI.js +21 -12
  203. package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
  204. package/build/dist/Server/API/MonitorAPI.js +23 -0
  205. package/build/dist/Server/API/MonitorAPI.js.map +1 -1
  206. package/build/dist/Server/API/MonitorTemplateAPI.js +4 -0
  207. package/build/dist/Server/API/MonitorTemplateAPI.js.map +1 -1
  208. package/build/dist/Server/API/ProbeAPI.js +131 -15
  209. package/build/dist/Server/API/ProbeAPI.js.map +1 -1
  210. package/build/dist/Server/API/ProjectAPI.js +62 -3
  211. package/build/dist/Server/API/ProjectAPI.js.map +1 -1
  212. package/build/dist/Server/API/ScheduledMaintenanceAPI.js +23 -14
  213. package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
  214. package/build/dist/Server/API/StatusPageAPI.js +61 -33
  215. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  216. package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js +26 -2
  217. package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js.map +1 -1
  218. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js +397 -0
  219. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js.map +1 -0
  220. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js +16 -0
  221. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js.map +1 -0
  222. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js +30 -0
  223. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js.map +1 -0
  224. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.js +34 -0
  225. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.js.map +1 -0
  226. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  227. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  228. package/build/dist/Server/Services/AlertEpisodeService.js +39 -0
  229. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  230. package/build/dist/Server/Services/AlertService.js +95 -0
  231. package/build/dist/Server/Services/AlertService.js.map +1 -1
  232. package/build/dist/Server/Services/BillingService.js +71 -0
  233. package/build/dist/Server/Services/BillingService.js.map +1 -1
  234. package/build/dist/Server/Services/DatabaseService.js +140 -17
  235. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  236. package/build/dist/Server/Services/IncidentEpisodeService.js +39 -0
  237. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  238. package/build/dist/Server/Services/IncidentService.js +100 -0
  239. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  240. package/build/dist/Server/Services/IncidentTemplateService.js +97 -0
  241. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  242. package/build/dist/Server/Services/Index.js +2 -0
  243. package/build/dist/Server/Services/Index.js.map +1 -1
  244. package/build/dist/Server/Services/LogDropFilterService.js +93 -0
  245. package/build/dist/Server/Services/LogDropFilterService.js.map +1 -1
  246. package/build/dist/Server/Services/MonitorProbeService.js +73 -5
  247. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  248. package/build/dist/Server/Services/MonitorService.js +34 -39
  249. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  250. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +71 -0
  251. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
  252. package/build/dist/Server/Services/ProbeService.js +64 -0
  253. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  254. package/build/dist/Server/Services/ProjectService.js +103 -7
  255. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  256. package/build/dist/Server/Services/RecommendationDismissalService.js +50 -0
  257. package/build/dist/Server/Services/RecommendationDismissalService.js.map +1 -0
  258. package/build/dist/Server/Services/RunbookAgentJobService.js +63 -5
  259. package/build/dist/Server/Services/RunbookAgentJobService.js.map +1 -1
  260. package/build/dist/Server/Services/ScheduledMaintenanceService.js +83 -0
  261. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  262. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +65 -0
  263. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -1
  264. package/build/dist/Server/Services/StatusPageGroupService.js +136 -0
  265. package/build/dist/Server/Services/StatusPageGroupService.js.map +1 -1
  266. package/build/dist/Server/Services/TraceDropFilterService.js +93 -0
  267. package/build/dist/Server/Services/TraceDropFilterService.js.map +1 -1
  268. package/build/dist/Server/Types/Workflow/Components/API/Delete.js +11 -0
  269. package/build/dist/Server/Types/Workflow/Components/API/Delete.js.map +1 -1
  270. package/build/dist/Server/Types/Workflow/Components/API/Get.js +11 -0
  271. package/build/dist/Server/Types/Workflow/Components/API/Get.js.map +1 -1
  272. package/build/dist/Server/Types/Workflow/Components/API/Patch.js +11 -0
  273. package/build/dist/Server/Types/Workflow/Components/API/Patch.js.map +1 -1
  274. package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -0
  275. package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
  276. package/build/dist/Server/Types/Workflow/Components/API/Put.js +12 -0
  277. package/build/dist/Server/Types/Workflow/Components/API/Put.js.map +1 -1
  278. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +132 -0
  279. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -0
  280. package/build/dist/Server/Utils/DropFilterValidation.js +80 -0
  281. package/build/dist/Server/Utils/DropFilterValidation.js.map +1 -0
  282. package/build/dist/Server/Utils/Errors.js +3 -0
  283. package/build/dist/Server/Utils/Errors.js.map +1 -1
  284. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +30 -12
  285. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  286. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +38 -18
  287. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  288. package/build/dist/Server/Utils/Telemetry/AppMetrics.js +26 -0
  289. package/build/dist/Server/Utils/Telemetry/AppMetrics.js.map +1 -1
  290. package/build/dist/Types/Date.js +14 -4
  291. package/build/dist/Types/Date.js.map +1 -1
  292. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +192 -0
  293. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  294. package/build/dist/Types/Monitor/MonitorStep.js +6 -1
  295. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  296. package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js +32 -1
  297. package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js.map +1 -1
  298. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +294 -0
  299. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -0
  300. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js +110 -0
  301. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js.map +1 -0
  302. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +58 -0
  303. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -0
  304. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +451 -0
  305. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -0
  306. package/build/dist/Types/Permission.js +40 -0
  307. package/build/dist/Types/Permission.js.map +1 -1
  308. package/build/dist/Types/Recommendation/RecommendationType.js +21 -0
  309. package/build/dist/Types/Recommendation/RecommendationType.js.map +1 -0
  310. package/build/dist/Types/Runbook/RunbookExecutionDeadline.js +93 -0
  311. package/build/dist/Types/Runbook/RunbookExecutionDeadline.js.map +1 -0
  312. package/build/dist/Types/Runbook/RunbookStepTimeout.js +142 -0
  313. package/build/dist/Types/Runbook/RunbookStepTimeout.js.map +1 -0
  314. package/build/dist/Types/Telemetry/DropFilterSampling.js +75 -0
  315. package/build/dist/Types/Telemetry/DropFilterSampling.js.map +1 -0
  316. package/build/dist/UI/Components/AI/GenerateFromAIModal.js +1 -2
  317. package/build/dist/UI/Components/AI/GenerateFromAIModal.js.map +1 -1
  318. package/build/dist/UI/Components/Accordion/Accordion.js +9 -2
  319. package/build/dist/UI/Components/Accordion/Accordion.js.map +1 -1
  320. package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js +1 -1
  321. package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js.map +1 -1
  322. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +27 -14
  323. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  324. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js +1 -1
  325. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js.map +1 -1
  326. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +2 -20
  327. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  328. package/build/dist/UI/Components/Error/PageError.js +1 -3
  329. package/build/dist/UI/Components/Error/PageError.js.map +1 -1
  330. package/build/dist/UI/Components/ErrorBoundary.js +145 -11
  331. package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
  332. package/build/dist/UI/Components/InfoCard/InfoCard.js +28 -1
  333. package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
  334. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +13 -2
  335. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
  336. package/build/dist/UI/Components/Modal/Modal.js +4 -32
  337. package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
  338. package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
  339. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +69 -33
  340. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  341. package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js +73 -32
  342. package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js.map +1 -1
  343. package/build/dist/UI/Components/Runbook/StepTimeoutInput.js +101 -0
  344. package/build/dist/UI/Components/Runbook/StepTimeoutInput.js.map +1 -0
  345. package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js +73 -0
  346. package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js.map +1 -0
  347. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +13 -2
  348. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
  349. package/build/dist/UI/Utils/DropdownAlignment.js +98 -0
  350. package/build/dist/UI/Utils/DropdownAlignment.js.map +1 -0
  351. package/build/dist/UI/Utils/TableFilterUrlState.js +48 -15
  352. package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
  353. package/build/dist/Utils/API.js +39 -2
  354. package/build/dist/Utils/API.js.map +1 -1
  355. package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js +97 -0
  356. package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js.map +1 -0
  357. package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js +330 -0
  358. package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js.map +1 -0
  359. package/build/dist/Utils/StatusPage/GroupNestingLayout.js +280 -0
  360. package/build/dist/Utils/StatusPage/GroupNestingLayout.js.map +1 -0
  361. package/build/dist/Utils/StatusPage/GroupTree.js +214 -0
  362. package/build/dist/Utils/StatusPage/GroupTree.js.map +1 -0
  363. package/build/dist/Utils/StatusPage/ResourceUptime.js +60 -16
  364. package/build/dist/Utils/StatusPage/ResourceUptime.js.map +1 -1
  365. package/package.json +1 -1
@@ -0,0 +1,330 @@
1
+ /*
2
+ * Scan-target parsing for network device discovery.
3
+ *
4
+ * A discovery scan's target is the IPv4 address space a probe sweeps. Two
5
+ * notations are accepted:
6
+ *
7
+ * CIDR 192.168.1.0/24
8
+ * Octet range 10.16-22.0-255.51-66
9
+ *
10
+ * Octet-range notation exists because real networks are not shaped like CIDR
11
+ * blocks. "The .51-.66 management addresses in every /24 of 10.16-22.x" is a
12
+ * single target here; expressed in CIDR it is 1,792 separate scans, and the
13
+ * only CIDR that covers it in one go (10.16.0.0/13) is 512k addresses, of
14
+ * which 98% are not worth probing.
15
+ *
16
+ * This lives in Common rather than in the Probe's SubnetScanner so the server
17
+ * can validate a target at write time with exactly the parser the probe will
18
+ * later expand it with. A target that saves is a target that scans.
19
+ *
20
+ * IPv4-only by design, same as the sweep itself: IPv6 space is far too sparse
21
+ * to enumerate, and IPv6 discovery will be neighbour-discovery based.
22
+ */
23
+ // Which of the two notations a target string is written in.
24
+ export var ScanTargetNotation;
25
+ (function (ScanTargetNotation) {
26
+ ScanTargetNotation["Cidr"] = "CIDR";
27
+ ScanTargetNotation["OctetRange"] = "OctetRange";
28
+ })(ScanTargetNotation || (ScanTargetNotation = {}));
29
+ export class ScanTargetUtil {
30
+ /*
31
+ * Parses a target into the shape needed to count and expand it. Returns null
32
+ * for anything malformed; use getValidationError() when you need to tell the
33
+ * operator WHY. Size is deliberately not checked here — parse() answers "is
34
+ * this well-formed", the caller decides what it can afford to sweep.
35
+ */
36
+ static parse(target) {
37
+ return ScanTargetUtil.parseWithError(target).target || null;
38
+ }
39
+ // True when `target` is well-formed in either notation. Ignores size.
40
+ static isValid(target) {
41
+ return ScanTargetUtil.parse(target) !== null;
42
+ }
43
+ /*
44
+ * The notation `target` is written in, or null when it is not a valid target
45
+ * at all. A string containing '/' is always read as CIDR — a malformed CIDR
46
+ * is never silently retried as an octet range, because "10.0.0.0/99" is a
47
+ * typo'd prefix and deserves to say so.
48
+ */
49
+ static getNotation(target) {
50
+ var _a;
51
+ return ((_a = ScanTargetUtil.parse(target)) === null || _a === void 0 ? void 0 : _a.notation) || null;
52
+ }
53
+ /*
54
+ * How many addresses `target` sweeps, or 0 when it is malformed. Computed
55
+ * from the prefix length / range widths alone, with no allocation: expand()
56
+ * materializes one string per address, so a size check that ran after
57
+ * expansion would let a /8 allocate ~16M strings before the limit it exists
58
+ * to enforce was ever consulted.
59
+ */
60
+ static countHosts(target) {
61
+ var _a;
62
+ return ((_a = ScanTargetUtil.parse(target)) === null || _a === void 0 ? void 0 : _a.hostCount) || 0;
63
+ }
64
+ /*
65
+ * The single validation entry point for a scan target: syntax first, then
66
+ * the size ceiling. Returns null when the target is good to scan, otherwise
67
+ * a message written for the operator who typed it.
68
+ */
69
+ static getValidationError(target) {
70
+ const outcome = ScanTargetUtil.parseWithError(target);
71
+ if (!outcome.target) {
72
+ return outcome.error || ScanTargetUtil.getMalformedTargetMessage(target);
73
+ }
74
+ if (outcome.target.hostCount > ScanTargetUtil.MAX_SCAN_HOSTS) {
75
+ return (`"${String(target).trim()}" expands to ` +
76
+ `${outcome.target.hostCount.toLocaleString("en-US")} addresses, ` +
77
+ `exceeding the ${ScanTargetUtil.MAX_SCAN_HOSTS.toLocaleString("en-US")}-address scan limit. ` +
78
+ `Narrow the target (a smaller subnet, or tighter octet ranges) or split it into several scans.`);
79
+ }
80
+ return null;
81
+ }
82
+ /*
83
+ * Expands a target into the addresses to probe, in ascending address order.
84
+ *
85
+ * Returns an empty array for a malformed target — there is nothing to sweep.
86
+ * THROWS for a well-formed target above MAX_SCAN_HOSTS: that is a caller
87
+ * that skipped its size check, and quietly returning a truncated or empty
88
+ * list would turn it into a silently wrong scan. Callers should gate on
89
+ * getValidationError() (or countHosts()) first and never see this.
90
+ */
91
+ static expand(target) {
92
+ const parsed = ScanTargetUtil.parse(target);
93
+ if (!parsed) {
94
+ return [];
95
+ }
96
+ if (parsed.hostCount > ScanTargetUtil.MAX_SCAN_HOSTS) {
97
+ throw new Error(ScanTargetUtil.getValidationError(target) ||
98
+ `Scan target "${String(target).trim()}" is too large to expand.`);
99
+ }
100
+ if (parsed.notation === ScanTargetNotation.Cidr) {
101
+ return ScanTargetUtil.expandCidrTarget(parsed);
102
+ }
103
+ return ScanTargetUtil.expandOctetRangeTarget(parsed);
104
+ }
105
+ /*
106
+ * Both notations in one sentence, for form hints and error messages. Kept
107
+ * here so the UI, the server-side validator and the probe all describe the
108
+ * accepted syntax identically.
109
+ */
110
+ static getSyntaxHint() {
111
+ return (`Use CIDR notation (e.g. ${ScanTargetUtil.EXAMPLE_CIDR}) or octet-range notation, ` +
112
+ `where any octet may be an inclusive low-high range (e.g. ${ScanTargetUtil.EXAMPLE_OCTET_RANGE}).`);
113
+ }
114
+ static parseWithError(target) {
115
+ if (typeof target !== "string" || target.trim().length === 0) {
116
+ return {
117
+ error: `A scan target is required. ${ScanTargetUtil.getSyntaxHint()}`,
118
+ };
119
+ }
120
+ const trimmed = target.trim();
121
+ /*
122
+ * Length gate BEFORE anything builds a message. Every rejection below
123
+ * quotes the offending target back (parseOctetRange quotes both the bad
124
+ * term AND the whole target, doubling it), and the server-side create
125
+ * hook runs ahead of the column's 100-character cap — so without this,
126
+ * a 50 MB request body would be reflected into a ~100 MB exception that
127
+ * is both logged and serialized into the response. This message is a
128
+ * constant and echoes nothing.
129
+ */
130
+ if (trimmed.length > ScanTargetUtil.MAX_TARGET_LENGTH) {
131
+ return {
132
+ error: `A scan target cannot be longer than ${ScanTargetUtil.MAX_TARGET_LENGTH} characters. ` +
133
+ ScanTargetUtil.getSyntaxHint(),
134
+ };
135
+ }
136
+ /*
137
+ * The '/' is the discriminator, checked before either parser runs. A
138
+ * string carrying a prefix is a CIDR attempt by intent, so "10.0.0.0/99"
139
+ * must report a bad prefix rather than fall through to the octet-range
140
+ * parser and report the far more confusing "not a valid scan target".
141
+ */
142
+ if (trimmed.includes("/")) {
143
+ return ScanTargetUtil.parseCidr(trimmed);
144
+ }
145
+ return ScanTargetUtil.parseOctetRange(trimmed);
146
+ }
147
+ static parseCidr(trimmed) {
148
+ const match = trimmed.match(ScanTargetUtil.CIDR_PATTERN);
149
+ if (!match) {
150
+ return {
151
+ error: `"${trimmed}" is not a valid IPv4 CIDR. ` +
152
+ `Expected four octets and a prefix length, e.g. ${ScanTargetUtil.EXAMPLE_CIDR}.`,
153
+ };
154
+ }
155
+ let baseLong = 0;
156
+ for (let i = 1; i <= 4; i++) {
157
+ const octet = parseInt(match[i], 10);
158
+ if (octet > 255) {
159
+ return {
160
+ error: `Octet "${match[i]}" in "${trimmed}" is out of range. ` +
161
+ `Each octet must be between 0 and 255.`,
162
+ };
163
+ }
164
+ baseLong = baseLong * 256 + octet;
165
+ }
166
+ const prefix = parseInt(match[5], 10);
167
+ if (prefix > 32) {
168
+ return {
169
+ error: `Prefix length "/${match[5]}" in "${trimmed}" is out of range. ` +
170
+ `An IPv4 prefix must be between /0 and /32.`,
171
+ };
172
+ }
173
+ const hostBits = 32 - prefix;
174
+ const blockSize = Math.pow(2, hostBits);
175
+ /*
176
+ * Shifting by 32 is a no-op in JS (the shift count is taken mod 32), so a
177
+ * /0 would mask with 0xffffffff and "expand" from the address as typed
178
+ * rather than from 0.0.0.0. Special-cased rather than relied upon.
179
+ */
180
+ const mask = hostBits >= 32 ? 0 : (0xffffffff << hostBits) >>> 0;
181
+ const networkLong = (baseLong & mask) >>> 0;
182
+ return {
183
+ target: {
184
+ notation: ScanTargetNotation.Cidr,
185
+ /*
186
+ * /31 and /32 have no network/broadcast addresses to exclude (RFC
187
+ * 3021), so every address in them is a host. Larger blocks drop the
188
+ * first and last.
189
+ */
190
+ hostCount: blockSize <= 2 ? blockSize : blockSize - 2,
191
+ networkLong: networkLong,
192
+ blockSize: blockSize,
193
+ },
194
+ };
195
+ }
196
+ static parseOctetRange(trimmed) {
197
+ const terms = trimmed.split(".");
198
+ if (terms.length !== 4) {
199
+ return { error: ScanTargetUtil.getMalformedTargetMessage(trimmed) };
200
+ }
201
+ const octetRanges = [];
202
+ let hostCount = 1;
203
+ for (const term of terms) {
204
+ const match = term.match(ScanTargetUtil.OCTET_TERM_PATTERN);
205
+ if (!match) {
206
+ return {
207
+ error: `"${term}" in "${trimmed}" is not a valid octet. ` +
208
+ `Each octet must be a number (42) or an inclusive range (16-22).`,
209
+ };
210
+ }
211
+ const start = parseInt(match[1], 10);
212
+ // No '-' in the term means a single value: a zero-width range.
213
+ const end = match[2] === undefined ? start : parseInt(match[2], 10);
214
+ if (start > 255 || end > 255) {
215
+ return {
216
+ error: `Octet "${term}" in "${trimmed}" is out of range. ` +
217
+ `Each octet must be between 0 and 255.`,
218
+ };
219
+ }
220
+ /*
221
+ * Reversed bounds are a typo, not an empty set. Silently accepting
222
+ * "22-16" as zero addresses would produce a scan that sweeps nothing
223
+ * and reports success — the least debuggable outcome available.
224
+ */
225
+ if (start > end) {
226
+ return {
227
+ error: `Octet range "${term}" in "${trimmed}" is reversed. ` +
228
+ `Write the lower bound first, e.g. ${end}-${start}.`,
229
+ };
230
+ }
231
+ octetRanges.push({ start: start, end: end });
232
+ hostCount = hostCount * (end - start + 1);
233
+ }
234
+ return {
235
+ target: {
236
+ notation: ScanTargetNotation.OctetRange,
237
+ /*
238
+ * Every address in the product is swept, with no network/broadcast
239
+ * exclusion. An octet range is an explicit enumeration, not a subnet:
240
+ * whoever wrote "10.0.0.0-255" asked for .0 and .255 by name, and
241
+ * there is no prefix length here from which a broadcast address could
242
+ * even be derived.
243
+ */
244
+ hostCount: hostCount,
245
+ octetRanges: octetRanges,
246
+ },
247
+ };
248
+ }
249
+ static expandCidrTarget(parsed) {
250
+ const networkLong = parsed.networkLong;
251
+ const blockSize = parsed.blockSize;
252
+ const hosts = [];
253
+ if (blockSize <= 2) {
254
+ // /31 and /32: every address is usable.
255
+ for (let i = 0; i < blockSize; i++) {
256
+ hosts.push(ScanTargetUtil.longToIp(networkLong + i));
257
+ }
258
+ return hosts;
259
+ }
260
+ // Skip network (first) and broadcast (last).
261
+ for (let i = 1; i < blockSize - 1; i++) {
262
+ hosts.push(ScanTargetUtil.longToIp(networkLong + i));
263
+ }
264
+ return hosts;
265
+ }
266
+ static expandOctetRangeTarget(parsed) {
267
+ const ranges = parsed.octetRanges;
268
+ const hosts = [];
269
+ // Outer-to-inner octet order, so the result comes out address-ascending.
270
+ for (let a = ranges[0].start; a <= ranges[0].end; a++) {
271
+ for (let b = ranges[1].start; b <= ranges[1].end; b++) {
272
+ for (let c = ranges[2].start; c <= ranges[2].end; c++) {
273
+ for (let d = ranges[3].start; d <= ranges[3].end; d++) {
274
+ hosts.push(`${a}.${b}.${c}.${d}`);
275
+ }
276
+ }
277
+ }
278
+ }
279
+ return hosts;
280
+ }
281
+ static getMalformedTargetMessage(target) {
282
+ const shown = typeof target === "string" ? target.trim() : String(target);
283
+ return (`"${shown}" is not a valid scan target. ` + ScanTargetUtil.getSyntaxHint());
284
+ }
285
+ static longToIp(long) {
286
+ return (((long >>> 24) & 0xff) +
287
+ "." +
288
+ ((long >>> 16) & 0xff) +
289
+ "." +
290
+ ((long >>> 8) & 0xff) +
291
+ "." +
292
+ (long & 0xff));
293
+ }
294
+ }
295
+ /*
296
+ * Hard ceiling on how many addresses one scan may sweep.
297
+ *
298
+ * The number is a wall-clock budget, not a memory one. SubnetScanner runs 32
299
+ * workers; a dead host costs ~1s (the ICMP pre-sweep timeout), or ~2s when
300
+ * the pre-sweep is unavailable and every host is SNMP-probed directly. At
301
+ * this ceiling that is ~17 minutes with the pre-sweep and ~34 minutes
302
+ * without — both comfortably inside the 2-hour window after which the server
303
+ * declares an In Progress scan abandoned (Workers/Jobs/
304
+ * NetworkDeviceDiscovery/RequeueRecurringScans.ts) and safely above the
305
+ * 15-minute minimum rescan interval for recurring scans.
306
+ *
307
+ * It is also still a real abuse guard: a /17 in CIDR terms. Anything larger
308
+ * (a /16 sweep, an unbounded 10.*.*.* octet range) is rejected at write time
309
+ * with a message telling the operator to narrow the target.
310
+ */
311
+ ScanTargetUtil.MAX_SCAN_HOSTS = 32768;
312
+ /*
313
+ * Longest string we will even attempt to parse. The widest well-formed
314
+ * target is "255-255.255-255.255-255.255-255" at 31 characters, so this is
315
+ * ~2x headroom and still far below the 100-character column. It exists to
316
+ * bound the error messages, which quote the target back — see the gate in
317
+ * parseWithError().
318
+ */
319
+ ScanTargetUtil.MAX_TARGET_LENGTH = 64;
320
+ /*
321
+ * Hoisted so the literals are not the object of a member expression, which
322
+ * `wrap-regex` and Prettier cannot agree on. Same reason as CidrMatchUtil.
323
+ */
324
+ ScanTargetUtil.CIDR_PATTERN = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,3})$/;
325
+ // A single octet term: `42` or `16-22`. Bounds are validated after parsing.
326
+ ScanTargetUtil.OCTET_TERM_PATTERN = /^(\d{1,3})(?:-(\d{1,3}))?$/;
327
+ ScanTargetUtil.EXAMPLE_CIDR = "192.168.1.0/24";
328
+ ScanTargetUtil.EXAMPLE_OCTET_RANGE = "10.16-22.0-255.51-66";
329
+ export default ScanTargetUtil;
330
+ //# sourceMappingURL=ScanTargetUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScanTargetUtil.js","sourceRoot":"","sources":["../../../../Utils/NetworkDiscovery/ScanTargetUtil.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,4DAA4D;AAC5D,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,+CAAyB,CAAA;AAC3B,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAgCD,MAAM,OAAO,cAAc;IA2CzB;;;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,CAAC,CAAC;oBACpC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,MAAM,CAAC,yBAAyB,CAAC,MAAc;QACrD,MAAM,KAAK,GACT,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE9D,OAAO,CACL,IAAI,KAAK,gCAAgC,GAAG,cAAc,CAAC,aAAa,EAAE,CAC3E,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,IAAY;QAClC,OAAO,CACL,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;YACtB,GAAG;YACH,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;YACtB,GAAG;YACH,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;YACrB,GAAG;YACH,CAAC,IAAI,GAAG,IAAI,CAAC,CACd,CAAC;IACJ,CAAC;;AAlXD;;;;;;;;;;;;;;;GAeG;AACoB,6BAAc,GAAW,KAAK,CAAC;AAEtD;;;;;;GAMG;AACoB,gCAAiB,GAAW,EAAE,CAAC;AAEtD;;;GAGG;AACqB,2BAAY,GAClC,yDAAyD,CAAC;AAE5D,4EAA4E;AACpD,iCAAkB,GACxC,4BAA4B,CAAC;AAEP,2BAAY,GAAW,gBAAgB,CAAC;AAExC,kCAAmB,GAAW,sBAAsB,CAAC;AA6U/E,eAAe,cAAc,CAAC"}
@@ -0,0 +1,280 @@
1
+ import StatusPageGroupViewMode from "../../Types/StatusPage/StatusPageGroupViewMode";
2
+ /*
3
+ * Status page groups nest (Corporate Unit -> Region -> Market -> Site) and the
4
+ * overview page draws that nesting.
5
+ *
6
+ * Drawing each level as a card inside a card inside a card is what it used to
7
+ * do, and it does not survive contact with a real hierarchy: four borders end
8
+ * up wrapped around one uptime bar, every level eats horizontal room the bars
9
+ * need, and a leaf resource ends up rendered larger than the group that
10
+ * contains it. Below the top level a group is therefore drawn as a row hanging
11
+ * off a tree rail - one hairline down the left, one indent step, no extra card.
12
+ *
13
+ * The numbers live here rather than inline in the page because they are the
14
+ * part that has to hold at depth 1 and still hold at depth 12, and that is
15
+ * worth pinning down in tests.
16
+ */
17
+ /* What a group header shows on its right hand side, if anything. */
18
+ export var StatusPageGroupRollupKind;
19
+ (function (StatusPageGroupRollupKind) {
20
+ StatusPageGroupRollupKind["UptimePercent"] = "UptimePercent";
21
+ StatusPageGroupRollupKind["CurrentStatus"] = "CurrentStatus";
22
+ StatusPageGroupRollupKind["None"] = "None";
23
+ })(StatusPageGroupRollupKind || (StatusPageGroupRollupKind = {}));
24
+ class StatusPageGroupNestingLayoutUtil {
25
+ /*
26
+ * A depth that is not a whole number >= 0 is treated as the top level. The
27
+ * page derives depth from a recursive render, but nothing stops a caller (or
28
+ * a future refactor) from handing over -1 or NaN, and a broken indent is not
29
+ * worth a broken page.
30
+ */
31
+ static getVisualDepth(data) {
32
+ if (!Number.isFinite(data.depth)) {
33
+ return 0;
34
+ }
35
+ const depth = Math.floor(data.depth);
36
+ if (depth <= 0) {
37
+ return 0;
38
+ }
39
+ return Math.min(depth, this.MaxIndentedDepth);
40
+ }
41
+ static isRootLevel(data) {
42
+ return this.getVisualDepth({ depth: data.depth }) === 0;
43
+ }
44
+ /*
45
+ * Nesting is expressed with the rail, so the title only ever steps down once
46
+ * - and never below the size a resource name renders at. That inversion, a
47
+ * text-sm group heading over a text-lg resource, is what made the old nesting
48
+ * read upside down.
49
+ */
50
+ /*
51
+ * Truncates at every width, including on a phone. Wrapping was tried and is
52
+ * worse: the title is the only shrinkable item in the header row, so next to a
53
+ * sub group badge and a rollup it collapses to a ~30px column and breaks a
54
+ * name one character per line. An ellipsis with the full name in `title` is the
55
+ * lesser evil.
56
+ */
57
+ static getTitleClassName(data) {
58
+ const base = "min-w-0 truncate font-semibold text-gray-900";
59
+ if (this.isRootLevel(data)) {
60
+ return `${base} text-base sm:text-lg tracking-tight`;
61
+ }
62
+ return `${base} text-base tracking-tight`;
63
+ }
64
+ /*
65
+ * A resource name, as rendered by MonitorOverview. It lives here so the floor
66
+ * a group title has to clear is the same string the resource actually renders
67
+ * with, rather than a number written down next to it.
68
+ */
69
+ static getResourceTitleClassName() {
70
+ return "text-base font-medium";
71
+ }
72
+ /*
73
+ * The chevron box and the gap after it are what set where a title starts, and
74
+ * a sub group's contents and a group description are both aligned to that. All
75
+ * three are derived from these two, so moving the chevron moves them with it.
76
+ */
77
+ static getChevronBoxClassName() {
78
+ return "flex-shrink-0 flex items-center justify-center w-6 h-6 rounded-md transition-colors";
79
+ }
80
+ static getHeaderRowClassName() {
81
+ return "flex min-w-0 flex-1 items-center gap-2.5";
82
+ }
83
+ /*
84
+ * A nested group is not a card. It is a block in the parent's body, so all it
85
+ * gets is the vertical rhythm that separates it from its siblings.
86
+ */
87
+ static getContainerClassName(data) {
88
+ if (this.isRootLevel(data)) {
89
+ return "bg-white rounded-xl shadow px-4 py-3 sm:px-6 sm:py-4";
90
+ }
91
+ return "";
92
+ }
93
+ /*
94
+ * Resources that belong to no group at all get their own card at the top of
95
+ * the page. It is the same surface as a top level group, minus the header.
96
+ */
97
+ static getUngroupedResourcesCardClassName() {
98
+ return "bg-white rounded-xl shadow px-4 py-4 sm:px-6 sm:py-5";
99
+ }
100
+ /* Vertical rhythm between the resources of one group. */
101
+ static getResourceListClassName() {
102
+ return "space-y-4 sm:space-y-5";
103
+ }
104
+ /*
105
+ * Quieter than the per-resource labels it replaces. It is a scale, not a
106
+ * reading, and it is what made a nested block look shouty when it appeared
107
+ * three times in one screen.
108
+ */
109
+ static getTimeAxisClassName() {
110
+ return "flex justify-between text-[11px] text-gray-400";
111
+ }
112
+ /*
113
+ * The rolled up reading on the right of a group header. Sized to match the
114
+ * per-resource readings below it: a rollup and a resource reading are the same
115
+ * kind of number, and the status dot is what tells them apart.
116
+ */
117
+ static getRollupClassName() {
118
+ return "flex-shrink-0 text-sm sm:text-base font-medium";
119
+ }
120
+ static getHeaderClassName(data) {
121
+ /*
122
+ * The whole row is the disclosure control, so it carries the hover state.
123
+ * Negative horizontal margin with matching padding lets that hover reach the
124
+ * edge of the content column while the row's contents stay aligned with the
125
+ * resources below it.
126
+ *
127
+ * The width has to pay for both margins explicitly. A button shrink wraps
128
+ * even as a flex container, so it needs a width; but `w-full` with both
129
+ * negative margins over-constrains the box, and the browser resolves that by
130
+ * dropping margin-right (CSS 2.1 10.3.3) - which leaves every rollup 16px
131
+ * short of the card edge the resource readings below it sit on. 100% + 1rem
132
+ * satisfies the equation exactly, so nothing is dropped.
133
+ */
134
+ const base = "flex w-[calc(100%+1rem)] items-center justify-between gap-3 text-left rounded-lg -mx-2 px-2 transition-colors hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-300";
135
+ return this.isRootLevel(data) ? `${base} py-2` : `${base} py-1.5`;
136
+ }
137
+ /*
138
+ * The rail and the indent that carry one nesting step.
139
+ *
140
+ * `ml` moves the rail under its parent's chevron and `pl` pushes the contents
141
+ * clear of it, so the two together land a sub group's contents at the parent's
142
+ * title. Past MaxIndentedDepth the step tightens rather than stops: the rails
143
+ * have to stay distinguishable, but a deep tree still has to leave room for
144
+ * the uptime bars on a phone.
145
+ */
146
+ static getIndentClassName(data) {
147
+ const visualDepth = this.getVisualDepth(data);
148
+ if (visualDepth === 0) {
149
+ return "";
150
+ }
151
+ if (visualDepth < this.MaxIndentedDepth) {
152
+ return "ml-2.5 sm:ml-3 pl-4 sm:pl-5";
153
+ }
154
+ return "ml-1.5 pl-3";
155
+ }
156
+ /*
157
+ * Everything a group contains - its own resources and then its sub groups -
158
+ * lives in one body so a single rail covers all of it.
159
+ */
160
+ static getBodyClassName(data) {
161
+ if (this.isRootLevel(data)) {
162
+ // The card's own padding is the boundary at the top level; no rail.
163
+ return "mt-3 space-y-4";
164
+ }
165
+ return `mt-2.5 space-y-3.5 border-l border-gray-200 ${this.getIndentClassName(data)}`;
166
+ }
167
+ static showRail(data) {
168
+ return !this.isRootLevel(data);
169
+ }
170
+ static getSubGroupListClassName(data) {
171
+ return this.isRootLevel(data) ? "space-y-3" : "space-y-2.5";
172
+ }
173
+ /*
174
+ * A group with resources of its own *and* sub groups needs a line between the
175
+ * two, otherwise its last resource reads as belonging to the first sub group.
176
+ */
177
+ static shouldShowSubGroupDivider(data) {
178
+ return data.hasOwnResources && data.subGroupCount > 0;
179
+ }
180
+ static getSubGroupDividerClassName() {
181
+ return "border-t border-gray-100 pt-3.5";
182
+ }
183
+ /*
184
+ * The group description hangs under the title, indented past the chevron so
185
+ * it lines up with the name rather than with the disclosure control. It sits
186
+ * outside the header button on purpose: a description is markdown and may
187
+ * contain links, which cannot live inside a button.
188
+ *
189
+ * The indent is 34px: the 24px chevron box (w-6, see getChevronBoxClassName)
190
+ * plus the 10px gap after it (gap-2.5, see getHeaderRowClassName).
191
+ *
192
+ * Alignment only. Type and vertical rhythm are MarkdownViewer's - it sets
193
+ * them on the paragraph it renders, which beats anything inherited from here,
194
+ * so declaring a size or a colour on this wrapper would just be a comment that
195
+ * looks like code.
196
+ */
197
+ static getDescriptionClassName() {
198
+ return "pl-[34px] pr-2";
199
+ }
200
+ static getSubGroupCountBadgeClassName() {
201
+ return "flex-shrink-0 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-medium text-gray-500 tabular-nums";
202
+ }
203
+ /* The status dot that marks a reading as a rollup rather than a resource's own. */
204
+ static getRollupDotClassName() {
205
+ return "h-1.5 w-1.5 flex-shrink-0 rounded-full";
206
+ }
207
+ static getRollupLabelClassName() {
208
+ return "font-semibold tabular-nums";
209
+ }
210
+ /*
211
+ * A group that only exists to hold sub groups has no resources of its own,
212
+ * and telling the visitor it is empty would be wrong - the sub groups below
213
+ * it are its content. A group with neither still renders its (empty) resource
214
+ * list, because that is where the "no resources" message belongs.
215
+ */
216
+ static shouldRenderOwnResources(data) {
217
+ return data.ownResourceCount > 0 || data.subGroupCount === 0;
218
+ }
219
+ /*
220
+ * Whether a group draws the time axis under its own resource list.
221
+ *
222
+ * Once per resource list rather than once per resource: every bar in one list
223
+ * is drawn over the same window and sits in the same column, so one axis
224
+ * describes all of them. It deliberately does not cover sub groups - their
225
+ * bars are indented past this one, and they may be collapsed, so an axis up
226
+ * here would be labelling a column that is not there.
227
+ *
228
+ * A group in grid view draws a matrix of cells instead of bars, so its
229
+ * resources are not something a time axis describes.
230
+ */
231
+ static shouldRenderTimeAxis(data) {
232
+ var _a, _b, _c;
233
+ if (((_a = data.statusPageGroup) === null || _a === void 0 ? void 0 : _a.viewMode) === StatusPageGroupViewMode.Grid) {
234
+ return false;
235
+ }
236
+ const groupId = ((_c = (_b = data.statusPageGroup) === null || _b === void 0 ? void 0 : _b._id) === null || _c === void 0 ? void 0 : _c.toString()) || null;
237
+ return (data.statusPageResources.find((resource) => {
238
+ var _a;
239
+ if (!resource.showStatusHistoryChart) {
240
+ return false;
241
+ }
242
+ /*
243
+ * Skipped for the same reason the page skips them - a resource that
244
+ * resolves to neither a monitor nor a monitor group draws nothing.
245
+ */
246
+ if (!resource.monitor && !resource.monitorGroupId) {
247
+ return false;
248
+ }
249
+ const resourceGroupId = ((_a = resource.statusPageGroupId) === null || _a === void 0 ? void 0 : _a.toString()) || null;
250
+ return resourceGroupId === groupId;
251
+ }) !== undefined);
252
+ }
253
+ /*
254
+ * Which rolled up reading a group header shows.
255
+ *
256
+ * A group that is currently down shows its status rather than an uptime
257
+ * percent - "99.9% uptime" next to a red group is not the thing a visitor came
258
+ * to read - and a group whose uptime cannot be worked out (no resources under
259
+ * it at all) shows nothing rather than a zero.
260
+ */
261
+ static getRollupKind(data) {
262
+ if (data.showUptimePercent && !data.isCurrentlyDown) {
263
+ return data.uptimePercent === null
264
+ ? StatusPageGroupRollupKind.None
265
+ : StatusPageGroupRollupKind.UptimePercent;
266
+ }
267
+ return data.showCurrentStatus
268
+ ? StatusPageGroupRollupKind.CurrentStatus
269
+ : StatusPageGroupRollupKind.None;
270
+ }
271
+ }
272
+ /*
273
+ * Beyond this depth the indent step shrinks instead of growing. Nesting is
274
+ * capped on write at StatusPageGroupTreeUtil.MaxNestingDepth, but rows
275
+ * written straight to the database are not, so the layout is not allowed to
276
+ * assume any particular ceiling.
277
+ */
278
+ StatusPageGroupNestingLayoutUtil.MaxIndentedDepth = 4;
279
+ export default StatusPageGroupNestingLayoutUtil;
280
+ //# sourceMappingURL=GroupNestingLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupNestingLayout.js","sourceRoot":"","sources":["../../../../Utils/StatusPage/GroupNestingLayout.ts"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,MAAM,gDAAgD,CAAC;AAErF;;;;;;;;;;;;;;GAcG;AAEH,oEAAoE;AACpE,MAAM,CAAN,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACnC,4DAA+B,CAAA;IAC/B,4DAA+B,CAAA;IAC/B,0CAAa,CAAA;AACf,CAAC,EAJW,yBAAyB,KAAzB,yBAAyB,QAIpC;AAED,MAAqB,gCAAgC;IASnD;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAAC,IAAuB;QAClD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,MAAM,KAAK,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,IAAuB;QAC/C,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAA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