@oneuptime/common 14.0.1 → 14.0.2

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 (1090) hide show
  1. package/Models/DatabaseModels/AlertEpisodeMember.ts +8 -1
  2. package/Models/DatabaseModels/AutoRemediationSuggestion.ts +63 -0
  3. package/Models/DatabaseModels/IncidentEpisodeMember.ts +8 -1
  4. package/Models/DatabaseModels/IncidentEpisodePublicNote.ts +9 -2
  5. package/Models/DatabaseModels/IncidentPublicNote.ts +9 -2
  6. package/Models/DatabaseModels/KubernetesCluster.ts +429 -0
  7. package/Models/DatabaseModels/Monitor.ts +48 -0
  8. package/Models/DatabaseModels/Runner.ts +5 -4
  9. package/Models/DatabaseModels/RunnerJob.ts +66 -0
  10. package/Models/DatabaseModels/ScheduledMaintenancePublicNote.ts +10 -2
  11. package/Models/DatabaseModels/WorkflowVariable.ts +479 -2
  12. package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +79 -25
  13. package/Server/API/AIInvestigationAPI.ts +341 -0
  14. package/Server/API/AutoRemediationAPI.ts +184 -2
  15. package/Server/API/CommonAPI.ts +70 -0
  16. package/Server/API/KubernetesClusterAiAccessAPI.ts +793 -0
  17. package/Server/API/MicrosoftTeamsAPI.ts +770 -315
  18. package/Server/API/MonitorAPI.ts +140 -0
  19. package/Server/API/OnCallScheduleTimelineAPI.ts +5 -21
  20. package/Server/API/SlackAPI.ts +447 -99
  21. package/Server/API/StatusPageAPI.ts +146 -26
  22. package/Server/API/TelemetryAPI.ts +216 -5
  23. package/Server/API/UserTwoFactorBackupCodeAPI.ts +1 -0
  24. package/Server/API/WorkflowVariableAPI.ts +156 -0
  25. package/Server/Infrastructure/GlobalCache.ts +35 -0
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.ts +97 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.ts +129 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.ts +25 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.ts +20 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.ts +38 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +10 -0
  32. package/Server/Middleware/MasterAdminAuthorization.ts +28 -0
  33. package/Server/Middleware/TelemetryIngest.ts +47 -2
  34. package/Server/Middleware/UserAuthorization.ts +56 -2
  35. package/Server/Services/AIAgentService.ts +1 -0
  36. package/Server/Services/AccessTokenService.ts +121 -48
  37. package/Server/Services/AlertEpisodeMemberService.ts +9 -0
  38. package/Server/Services/AlertEpisodeService.ts +14 -1
  39. package/Server/Services/AlertService.ts +134 -22
  40. package/Server/Services/AutoRemediationRuleEngineService.ts +968 -39
  41. package/Server/Services/AutoRemediationRuleService.ts +118 -0
  42. package/Server/Services/BillingService.ts +1 -0
  43. package/Server/Services/InboundEmail/Providers/SendGridInboundProvider.ts +16 -22
  44. package/Server/Services/IncidentEpisodeMemberService.ts +9 -0
  45. package/Server/Services/IncidentEpisodePublicNoteService.ts +66 -0
  46. package/Server/Services/IncidentEpisodeRoleMemberService.ts +27 -0
  47. package/Server/Services/IncidentEpisodeService.ts +14 -1
  48. package/Server/Services/IncidentGroupingEngineService.ts +11 -0
  49. package/Server/Services/IncidentMemberService.ts +21 -0
  50. package/Server/Services/IncidentPublicNoteService.ts +63 -0
  51. package/Server/Services/IncidentService.ts +120 -20
  52. package/Server/Services/IncidentStateTimelineService.ts +15 -0
  53. package/Server/Services/IncidentTemplateService.ts +83 -3
  54. package/Server/Services/KubernetesClusterAiAccessService.ts +1943 -0
  55. package/Server/Services/KubernetesClusterService.ts +1570 -1
  56. package/Server/Services/LogAggregationService.ts +14 -6
  57. package/Server/Services/MonitorService.ts +651 -52
  58. package/Server/Services/MonitorStatusTimelineService.ts +639 -2
  59. package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +2 -0
  60. package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +2 -0
  61. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +2 -0
  62. package/Server/Services/OnCallDutyPolicyScheduleService.ts +3 -0
  63. package/Server/Services/OnCallNotificationAlertingService.ts +36 -12
  64. package/Server/Services/OnCallSetupReminderService.ts +1 -0
  65. package/Server/Services/ProbeService.ts +7 -1
  66. package/Server/Services/ProjectService.ts +11 -1
  67. package/Server/Services/RunbookCredentialService.ts +26 -1
  68. package/Server/Services/RunbookSecretService.ts +36 -0
  69. package/Server/Services/RunnerJobService.ts +941 -23
  70. package/Server/Services/RunnerService.ts +439 -6
  71. package/Server/Services/ScheduledMaintenancePublicNoteService.ts +66 -0
  72. package/Server/Services/ScheduledMaintenanceService.ts +124 -19
  73. package/Server/Services/ScheduledMaintenanceTemplateService.ts +82 -3
  74. package/Server/Services/ServiceLevelObjectiveService.ts +14 -1
  75. package/Server/Services/StatusPagePrivateUserService.ts +1 -0
  76. package/Server/Services/StatusPageService.ts +301 -74
  77. package/Server/Services/StatusPageSubscriberService.ts +4 -0
  78. package/Server/Services/TeamMemberService.ts +309 -7
  79. package/Server/Services/TraceAggregationService.ts +10 -6
  80. package/Server/Services/UserEmailService.ts +1 -0
  81. package/Server/Services/UserNotificationMethodAdminService.ts +1 -0
  82. package/Server/Services/UserNotificationRuleAdminService.ts +1 -0
  83. package/Server/Services/UserNotificationRuleService.ts +4 -0
  84. package/Server/Services/UserService.ts +122 -1
  85. package/Server/Services/WorkflowVariableService.ts +593 -8
  86. package/Server/Services/WorkspaceNotificationRuleService.ts +588 -8
  87. package/Server/Services/WorkspaceProjectAuthTokenService.ts +170 -1
  88. package/Server/Types/Database/QueryHelper.ts +22 -0
  89. package/Server/Types/Markdown.ts +502 -27
  90. package/Server/Utils/AI/ClusterAccess/ClusterAccessContext.ts +182 -0
  91. package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +525 -0
  92. package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +854 -0
  93. package/Server/Utils/AI/CodeFix/CodeFixAgentAuth.ts +22 -2
  94. package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1916 -307
  95. package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +1601 -74
  96. package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +139 -7
  97. package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +58 -1
  98. package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +54 -1
  99. package/Server/Utils/AI/Toolbox/AIActionTools.ts +14 -6
  100. package/Server/Utils/AI/Toolbox/ResourceTools.ts +4 -2
  101. package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +1341 -150
  102. package/Server/Utils/AutoRemediation/RemediationVerifier.ts +375 -4
  103. package/Server/Utils/Database/AffectedResourceRelations.ts +127 -0
  104. package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +240 -1
  105. package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +1 -0
  106. package/Server/Utils/Monitor/MonitorAlert.ts +83 -9
  107. package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +5 -1
  108. package/Server/Utils/Monitor/MonitorIncident.ts +104 -9
  109. package/Server/Utils/Monitor/MonitorPayloadRedaction.ts +124 -7
  110. package/Server/Utils/Monitor/ProbeMonitorsNotification.ts +407 -0
  111. package/Server/Utils/OnCall/OnCallShiftReminderRunner.ts +1 -0
  112. package/Server/Utils/PushNotificationUtil.ts +45 -0
  113. package/Server/Utils/Rules/OwnerRuleAssignment.ts +40 -3
  114. package/Server/Utils/Runbook/RunbookExecutePermission.ts +56 -6
  115. package/Server/Utils/SessionReplay/SessionReplayReadService.ts +223 -33
  116. package/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.ts +559 -0
  117. package/Server/Utils/StartServer.ts +4 -3
  118. package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +528 -0
  119. package/Server/Utils/TwoFactorBackupCodeNotification.ts +1 -0
  120. package/Server/Utils/UserPermission/UserPermission.ts +16 -0
  121. package/Server/Utils/Workflow/OAuth2TokenClient.ts +704 -0
  122. package/Server/Utils/Workflow/WorkflowVariableOAuthToken.ts +318 -0
  123. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +47 -7
  124. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +57 -16
  125. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +193 -214
  126. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +57 -13
  127. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +54 -17
  128. package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +179 -161
  129. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +281 -167
  130. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.ts +114 -0
  131. package/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.ts +895 -0
  132. package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +7 -9
  133. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +96 -227
  134. package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +93 -214
  135. package/Server/Utils/Workspace/Slack/Actions/Auth.ts +30 -3
  136. package/Server/Utils/Workspace/Slack/Actions/Authorization.ts +99 -0
  137. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +117 -283
  138. package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +101 -196
  139. package/Server/Utils/Workspace/Slack/Actions/ReactionNote.ts +329 -0
  140. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +111 -287
  141. package/Server/Utils/Workspace/Slack/Slack.ts +86 -17
  142. package/Server/Utils/Workspace/Slack/app-manifest.json +2 -0
  143. package/Server/Utils/Workspace/Workspace.ts +171 -54
  144. package/Server/Utils/Workspace/WorkspaceActionAuthorization.ts +252 -0
  145. package/Server/Utils/Workspace/WorkspaceBase.ts +39 -0
  146. package/Server/Utils/Workspace/WorkspaceOAuthState.ts +280 -0
  147. package/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.ts +96 -0
  148. package/Server/Utils/Workspace/WorkspaceReactionNote.ts +620 -0
  149. package/Tests/App/Dashboard/AttributesJSONDashboardSurfaces.test.tsx +496 -0
  150. package/Tests/App/Dashboard/AutoRemediationRulesTableCommandRunners.test.tsx +152 -0
  151. package/Tests/App/Dashboard/BreadcrumbCoverage.test.tsx +32 -0
  152. package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +794 -0
  153. package/Tests/App/Dashboard/CreateOAuthWorkflowVariableModal.test.tsx +840 -0
  154. package/Tests/App/Dashboard/CreateWorkflowModal.test.tsx +653 -0
  155. package/Tests/App/Dashboard/DatabaseMonitorStepForm.test.tsx +197 -0
  156. package/Tests/App/Dashboard/DatabaseMonitorView.test.tsx +376 -0
  157. package/Tests/App/Dashboard/DisabledWarningRobustness.test.tsx +262 -0
  158. package/Tests/App/Dashboard/EventNotes.test.tsx +2080 -0
  159. package/Tests/App/Dashboard/EventNotesPages.test.tsx +486 -0
  160. package/Tests/App/Dashboard/EventNotesUtil.test.ts +933 -0
  161. package/Tests/App/Dashboard/ExceptionMonitorEnvironmentFilter.test.tsx +218 -0
  162. package/Tests/App/Dashboard/IncidentChangeStateNotifyDefault.test.tsx +665 -0
  163. package/Tests/App/Dashboard/IncidentEpisodeFeedPublicNoteNotifyDefault.test.tsx +494 -0
  164. package/Tests/App/Dashboard/IncidentEpisodeOverviewNotifyDefault.test.tsx +706 -0
  165. package/Tests/App/Dashboard/IncidentFeedPublicNoteNotifyDefault.test.tsx +472 -0
  166. package/Tests/App/Dashboard/IncidentOverviewNotifyDefault.test.tsx +858 -0
  167. package/Tests/App/Dashboard/IncomingEmailAddressSettings.test.tsx +567 -0
  168. package/Tests/App/Dashboard/InvestigationClusterToolFormat.test.ts +241 -0
  169. package/Tests/App/Dashboard/InvestigationEvidenceKubectl.test.tsx +322 -0
  170. package/Tests/App/Dashboard/InvestigationPanel.test.tsx +12 -0
  171. package/Tests/App/Dashboard/InvestigationPanelClusterAccess.test.tsx +476 -0
  172. package/Tests/App/Dashboard/InvestigationRunDetailsKubectl.test.tsx +383 -0
  173. package/Tests/App/Dashboard/KubectlActivitySummary.test.tsx +366 -0
  174. package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +2886 -0
  175. package/Tests/App/Dashboard/KubernetesClusterAiPage.test.tsx +2688 -0
  176. package/Tests/App/Dashboard/KubernetesClusterAiPageServerParity.test.ts +915 -0
  177. package/Tests/App/Dashboard/LayerDateTimeFieldTimezoneName.test.tsx +66 -0
  178. package/Tests/App/Dashboard/LogMonitorPreview.test.tsx +174 -0
  179. package/Tests/App/Dashboard/MonitorFeedRefresh.test.tsx +279 -0
  180. package/Tests/App/Dashboard/MonitorMetricQueryConfig.test.ts +244 -0
  181. package/Tests/App/Dashboard/MonitorOpenWorkCard.test.tsx +381 -0
  182. package/Tests/App/Dashboard/MonitorOpenWorkHook.test.tsx +784 -0
  183. package/Tests/App/Dashboard/MonitorOverviewData.test.tsx +2199 -0
  184. package/Tests/App/Dashboard/MonitorOverviewHero.test.tsx +1169 -0
  185. package/Tests/App/Dashboard/MonitorOverviewInput.test.ts +1127 -0
  186. package/Tests/App/Dashboard/MonitorOverviewPage.test.tsx +2136 -0
  187. package/Tests/App/Dashboard/MonitorOverviewSelectReadable.test.ts +368 -0
  188. package/Tests/App/Dashboard/MonitorOverviewStatBar.test.tsx +526 -0
  189. package/Tests/App/Dashboard/MonitorOverviewSupportingCards.test.tsx +542 -0
  190. package/Tests/App/Dashboard/MonitorOwnersCombine.test.ts +299 -0
  191. package/Tests/App/Dashboard/MonitorProbesCard.test.tsx +602 -0
  192. package/Tests/App/Dashboard/MonitorResponseTimeCard.test.tsx +386 -0
  193. package/Tests/App/Dashboard/MonitorSetupAndConnectionCards.test.tsx +612 -0
  194. package/Tests/App/Dashboard/MonitorStatusChangesCard.test.tsx +257 -0
  195. package/Tests/App/Dashboard/MonitorSummaryTestMonitorButton.test.tsx +360 -1
  196. package/Tests/App/Dashboard/MonitorUptimeHistoryCard.test.tsx +835 -0
  197. package/Tests/App/Dashboard/MonitorUptimeSummaryHook.test.tsx +971 -0
  198. package/Tests/App/Dashboard/MonitorViewLayout.test.tsx +580 -0
  199. package/Tests/App/Dashboard/OnCallLayerRestrictionTimesPreserved.test.tsx +441 -0
  200. package/Tests/App/Dashboard/OnCallNavbar.test.tsx +214 -0
  201. package/Tests/App/Dashboard/OnCallSchedulePreviewCalendarDisplay.test.tsx +1389 -0
  202. package/Tests/App/Dashboard/OnCallSchedulePreviewOverrides.test.tsx +205 -1
  203. package/Tests/App/Dashboard/OnCallScheduleTimeInputsSettingsZone.test.tsx +198 -0
  204. package/Tests/App/Dashboard/PublicNotePagesNotifyDefault.test.tsx +524 -0
  205. package/Tests/App/Dashboard/RemediationSuggestionCardApproval.test.tsx +702 -0
  206. package/Tests/App/Dashboard/RemoveUserFromProject.test.tsx +427 -0
  207. package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +4 -0
  208. package/Tests/App/Dashboard/RumSessionReplaySideMenu.test.tsx +3 -1
  209. package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +166 -0
  210. package/Tests/App/Dashboard/RunnerKubernetesAgentForm.test.tsx +622 -0
  211. package/Tests/App/Dashboard/ScheduledMaintenanceChangeStateNotifyDefault.test.tsx +1491 -0
  212. package/Tests/App/Dashboard/ScheduledMaintenanceFeedPublicNoteNotifyDefault.test.tsx +489 -0
  213. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewNotifyDefault.test.tsx +909 -0
  214. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +14 -0
  215. package/Tests/App/Dashboard/ScheduledMaintenanceWindowStatsTranslation.test.tsx +307 -0
  216. package/Tests/App/Dashboard/SecurityEventAttributeColumnPicker.test.tsx +542 -0
  217. package/Tests/App/Dashboard/SecurityEventConnectionFormModal.test.tsx +174 -0
  218. package/Tests/App/Dashboard/SecurityEventConnectionsEmptyState.test.tsx +973 -212
  219. package/Tests/App/Dashboard/SecurityEventConnectionsTable.test.tsx +491 -52
  220. package/Tests/App/Dashboard/SecurityEventDetailPanel.test.tsx +301 -0
  221. package/Tests/App/Dashboard/SecurityEventListRow.test.tsx +158 -1
  222. package/Tests/App/Dashboard/SecurityEventProviderTile.test.tsx +869 -0
  223. package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +959 -94
  224. package/Tests/App/Dashboard/SecurityEventsNoResults.test.tsx +2 -0
  225. package/Tests/App/Dashboard/SecurityEventsViewer.test.tsx +274 -1
  226. package/Tests/App/Dashboard/TeamMembershipRemoval.test.ts +900 -0
  227. package/Tests/App/Dashboard/TeamMembershipRemovalPages.test.tsx +460 -0
  228. package/Tests/App/Dashboard/TimezoneElements.test.tsx +321 -0
  229. package/Tests/App/Dashboard/TimezoneSelectButton.test.tsx +634 -0
  230. package/Tests/App/Dashboard/TraceExplorer.test.tsx +260 -0
  231. package/Tests/App/Dashboard/TraceMonitorPreview.test.tsx +182 -0
  232. package/Tests/App/Dashboard/UserTimezoneInit.test.tsx +544 -0
  233. package/Tests/App/Dashboard/WorkflowVariableModals.test.tsx +1630 -0
  234. package/Tests/App/Dashboard/WorkflowVariableRoutes.test.tsx +603 -0
  235. package/Tests/App/Dashboard/WorkflowVariableTokenStatus.test.tsx +589 -0
  236. package/Tests/App/Dashboard/WorkflowVariableUtil.test.ts +1543 -0
  237. package/Tests/App/Dashboard/WorkflowVariableView.test.tsx +3227 -0
  238. package/Tests/App/Dashboard/WorkflowVariablesTable.test.tsx +1277 -395
  239. package/Tests/App/StatusPage/StatusPageOverviewMonitorGroupUptime.test.tsx +714 -0
  240. package/Tests/App/StatusPage/StatusPageOverviewUptimeBars.NewYork.test.tsx +1009 -0
  241. package/Tests/App/StatusPage/StatusPageOverviewUptimeBars.test.tsx +1092 -0
  242. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +5 -0
  243. package/Tests/Models/DatabaseModels/KubernetesClusterAiAccessColumns.test.ts +520 -0
  244. package/Tests/Models/DatabaseModels/MonitorSecretKeyColumnAccessControl.test.ts +66 -2
  245. package/Tests/Models/DatabaseModels/WorkspaceProjectAuthTokenAccessControl.test.ts +236 -0
  246. package/Tests/Models/IncidentEpisodePublicNoteNotifyColumnContract.test.ts +103 -0
  247. package/Tests/Models/IncidentPublicNoteNotifyColumnContract.test.ts +96 -0
  248. package/Tests/Models/ScheduledMaintenancePublicNoteNotifyColumnContract.test.ts +111 -0
  249. package/Tests/Server/API/AIInvestigationAPI.test.ts +976 -0
  250. package/Tests/Server/API/AutoRemediationApproveKubectlRecheck.test.ts +836 -0
  251. package/Tests/Server/API/CommonAPIAssertCanCreateTable.test.ts +565 -0
  252. package/Tests/Server/API/CommonAPIAssertCanReadTable.test.ts +282 -0
  253. package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +1744 -0
  254. package/Tests/Server/API/LogHistogramAPI.test.ts +371 -0
  255. package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +125 -30
  256. package/Tests/Server/API/MicrosoftTeamsOAuthState.test.ts +1121 -0
  257. package/Tests/Server/API/MonitorUptimeSummaryAPI.test.ts +685 -0
  258. package/Tests/Server/API/SessionReplayAPI.test.ts +602 -1
  259. package/Tests/Server/API/SlackChannelCacheAPI.test.ts +358 -0
  260. package/Tests/Server/API/SlackOAuthState.test.ts +688 -0
  261. package/Tests/Server/API/StatusPageOverviewMonitorGroupUptime.test.ts +527 -0
  262. package/Tests/Server/API/StatusPageTestEmailReportAuth.test.ts +2 -0
  263. package/Tests/Server/API/StatusPageUptimeAPI.test.ts +427 -0
  264. package/Tests/Server/API/UserProjectsAPI.test.ts +4 -0
  265. package/Tests/Server/API/WorkflowVariableAPI.test.ts +404 -0
  266. package/Tests/Server/API/WorkspaceOAuthTestHelpers.ts +289 -0
  267. package/Tests/Server/API/WorkspaceSendTestNotificationRoutes.test.ts +2064 -0
  268. package/Tests/Server/Infrastructure/GlobalCache.test.ts +86 -0
  269. package/Tests/Server/Infrastructure/Postgres/AddKubernetesClusterAiAccessMigration.test.ts +589 -0
  270. package/Tests/Server/Infrastructure/Postgres/AddOAuth2WorkflowVariablesMigration.test.ts +254 -0
  271. package/Tests/Server/Middleware/BlockedUserMiddleware.test.ts +403 -0
  272. package/Tests/Server/Middleware/MasterAdminAuthorization.test.ts +13 -0
  273. package/Tests/Server/Middleware/PublicRouteUserMiddleware.test.ts +2 -0
  274. package/Tests/Server/Middleware/RemovedProjectMemberAuthorization.test.ts +469 -0
  275. package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +77 -1
  276. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +211 -0
  277. package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +358 -0
  278. package/Tests/Server/Middleware/UserAuthorization.test.ts +97 -0
  279. package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +2 -0
  280. package/Tests/Server/Services/AccessTokenProjectUserGrant.test.ts +14 -2
  281. package/Tests/Server/Services/AccessTokenRemovedMemberAccess.test.ts +1044 -0
  282. package/Tests/Server/Services/AddOwnersIdempotency.test.ts +5 -0
  283. package/Tests/Server/Services/AlertEpisodeMemberCreatePermission.test.ts +139 -0
  284. package/Tests/Server/Services/AutoRemediationClusterRuleEngine.test.ts +1361 -0
  285. package/Tests/Server/Services/AutoRemediationRuleCommandRunners.test.ts +375 -0
  286. package/Tests/Server/Services/CrossProjectRelationWriteGuard.test.ts +2384 -0
  287. package/Tests/Server/Services/FindOwnersProjectMembership.test.ts +267 -0
  288. package/Tests/Server/Services/InboundEmail/SendGridInboundProviderAddress.test.ts +90 -0
  289. package/Tests/Server/Services/IncidentEpisodeMemberCreatePermission.test.ts +143 -0
  290. package/Tests/Server/Services/IncidentEpisodePublicNoteNotifyDefault.test.ts +805 -0
  291. package/Tests/Server/Services/IncidentPublicNoteNotifyDefault.test.ts +724 -0
  292. package/Tests/Server/Services/IncidentRoleProjectMembership.test.ts +233 -0
  293. package/Tests/Server/Services/KubernetesClusterAiAccessAgentRunnerAssignments.test.ts +372 -0
  294. package/Tests/Server/Services/KubernetesClusterAiAccessBindingGuard.test.ts +1876 -0
  295. package/Tests/Server/Services/KubernetesClusterAiAccessDeletedRunnerRemedy.test.ts +620 -0
  296. package/Tests/Server/Services/KubernetesClusterAiAccessGapNextSteps.test.ts +421 -0
  297. package/Tests/Server/Services/KubernetesClusterAiAccessService.test.ts +3662 -0
  298. package/Tests/Server/Services/KubernetesClusterAiAccessSubjectClusters.test.ts +405 -0
  299. package/Tests/Server/Services/KubernetesClusterAiSettingsPermission.test.ts +975 -0
  300. package/Tests/Server/Services/KubernetesClusterServiceAiAccessFeed.test.ts +497 -0
  301. package/Tests/Server/Services/KubernetesClusterServiceDeleteSettlesRemediation.test.ts +328 -0
  302. package/Tests/Server/Services/LogAggregationService.test.ts +99 -0
  303. package/Tests/Server/Services/MonitorServiceIncomingEmailCustomAddress.test.ts +447 -0
  304. package/Tests/Server/Services/MonitorServiceProbeFlagSync.test.ts +1334 -0
  305. package/Tests/Server/Services/MonitorServiceProbeStatusGrouping.test.ts +1640 -0
  306. package/Tests/Server/Services/MonitorServiceRefreshCurrentStatus.test.ts +225 -0
  307. package/Tests/Server/Services/MonitorStatusBridgeProbePath.test.ts +8 -8
  308. package/Tests/Server/Services/MonitorStatusTimelineDailyAggregates.test.ts +264 -1
  309. package/Tests/Server/Services/MonitorStatusTimelineMergedDowntime.test.ts +284 -0
  310. package/Tests/Server/Services/MonitorUptimeSummaryService.test.ts +1043 -0
  311. package/Tests/Server/Services/NetworkDeviceRuleEngines.test.ts +5 -0
  312. package/Tests/Server/Services/OnCallUndeliverablePageOwnerMembership.test.ts +359 -0
  313. package/Tests/Server/Services/ProbeServiceDashboardLink.test.ts +191 -0
  314. package/Tests/Server/Services/ProjectOwnersProjectMembership.test.ts +221 -0
  315. package/Tests/Server/Services/RuleRun/IncidentAlertMaintenanceRuleEnginesRun.test.ts +5 -0
  316. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupARun.test.ts +28 -0
  317. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupBRun.test.ts +9 -1
  318. package/Tests/Server/Services/RunnerJobEnqueueAiCommandAgentRunner.test.ts +230 -0
  319. package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +978 -0
  320. package/Tests/Server/Services/RunnerJobKubectlWriteScope.test.ts +866 -0
  321. package/Tests/Server/Services/RunnerJobSubmitResultRedaction.test.ts +322 -0
  322. package/Tests/Server/Services/RunnerJobSubmitResultUnstorableText.test.ts +357 -0
  323. package/Tests/Server/Services/RunnerJobTimeoutReason.test.ts +227 -0
  324. package/Tests/Server/Services/RunnerServiceAgentName.test.ts +581 -0
  325. package/Tests/Server/Services/ScheduledMaintenancePublicNoteNotifyDefault.test.ts +802 -0
  326. package/Tests/Server/Services/ScheduledMaintenanceSubscriberTemplateFormats.test.ts +53 -0
  327. package/Tests/Server/Services/ServiceLevelObjectiveLabelAndOwnerRuleEngines.test.ts +5 -0
  328. package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +12 -0
  329. package/Tests/Server/Services/StatusPageSubscriberReport.test.ts +1176 -1
  330. package/Tests/Server/Services/TeamMemberBillingSeatSync.test.ts +9 -0
  331. package/Tests/Server/Services/TeamMemberOnCallCleanup.test.ts +18 -0
  332. package/Tests/Server/Services/TeamMemberProjectMembership.test.ts +255 -0
  333. package/Tests/Server/Services/TeamMemberRemovalRevokesProjectAccess.test.ts +600 -0
  334. package/Tests/Server/Services/TeamMemberResourceCleanup.test.ts +731 -0
  335. package/Tests/Server/Services/TeamMemberWorkspaceAccountCleanup.test.ts +164 -0
  336. package/Tests/Server/Services/TraceAggregationService.test.ts +64 -0
  337. package/Tests/Server/Services/UserServiceBlockedUser.test.ts +293 -0
  338. package/Tests/Server/Services/WorkflowVariableOAuthHooks.test.ts +1016 -0
  339. package/Tests/Server/Services/WorkflowVariableOAuthPostgres.test.ts +543 -0
  340. package/Tests/Server/Services/WorkflowVariableRenameUniqueness.test.ts +16 -5
  341. package/Tests/Server/Services/WorkspaceNotificationRuleNoteDelivery.test.ts +473 -0
  342. package/Tests/Server/Services/WorkspaceNotificationRuleSendTestNotification.test.ts +3690 -0
  343. package/Tests/Server/Services/WorkspaceProjectAuthTokenMiscDataSecrets.test.ts +374 -0
  344. package/Tests/Server/Services/WorkspaceProjectAuthTokenSlackChannelCache.test.ts +143 -0
  345. package/Tests/Server/Types/Database/Permissions/WorkflowVariableOAuthColumnPermission.test.ts +250 -0
  346. package/Tests/Server/Types/Database/QueryHelperJsonContains.test.ts +96 -0
  347. package/Tests/Server/Types/Markdown.test.ts +1033 -0
  348. package/Tests/Server/Utils/AI/ClusterAccessContext.test.ts +285 -0
  349. package/Tests/Server/Utils/AI/CodeFix/CodeFixAgentAuth.test.ts +159 -1
  350. package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +752 -0
  351. package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +1840 -0
  352. package/Tests/Server/Utils/AI/KubectlJobRunner.test.ts +1067 -0
  353. package/Tests/Server/Utils/AI/KubectlJobRunnerFinishedJob.test.ts +355 -0
  354. package/Tests/Server/Utils/AI/PostIncidentStatusUpdateTool.test.ts +496 -0
  355. package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +305 -0
  356. package/Tests/Server/Utils/AI/RemediationCommandToolsKubectl.test.ts +1365 -0
  357. package/Tests/Server/Utils/AI/RemediationCommandToolsKubectlOutcome.test.ts +639 -0
  358. package/Tests/Server/Utils/AI/RemediationCommandToolsLiveCluster.test.ts +1585 -0
  359. package/Tests/Server/Utils/AI/RemediationCommandToolsRunnerScope.test.ts +1065 -0
  360. package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +2138 -1
  361. package/Tests/Server/Utils/AI/RemediationExecutionRunnerClusterMode.test.ts +1035 -0
  362. package/Tests/Server/Utils/AI/RemediationKubectlCopyParity.test.ts +517 -0
  363. package/Tests/Server/Utils/AI/ResourceTools.test.ts +27 -1
  364. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutor.test.ts +1371 -24
  365. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorRollbackRace.test.ts +962 -0
  366. package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorUnknownRun.test.ts +518 -0
  367. package/Tests/Server/Utils/AutoRemediation/CommandPlanVerification.test.ts +939 -2
  368. package/Tests/Server/Utils/Database/ProjectScopedRelationReferences.test.ts +371 -0
  369. package/Tests/Server/Utils/Monitor/AffectedResourceList.test.ts +64 -0
  370. package/Tests/Server/Utils/Monitor/DatabaseMetricObservationRemediation.test.ts +102 -0
  371. package/Tests/Server/Utils/Monitor/MonitorAlertCriteriaReferences.test.ts +362 -0
  372. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorBreachingSamples.test.ts +55 -0
  373. package/Tests/Server/Utils/Monitor/MonitorEmailAddressRedaction.test.ts +255 -0
  374. package/Tests/Server/Utils/Monitor/MonitorIncidentCriteriaReferences.test.ts +347 -0
  375. package/Tests/Server/Utils/Monitor/MonitorIncidentMemberRoleMembership.test.ts +203 -0
  376. package/Tests/Server/Utils/Monitor/ProbeMonitorsNotification.test.ts +1147 -0
  377. package/Tests/Server/Utils/PushNotificationUtilCreators.test.ts +79 -0
  378. package/Tests/Server/Utils/ResourceFeed/ResourceFeedUtil.test.ts +21 -1
  379. package/Tests/Server/Utils/Rules/OwnerRuleAssignment.test.ts +155 -1
  380. package/Tests/Server/Utils/SessionReplay/SessionReplayReadServiceQueries.test.ts +288 -0
  381. package/Tests/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.test.ts +304 -0
  382. package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +40 -3
  383. package/Tests/Server/Utils/Workflow/OAuth2TokenClient.test.ts +702 -0
  384. package/Tests/Server/Utils/Workflow/OAuth2TokenClientHttpIntegration.test.ts +507 -0
  385. package/Tests/Server/Utils/Workflow/WorkflowVariableOAuthToken.test.ts +831 -0
  386. package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +63 -1
  387. package/Tests/Server/Utils/Workspace/MicrosoftTeamsAppAccessToken.test.ts +256 -0
  388. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelSend.test.ts +60 -0
  389. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChatActionAuthorization.test.ts +442 -0
  390. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChats.test.ts +44 -2
  391. package/Tests/Server/Utils/Workspace/MicrosoftTeamsDirectMessage.test.ts +55 -0
  392. package/Tests/Server/Utils/Workspace/MicrosoftTeamsReactionNoteSync.test.ts +1522 -0
  393. package/Tests/Server/Utils/Workspace/MicrosoftTeamsServiceUrl.test.ts +130 -0
  394. package/Tests/Server/Utils/Workspace/MicrosoftTeamsTeamInstalls.test.ts +4 -4
  395. package/Tests/Server/Utils/Workspace/Slack/SlackActionAuthorization.test.ts +691 -0
  396. package/Tests/Server/Utils/Workspace/Slack/SlackMessageByTimestamp.test.ts +253 -0
  397. package/Tests/Server/Utils/Workspace/Slack/SlackReactionNote.test.ts +574 -0
  398. package/Tests/Server/Utils/Workspace/WorkspaceActionAuthorization.test.ts +488 -0
  399. package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +861 -0
  400. package/Tests/Server/Utils/Workspace/WorkspaceMessageAuthor.test.ts +635 -0
  401. package/Tests/Server/Utils/Workspace/WorkspaceOAuthState.test.ts +548 -0
  402. package/Tests/Server/Utils/Workspace/WorkspaceReactionNote.test.ts +839 -0
  403. package/Tests/Server/Utils/Workspace/WorkspaceSendErrorMessage.test.ts +725 -0
  404. package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +283 -9
  405. package/Tests/Types/DateBrowserLocalWallClock.test.ts +280 -0
  406. package/Tests/Types/DateLocalShortMonthNameFallback.test.ts +389 -0
  407. package/Tests/Types/DateUserTimezone.test.ts +177 -4
  408. package/Tests/Types/Kubernetes/KubernetesAgentChartAiAccess.test.ts +306 -0
  409. package/Tests/Types/Kubernetes/KubernetesClusterAiAccess.test.ts +283 -0
  410. package/Tests/Types/Kubernetes/KubernetesRunnerPostureWriteScope.test.ts +68 -0
  411. package/Tests/Types/Monitor/DatabaseMonitor/SqlServerPlatform.test.ts +144 -0
  412. package/Tests/Types/Monitor/MonitorStepExceptionMonitor.test.ts +160 -0
  413. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +53 -0
  414. package/Tests/Types/Runbook/RunbookStepType.test.ts +91 -16
  415. package/Tests/Types/Runner/RunnerLiveStatus.test.ts +14 -3
  416. package/Tests/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.test.ts +15 -0
  417. package/Tests/Types/StatusPage/PublicNoteSubscriberNotificationDefault.test.ts +1868 -0
  418. package/Tests/Types/Timezone.test.ts +5 -0
  419. package/Tests/Types/TimezoneAlias.test.ts +1034 -0
  420. package/Tests/Types/Workflow/JiraTemplateFixtures.ts +833 -0
  421. package/Tests/Types/Workflow/JiraTemplateScripts.test.ts +5414 -0
  422. package/Tests/Types/Workflow/JiraTemplateSimulation.test.ts +4803 -0
  423. package/Tests/Types/Workflow/JiraTemplates.test.ts +5429 -0
  424. package/Tests/Types/Workflow/Templates.test.ts +79 -4
  425. package/Tests/Types/Workflow/WorkflowVariableOAuth.test.ts +520 -0
  426. package/Tests/Types/Workspace/WorkspaceNoteReaction.test.ts +177 -0
  427. package/Tests/UI/Components/AttributesJSON/AttributesJSONView.test.tsx +390 -0
  428. package/Tests/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.test.tsx +566 -0
  429. package/Tests/UI/Components/AttributesJSON/JSONHighlight.test.ts +131 -0
  430. package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +276 -1
  431. package/Tests/UI/Components/Calendar/Calendar.test.tsx +1611 -0
  432. package/Tests/UI/Components/Calendar/CalendarDayLayout.test.ts +1486 -0
  433. package/Tests/UI/Components/Calendar/CalendarDayLayoutDst.test.ts +632 -0
  434. package/Tests/UI/Components/Calendar/CalendarDst.test.tsx +388 -0
  435. package/Tests/UI/Components/Charts/ChartGroupPlotFloor.test.tsx +170 -0
  436. package/Tests/UI/Components/Charts/HistogramSelection.test.ts +282 -0
  437. package/Tests/UI/Components/CustomTimeRangeModal.test.tsx +6 -0
  438. package/Tests/UI/Components/CustomTimeRangeModalTimezoneTranslation.test.tsx +285 -0
  439. package/Tests/UI/Components/Dropdown.test.tsx +999 -2
  440. package/Tests/UI/Components/Forms/FormFieldCheckboxTranslation.test.tsx +216 -0
  441. package/Tests/UI/Components/Forms/FormFieldTimezoneDescriptionTranslation.test.tsx +461 -0
  442. package/Tests/UI/Components/Forms/IncidentEpisodePublicNoteNotifyPayload.test.tsx +641 -0
  443. package/Tests/UI/Components/Forms/IncidentPublicNoteNotifyPayload.test.tsx +346 -0
  444. package/Tests/UI/Components/Forms/ScheduledMaintenancePublicNoteNotifyPayload.test.tsx +493 -0
  445. package/Tests/UI/Components/Graphs/DayUptimeGraph.test.tsx +911 -2
  446. package/Tests/UI/Components/Graphs/DayUptimeGraphTimezone.NewYork.test.tsx +730 -0
  447. package/Tests/UI/Components/Graphs/DayUptimeGraphTimezone.Tokyo.test.tsx +506 -0
  448. package/Tests/UI/Components/HistogramClickToZoom.test.tsx +619 -0
  449. package/Tests/UI/Components/LogDetailsPanelAttributesJSON.test.tsx +248 -0
  450. package/Tests/UI/Components/LogsViewerHistogramZoom.test.tsx +47 -1
  451. package/Tests/UI/Components/LogsViewerSmallScreens.test.tsx +620 -0
  452. package/Tests/UI/Components/ModelPageModelChange.test.tsx +242 -3
  453. package/Tests/UI/Components/ModelTable/BaseModelTableDeleteConfirmation.test.tsx +521 -0
  454. package/Tests/UI/Components/MonitorGraphs/Uptime.test.tsx +406 -2
  455. package/Tests/UI/Components/MonitorGraphs/UptimeBarDayModal.test.tsx +169 -2
  456. package/Tests/UI/Components/TelemetryViewer/TelemetryViewerHistogramClickZoom.test.tsx +266 -0
  457. package/Tests/UI/Components/TelemetryViewer/TelemetryViewerSmallScreens.test.tsx +439 -0
  458. package/Tests/UI/Components/TimezoneDropdownLegacyValues.test.tsx +704 -0
  459. package/Tests/UI/Components/UseHistogramZoom.test.tsx +89 -1
  460. package/Tests/UI/Components/UseLogsHistogram.test.tsx +175 -0
  461. package/Tests/UI/Monitor/MonitorSummarySnapshotRender.test.tsx +5 -5
  462. package/Tests/UI/Telemetry/TelemetryDetailPanel.test.tsx +28 -0
  463. package/Tests/UI/Utils/ProjectUsersModelAPI.test.ts +51 -0
  464. package/Tests/UI/Utils/Timezone.test.ts +747 -33
  465. package/Tests/UI/Workspace/SendTestNotificationButton.test.tsx +1854 -0
  466. package/Tests/UI/Workspace/WorkspaceCardsSendTestNotification.test.tsx +1864 -0
  467. package/Tests/Utils/AI/InvestigationReport.test.ts +435 -7
  468. package/Tests/Utils/AiRemediation/KubectlAllowlistValidatorParity.test.ts +1084 -0
  469. package/Tests/Utils/AiRemediation/KubectlOutputRedactor.test.ts +2531 -0
  470. package/Tests/Utils/AiRemediation/KubectlPolicy.test.ts +1895 -0
  471. package/Tests/Utils/AiRemediation/KubectlPolicyAllowlist.test.ts +428 -0
  472. package/Tests/Utils/AiRemediation/KubectlPolicyChartRbacParity.test.ts +828 -0
  473. package/Tests/Utils/AiRemediation/KubectlPolicyCustomResourceScope.test.ts +573 -0
  474. package/Tests/Utils/AiRemediation/KubectlPolicyDenials.test.ts +1525 -0
  475. package/Tests/Utils/AiRemediation/KubectlPolicyExposeOverrides.test.ts +275 -0
  476. package/Tests/Utils/AiRemediation/KubectlPolicyNodePatch.test.ts +428 -0
  477. package/Tests/Utils/AiRemediation/KubectlPolicyObjectWords.test.ts +195 -0
  478. package/Tests/Utils/AiRemediation/KubectlPolicyPatchParents.test.ts +637 -0
  479. package/Tests/Utils/AiRemediation/KubectlPolicyPodSecurityBaseline.test.ts +322 -0
  480. package/Tests/Utils/AiRemediation/KubectlPolicySafeWriteScope.test.ts +1026 -0
  481. package/Tests/Utils/AiRemediation/KubectlWaitBudget.test.ts +267 -0
  482. package/Tests/Utils/AiRemediation/KubectlWriteScope.test.ts +390 -0
  483. package/Tests/Utils/AiRemediation/KubectlWriteScopeCallerParity.test.ts +777 -0
  484. package/Tests/Utils/AiRemediation/KubectlWriteScopeClusterScoped.test.ts +613 -0
  485. package/Tests/Utils/AiRemediation/KubectlWriteScopeEntryPoint.test.ts +576 -0
  486. package/Tests/Utils/AiRemediation/KubectlWriteScopeKubectlSpellings.test.ts +752 -0
  487. package/Tests/Utils/AiRemediation/KubectlWriteScopeObjectWords.test.ts +358 -0
  488. package/Tests/Utils/AiRemediation/KubectlWriteScopeOverrides.test.ts +293 -0
  489. package/Tests/Utils/AiRemediation/KubectlWriteScopeParityCases.ts +598 -0
  490. package/Tests/Utils/AiRemediation/KubectlWriteScopePolicyParity.test.ts +403 -0
  491. package/Tests/Utils/Dashboard/DashboardClockComponent.test.ts +154 -5
  492. package/Tests/Utils/Monitor/IncomingEmailMonitorAddress.test.ts +478 -0
  493. package/Tests/Utils/Monitor/MonitorCheckScheduleUtil.test.ts +646 -0
  494. package/Tests/Utils/Monitor/MonitorOverviewCriteriaUtil.test.ts +292 -0
  495. package/Tests/Utils/Monitor/MonitorOverviewFamily.test.ts +274 -0
  496. package/Tests/Utils/Monitor/MonitorOverviewPresentationUtil.test.ts +3100 -0
  497. package/Tests/Utils/Monitor/MonitorOverviewProbeUtil.test.ts +1412 -0
  498. package/Tests/Utils/Monitor/MonitorOverviewTargetUtil.test.ts +374 -0
  499. package/Tests/Utils/Monitor/MonitorStatusHistoryUtil.test.ts +332 -0
  500. package/Tests/Utils/Monitor/MonitorUptimeSummaryUtil.test.ts +946 -0
  501. package/Tests/Utils/Rum/SessionIdentity.test.ts +94 -0
  502. package/Tests/Utils/Rum/SessionReplayWafCompatibility.test.ts +840 -0
  503. package/Tests/Utils/Rum/SessionReplayWireEncoding.test.ts +208 -0
  504. package/Tests/Utils/Rum/UserFlow.test.ts +1010 -0
  505. package/Tests/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.test.ts +217 -0
  506. package/Tests/Utils/StatusPage/ResourceUptime.test.ts +1272 -1
  507. package/Tests/Utils/StatusPage/UptimeDailyAggregateTotals.test.ts +298 -0
  508. package/Tests/Utils/StatusPage/UptimeDailyAggregateUtil.test.ts +649 -1
  509. package/Tests/Utils/StatusPage/UptimeDailyAggregateWindow.test.ts +314 -0
  510. package/Tests/Utils/Telemetry/AttributesJSON.test.ts +454 -0
  511. package/Tests/Utils/Uptime/DayUptimeGraphUtil.test.ts +418 -2
  512. package/Tests/Utils/Uptime/DayUptimeGraphUtilMidnightDst.test.ts +160 -0
  513. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Auckland.test.ts +45 -0
  514. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Kolkata.test.ts +40 -0
  515. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.London.test.ts +147 -0
  516. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.NewYork.test.ts +48 -0
  517. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezone.Tokyo.test.ts +39 -0
  518. package/Tests/Utils/Uptime/DayUptimeGraphUtilTimezoneCases.ts +1015 -0
  519. package/Tests/Utils/Uptime/UptimeUtil.test.ts +75 -0
  520. package/Tests/Utils/Uptime/UptimeUtilChronologicalOrder.test.ts +1279 -0
  521. package/Types/AutoRemediation/AiRemediationCommandPlan.ts +203 -5
  522. package/Types/Date.ts +121 -7
  523. package/Types/Email/EmailMessage.ts +8 -0
  524. package/Types/Email/EmailTemplateType.ts +1 -0
  525. package/Types/Exception/ExceptionMessages.ts +1 -0
  526. package/Types/Kubernetes/KubernetesClusterAiAccess.ts +488 -0
  527. package/Types/Kubernetes/KubernetesClusterAiAccessPermissions.ts +54 -0
  528. package/Types/Kubernetes/KubernetesClusterAiAccessToolNames.ts +17 -0
  529. package/Types/Monitor/DatabaseMonitor/DatabaseMonitorResponse.ts +9 -0
  530. package/Types/Monitor/DatabaseMonitor/SqlServerPlatform.ts +117 -0
  531. package/Types/Monitor/KubernetesAlertTemplates.ts +6 -5
  532. package/Types/Monitor/MonitorStepExceptionMonitor.ts +56 -0
  533. package/Types/Monitor/MonitorUptimeSummary.ts +113 -0
  534. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +11 -0
  535. package/Types/Rum/SessionReplay.ts +55 -2
  536. package/Types/Rum/SessionReplayApi.ts +44 -1
  537. package/Types/Rum/UserFlow.ts +187 -0
  538. package/Types/Runbook/RunbookStepType.ts +10 -0
  539. package/Types/Runbook/RunnerJobOrigin.ts +15 -0
  540. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.ts +6 -2
  541. package/Types/StatusPage/MergedDowntimeTotals.ts +17 -0
  542. package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.ts +148 -0
  543. package/Types/StatusPage/UptimeDailyAggregate.ts +15 -0
  544. package/Types/Telemetry/TelemetryIngestSurface.ts +9 -0
  545. package/Types/Timezone.ts +5 -0
  546. package/Types/TimezoneAlias.ts +385 -0
  547. package/Types/Workflow/Templates.ts +3041 -2
  548. package/Types/Workflow/WorkflowVariableOAuth.ts +476 -0
  549. package/Types/Workspace/WorkspaceNoteReaction.ts +132 -0
  550. package/Typings/Index.d.ts +24 -0
  551. package/UI/Components/AttributesJSON/AttributesJSONPreferences.ts +175 -0
  552. package/UI/Components/AttributesJSON/AttributesJSONView.tsx +138 -0
  553. package/UI/Components/AttributesJSON/AttributesViewToggle.tsx +79 -0
  554. package/UI/Components/AttributesJSON/BracesGlyph.tsx +30 -0
  555. package/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.tsx +491 -0
  556. package/UI/Components/AttributesJSON/JSONHighlight.ts +77 -0
  557. package/UI/Components/Calendar/Calendar.css +83 -0
  558. package/UI/Components/Calendar/Calendar.tsx +136 -7
  559. package/UI/Components/Calendar/CalendarDayLayout.ts +236 -0
  560. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +23 -1
  561. package/UI/Components/Charts/Utils/HistogramSelection.ts +117 -0
  562. package/UI/Components/Charts/Utils/useHistogramRangeSelection.ts +269 -0
  563. package/UI/Components/Charts/Utils/useHistogramZoom.ts +26 -2
  564. package/UI/Components/Date/CustomTimeRangeModal.tsx +26 -3
  565. package/UI/Components/Dropdown/Dropdown.tsx +58 -9
  566. package/UI/Components/Forms/Fields/FormField.tsx +49 -14
  567. package/UI/Components/Graphs/DayUptimeGraph.tsx +166 -25
  568. package/UI/Components/Graphs/UptimeBarTooltip.tsx +10 -2
  569. package/UI/Components/Graphs/UptimeDaySummary.tsx +8 -0
  570. package/UI/Components/LogsViewer/LogsViewer.tsx +52 -5
  571. package/UI/Components/LogsViewer/components/ColumnSelector.tsx +13 -2
  572. package/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.tsx +13 -1
  573. package/UI/Components/LogsViewer/components/LogDetailsPanel.tsx +91 -76
  574. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +15 -1
  575. package/UI/Components/LogsViewer/components/LogsHistogram.tsx +28 -106
  576. package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +54 -6
  577. package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +8 -2
  578. package/UI/Components/LogsViewer/useLogsHistogram.ts +39 -6
  579. package/UI/Components/ModelTable/BaseModelTable.tsx +66 -14
  580. package/UI/Components/MonitorGraphs/Uptime.tsx +12 -0
  581. package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +10 -2
  582. package/UI/Components/Page/ModelPage.tsx +59 -3
  583. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +69 -5
  584. package/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.tsx +12 -1
  585. package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +15 -1
  586. package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +36 -104
  587. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +9 -1
  588. package/UI/Utils/ModelAPI/ProjectUsersModelAPI.ts +19 -1
  589. package/UI/Utils/Timezone.ts +69 -28
  590. package/Utils/AI/InvestigationReport.ts +195 -25
  591. package/Utils/AiRemediation/KubectlOutputRedactor.ts +1724 -0
  592. package/Utils/AiRemediation/KubectlPolicy.ts +4136 -0
  593. package/Utils/AiRemediation/KubectlWaitBudget.ts +156 -0
  594. package/Utils/AiRemediation/KubectlWriteScope.ts +1964 -0
  595. package/Utils/Dashboard/Components/DashboardClockComponent.ts +7 -6
  596. package/Utils/Monitor/IncomingEmailMonitorAddress.ts +292 -0
  597. package/Utils/Monitor/MonitorCheckScheduleUtil.ts +654 -0
  598. package/Utils/Monitor/MonitorOverviewCriteriaUtil.ts +188 -0
  599. package/Utils/Monitor/MonitorOverviewFamily.ts +263 -0
  600. package/Utils/Monitor/MonitorOverviewPresentationUtil.ts +1958 -0
  601. package/Utils/Monitor/MonitorOverviewProbeUtil.ts +979 -0
  602. package/Utils/Monitor/MonitorOverviewTargetUtil.ts +299 -0
  603. package/Utils/Monitor/MonitorStatusHistoryUtil.ts +201 -0
  604. package/Utils/Monitor/MonitorUptimeSummaryUtil.ts +638 -0
  605. package/Utils/Rum/SessionIdentity.ts +44 -0
  606. package/Utils/Rum/SessionReplayWireEncoding.ts +137 -0
  607. package/Utils/Rum/UserFlow.ts +1527 -0
  608. package/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.ts +107 -0
  609. package/Utils/StatusPage/ResourceUptime.ts +99 -0
  610. package/Utils/StatusPage/UptimeDailyAggregateUtil.ts +197 -0
  611. package/Utils/Telemetry/AttributesJSON.ts +367 -0
  612. package/Utils/Uptime/DayUptimeGraphUtil.ts +165 -0
  613. package/Utils/Uptime/UptimeUtil.ts +122 -38
  614. package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js +8 -1
  615. package/build/dist/Models/DatabaseModels/AlertEpisodeMember.js.map +1 -1
  616. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
  617. package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
  618. package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js +8 -1
  619. package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js.map +1 -1
  620. package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js +10 -3
  621. package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js.map +1 -1
  622. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js +10 -3
  623. package/build/dist/Models/DatabaseModels/IncidentPublicNote.js.map +1 -1
  624. package/build/dist/Models/DatabaseModels/KubernetesCluster.js +434 -0
  625. package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
  626. package/build/dist/Models/DatabaseModels/Monitor.js +49 -0
  627. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  628. package/build/dist/Models/DatabaseModels/Runner.js +4 -4
  629. package/build/dist/Models/DatabaseModels/Runner.js.map +1 -1
  630. package/build/dist/Models/DatabaseModels/RunnerJob.js +66 -0
  631. package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
  632. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +11 -3
  633. package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js.map +1 -1
  634. package/build/dist/Models/DatabaseModels/WorkflowVariable.js +487 -3
  635. package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
  636. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js +64 -16
  637. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
  638. package/build/dist/Server/API/AIInvestigationAPI.js +205 -0
  639. package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
  640. package/build/dist/Server/API/AutoRemediationAPI.js +115 -2
  641. package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
  642. package/build/dist/Server/API/CommonAPI.js +49 -0
  643. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  644. package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js +564 -0
  645. package/build/dist/Server/API/KubernetesClusterAiAccessAPI.js.map +1 -0
  646. package/build/dist/Server/API/MicrosoftTeamsAPI.js +465 -176
  647. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  648. package/build/dist/Server/API/MonitorAPI.js +107 -1
  649. package/build/dist/Server/API/MonitorAPI.js.map +1 -1
  650. package/build/dist/Server/API/OnCallScheduleTimelineAPI.js +5 -16
  651. package/build/dist/Server/API/OnCallScheduleTimelineAPI.js.map +1 -1
  652. package/build/dist/Server/API/SlackAPI.js +322 -78
  653. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  654. package/build/dist/Server/API/StatusPageAPI.js +123 -17
  655. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  656. package/build/dist/Server/API/TelemetryAPI.js +144 -5
  657. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  658. package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js +1 -0
  659. package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js.map +1 -1
  660. package/build/dist/Server/API/WorkflowVariableAPI.js +109 -0
  661. package/build/dist/Server/API/WorkflowVariableAPI.js.map +1 -0
  662. package/build/dist/Server/Infrastructure/GlobalCache.js +29 -0
  663. package/build/dist/Server/Infrastructure/GlobalCache.js.map +1 -1
  664. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.js +38 -0
  665. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794300000000-AddOAuth2WorkflowVariables.js.map +1 -0
  666. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.js +54 -0
  667. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794400000000-AddKubernetesClusterAiAccess.js.map +1 -0
  668. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.js +14 -0
  669. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794500000000-AddIncomingEmailCustomAddressToMonitor.js.map +1 -0
  670. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.js +12 -0
  671. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794600000000-AddAuthTokenExpiresAtToWorkspaceProjectAuthToken.js.map +1 -0
  672. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.js +32 -0
  673. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794700000000-RemoveAppAccessTokenFromWorkspaceProjectAuthTokenMiscData.js.map +1 -0
  674. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +10 -0
  675. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  676. package/build/dist/Server/Middleware/MasterAdminAuthorization.js +21 -0
  677. package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
  678. package/build/dist/Server/Middleware/TelemetryIngest.js +32 -2
  679. package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
  680. package/build/dist/Server/Middleware/UserAuthorization.js +39 -6
  681. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  682. package/build/dist/Server/Services/AIAgentService.js +1 -0
  683. package/build/dist/Server/Services/AIAgentService.js.map +1 -1
  684. package/build/dist/Server/Services/AccessTokenService.js +87 -42
  685. package/build/dist/Server/Services/AccessTokenService.js.map +1 -1
  686. package/build/dist/Server/Services/AlertEpisodeMemberService.js +4 -0
  687. package/build/dist/Server/Services/AlertEpisodeMemberService.js.map +1 -1
  688. package/build/dist/Server/Services/AlertEpisodeService.js +12 -1
  689. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  690. package/build/dist/Server/Services/AlertService.js +110 -23
  691. package/build/dist/Server/Services/AlertService.js.map +1 -1
  692. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +716 -30
  693. package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
  694. package/build/dist/Server/Services/AutoRemediationRuleService.js +100 -0
  695. package/build/dist/Server/Services/AutoRemediationRuleService.js.map +1 -1
  696. package/build/dist/Server/Services/BillingService.js +1 -0
  697. package/build/dist/Server/Services/BillingService.js.map +1 -1
  698. package/build/dist/Server/Services/InboundEmail/Providers/SendGridInboundProvider.js +11 -16
  699. package/build/dist/Server/Services/InboundEmail/Providers/SendGridInboundProvider.js.map +1 -1
  700. package/build/dist/Server/Services/IncidentEpisodeMemberService.js +4 -0
  701. package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
  702. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +48 -0
  703. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -1
  704. package/build/dist/Server/Services/IncidentEpisodeRoleMemberService.js +21 -0
  705. package/build/dist/Server/Services/IncidentEpisodeRoleMemberService.js.map +1 -1
  706. package/build/dist/Server/Services/IncidentEpisodeService.js +12 -1
  707. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  708. package/build/dist/Server/Services/IncidentGroupingEngineService.js +8 -0
  709. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  710. package/build/dist/Server/Services/IncidentMemberService.js +14 -0
  711. package/build/dist/Server/Services/IncidentMemberService.js.map +1 -1
  712. package/build/dist/Server/Services/IncidentPublicNoteService.js +48 -0
  713. package/build/dist/Server/Services/IncidentPublicNoteService.js.map +1 -1
  714. package/build/dist/Server/Services/IncidentService.js +99 -21
  715. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  716. package/build/dist/Server/Services/IncidentStateTimelineService.js +12 -0
  717. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  718. package/build/dist/Server/Services/IncidentTemplateService.js +68 -4
  719. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  720. package/build/dist/Server/Services/KubernetesClusterAiAccessService.js +1470 -0
  721. package/build/dist/Server/Services/KubernetesClusterAiAccessService.js.map +1 -0
  722. package/build/dist/Server/Services/KubernetesClusterService.js +1097 -0
  723. package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
  724. package/build/dist/Server/Services/LogAggregationService.js +14 -6
  725. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  726. package/build/dist/Server/Services/MonitorService.js +487 -48
  727. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  728. package/build/dist/Server/Services/MonitorStatusTimelineService.js +540 -3
  729. package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
  730. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +2 -0
  731. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
  732. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +2 -0
  733. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
  734. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +2 -0
  735. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  736. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +3 -0
  737. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  738. package/build/dist/Server/Services/OnCallNotificationAlertingService.js +29 -7
  739. package/build/dist/Server/Services/OnCallNotificationAlertingService.js.map +1 -1
  740. package/build/dist/Server/Services/OnCallSetupReminderService.js +1 -0
  741. package/build/dist/Server/Services/OnCallSetupReminderService.js.map +1 -1
  742. package/build/dist/Server/Services/ProbeService.js +7 -1
  743. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  744. package/build/dist/Server/Services/ProjectService.js +11 -1
  745. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  746. package/build/dist/Server/Services/RunbookCredentialService.js +24 -0
  747. package/build/dist/Server/Services/RunbookCredentialService.js.map +1 -1
  748. package/build/dist/Server/Services/RunbookSecretService.js +44 -0
  749. package/build/dist/Server/Services/RunbookSecretService.js.map +1 -1
  750. package/build/dist/Server/Services/RunnerJobService.js +641 -21
  751. package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
  752. package/build/dist/Server/Services/RunnerService.js +344 -5
  753. package/build/dist/Server/Services/RunnerService.js.map +1 -1
  754. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js +48 -0
  755. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js.map +1 -1
  756. package/build/dist/Server/Services/ScheduledMaintenanceService.js +102 -20
  757. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  758. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +67 -4
  759. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -1
  760. package/build/dist/Server/Services/ServiceLevelObjectiveService.js +12 -1
  761. package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -1
  762. package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -0
  763. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  764. package/build/dist/Server/Services/StatusPageService.js +230 -32
  765. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  766. package/build/dist/Server/Services/StatusPageSubscriberService.js +4 -0
  767. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  768. package/build/dist/Server/Services/TeamMemberService.js +270 -11
  769. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  770. package/build/dist/Server/Services/TraceAggregationService.js +10 -6
  771. package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
  772. package/build/dist/Server/Services/UserEmailService.js +1 -0
  773. package/build/dist/Server/Services/UserEmailService.js.map +1 -1
  774. package/build/dist/Server/Services/UserNotificationMethodAdminService.js +1 -0
  775. package/build/dist/Server/Services/UserNotificationMethodAdminService.js.map +1 -1
  776. package/build/dist/Server/Services/UserNotificationRuleAdminService.js +1 -0
  777. package/build/dist/Server/Services/UserNotificationRuleAdminService.js.map +1 -1
  778. package/build/dist/Server/Services/UserNotificationRuleService.js +4 -0
  779. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  780. package/build/dist/Server/Services/UserService.js +107 -1
  781. package/build/dist/Server/Services/UserService.js.map +1 -1
  782. package/build/dist/Server/Services/WorkflowVariableService.js +396 -7
  783. package/build/dist/Server/Services/WorkflowVariableService.js.map +1 -1
  784. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +463 -7
  785. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  786. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +144 -2
  787. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  788. package/build/dist/Server/Types/Database/QueryHelper.js +20 -0
  789. package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
  790. package/build/dist/Server/Types/Markdown.js +394 -27
  791. package/build/dist/Server/Types/Markdown.js.map +1 -1
  792. package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js +123 -0
  793. package/build/dist/Server/Utils/AI/ClusterAccess/ClusterAccessContext.js.map +1 -0
  794. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +344 -0
  795. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -0
  796. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +587 -0
  797. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -0
  798. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentAuth.js +18 -2
  799. package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentAuth.js.map +1 -1
  800. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1380 -239
  801. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
  802. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +1099 -68
  803. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
  804. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +88 -6
  805. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
  806. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +45 -11
  807. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
  808. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +41 -11
  809. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
  810. package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js +11 -4
  811. package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js.map +1 -1
  812. package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js +4 -2
  813. package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js.map +1 -1
  814. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +997 -141
  815. package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
  816. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +299 -4
  817. package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
  818. package/build/dist/Server/Utils/Database/AffectedResourceRelations.js +120 -0
  819. package/build/dist/Server/Utils/Database/AffectedResourceRelations.js.map +1 -0
  820. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +160 -1
  821. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
  822. package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +1 -0
  823. package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -1
  824. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +59 -12
  825. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  826. package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +5 -1
  827. package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
  828. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +84 -22
  829. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  830. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js +70 -5
  831. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js.map +1 -1
  832. package/build/dist/Server/Utils/Monitor/ProbeMonitorsNotification.js +249 -0
  833. package/build/dist/Server/Utils/Monitor/ProbeMonitorsNotification.js.map +1 -0
  834. package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js +1 -0
  835. package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js.map +1 -1
  836. package/build/dist/Server/Utils/PushNotificationUtil.js +27 -0
  837. package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
  838. package/build/dist/Server/Utils/Rules/OwnerRuleAssignment.js +26 -3
  839. package/build/dist/Server/Utils/Rules/OwnerRuleAssignment.js.map +1 -1
  840. package/build/dist/Server/Utils/Runbook/RunbookExecutePermission.js +38 -3
  841. package/build/dist/Server/Utils/Runbook/RunbookExecutePermission.js.map +1 -1
  842. package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js +143 -23
  843. package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js.map +1 -1
  844. package/build/dist/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.js +406 -0
  845. package/build/dist/Server/Utils/SessionReplay/SessionReplayUserFlowReadService.js.map +1 -0
  846. package/build/dist/Server/Utils/StartServer.js +4 -3
  847. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  848. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +382 -0
  849. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -0
  850. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js +1 -0
  851. package/build/dist/Server/Utils/TwoFactorBackupCodeNotification.js.map +1 -1
  852. package/build/dist/Server/Utils/UserPermission/UserPermission.js +10 -0
  853. package/build/dist/Server/Utils/UserPermission/UserPermission.js.map +1 -1
  854. package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js +447 -0
  855. package/build/dist/Server/Utils/Workflow/OAuth2TokenClient.js.map +1 -0
  856. package/build/dist/Server/Utils/Workflow/WorkflowVariableOAuthToken.js +202 -0
  857. package/build/dist/Server/Utils/Workflow/WorkflowVariableOAuthToken.js.map +1 -0
  858. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +39 -1
  859. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  860. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +44 -4
  861. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  862. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +150 -191
  863. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  864. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +44 -4
  865. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  866. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +39 -17
  867. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
  868. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +151 -145
  869. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
  870. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +221 -127
  871. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  872. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.js +91 -0
  873. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsServiceUrl.js.map +1 -0
  874. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.js +673 -0
  875. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/ReactionNoteSync.js.map +1 -0
  876. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +3 -9
  877. package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
  878. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +65 -166
  879. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  880. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +63 -157
  881. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
  882. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +23 -3
  883. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
  884. package/build/dist/Server/Utils/Workspace/Slack/Actions/Authorization.js +92 -0
  885. package/build/dist/Server/Utils/Workspace/Slack/Actions/Authorization.js.map +1 -0
  886. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +81 -210
  887. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  888. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +68 -138
  889. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
  890. package/build/dist/Server/Utils/Workspace/Slack/Actions/ReactionNote.js +240 -0
  891. package/build/dist/Server/Utils/Workspace/Slack/Actions/ReactionNote.js.map +1 -0
  892. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +85 -212
  893. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  894. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +60 -17
  895. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  896. package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +2 -0
  897. package/build/dist/Server/Utils/Workspace/Workspace.js +134 -41
  898. package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
  899. package/build/dist/Server/Utils/Workspace/WorkspaceActionAuthorization.js +197 -0
  900. package/build/dist/Server/Utils/Workspace/WorkspaceActionAuthorization.js.map +1 -0
  901. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +32 -0
  902. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  903. package/build/dist/Server/Utils/Workspace/WorkspaceOAuthState.js +199 -0
  904. package/build/dist/Server/Utils/Workspace/WorkspaceOAuthState.js.map +1 -0
  905. package/build/dist/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.js +91 -0
  906. package/build/dist/Server/Utils/Workspace/WorkspaceProjectReferenceValidator.js.map +1 -0
  907. package/build/dist/Server/Utils/Workspace/WorkspaceReactionNote.js +450 -0
  908. package/build/dist/Server/Utils/Workspace/WorkspaceReactionNote.js.map +1 -0
  909. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +103 -5
  910. package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
  911. package/build/dist/Types/Date.js +97 -7
  912. package/build/dist/Types/Date.js.map +1 -1
  913. package/build/dist/Types/Email/EmailTemplateType.js +1 -0
  914. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  915. package/build/dist/Types/Exception/ExceptionMessages.js +1 -0
  916. package/build/dist/Types/Exception/ExceptionMessages.js.map +1 -1
  917. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +245 -0
  918. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -0
  919. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js +49 -0
  920. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessPermissions.js.map +1 -0
  921. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessToolNames.js +16 -0
  922. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccessToolNames.js.map +1 -0
  923. package/build/dist/Types/Monitor/DatabaseMonitor/SqlServerPlatform.js +104 -0
  924. package/build/dist/Types/Monitor/DatabaseMonitor/SqlServerPlatform.js.map +1 -0
  925. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +6 -5
  926. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  927. package/build/dist/Types/Monitor/MonitorStepExceptionMonitor.js +32 -0
  928. package/build/dist/Types/Monitor/MonitorStepExceptionMonitor.js.map +1 -1
  929. package/build/dist/Types/Monitor/MonitorUptimeSummary.js +52 -0
  930. package/build/dist/Types/Monitor/MonitorUptimeSummary.js.map +1 -0
  931. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +9 -1
  932. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -1
  933. package/build/dist/Types/Rum/SessionReplay.js +52 -2
  934. package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
  935. package/build/dist/Types/Rum/SessionReplayApi.js +11 -0
  936. package/build/dist/Types/Rum/SessionReplayApi.js.map +1 -1
  937. package/build/dist/Types/Rum/UserFlow.js +115 -0
  938. package/build/dist/Types/Rum/UserFlow.js.map +1 -0
  939. package/build/dist/Types/Runbook/RunbookStepType.js +10 -0
  940. package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
  941. package/build/dist/Types/Runbook/RunnerJobOrigin.js +14 -0
  942. package/build/dist/Types/Runbook/RunnerJobOrigin.js.map +1 -1
  943. package/build/dist/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +2 -2
  944. package/build/dist/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js.map +1 -1
  945. package/build/dist/Types/StatusPage/MergedDowntimeTotals.js +2 -0
  946. package/build/dist/Types/StatusPage/MergedDowntimeTotals.js.map +1 -0
  947. package/build/dist/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +65 -0
  948. package/build/dist/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js.map +1 -0
  949. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +8 -0
  950. package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
  951. package/build/dist/Types/Timezone.js +5 -0
  952. package/build/dist/Types/Timezone.js.map +1 -1
  953. package/build/dist/Types/TimezoneAlias.js +340 -0
  954. package/build/dist/Types/TimezoneAlias.js.map +1 -0
  955. package/build/dist/Types/Workflow/Templates.js +2694 -2
  956. package/build/dist/Types/Workflow/Templates.js.map +1 -1
  957. package/build/dist/Types/Workflow/WorkflowVariableOAuth.js +314 -0
  958. package/build/dist/Types/Workflow/WorkflowVariableOAuth.js.map +1 -0
  959. package/build/dist/Types/Workspace/WorkspaceNoteReaction.js +98 -0
  960. package/build/dist/Types/Workspace/WorkspaceNoteReaction.js.map +1 -0
  961. package/build/dist/UI/Components/AttributesJSON/AttributesJSONPreferences.js +95 -0
  962. package/build/dist/UI/Components/AttributesJSON/AttributesJSONPreferences.js.map +1 -0
  963. package/build/dist/UI/Components/AttributesJSON/AttributesJSONView.js +44 -0
  964. package/build/dist/UI/Components/AttributesJSON/AttributesJSONView.js.map +1 -0
  965. package/build/dist/UI/Components/AttributesJSON/AttributesViewToggle.js +27 -0
  966. package/build/dist/UI/Components/AttributesJSON/AttributesViewToggle.js.map +1 -0
  967. package/build/dist/UI/Components/AttributesJSON/BracesGlyph.js +9 -0
  968. package/build/dist/UI/Components/AttributesJSON/BracesGlyph.js.map +1 -0
  969. package/build/dist/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.js +260 -0
  970. package/build/dist/UI/Components/AttributesJSON/CopyAttributesAsJSONButton.js.map +1 -0
  971. package/build/dist/UI/Components/AttributesJSON/JSONHighlight.js +56 -0
  972. package/build/dist/UI/Components/AttributesJSON/JSONHighlight.js.map +1 -0
  973. package/build/dist/UI/Components/Calendar/Calendar.js +94 -7
  974. package/build/dist/UI/Components/Calendar/Calendar.js.map +1 -1
  975. package/build/dist/UI/Components/Calendar/CalendarDayLayout.js +136 -0
  976. package/build/dist/UI/Components/Calendar/CalendarDayLayout.js.map +1 -0
  977. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +1 -1
  978. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  979. package/build/dist/UI/Components/Charts/Utils/HistogramSelection.js +72 -0
  980. package/build/dist/UI/Components/Charts/Utils/HistogramSelection.js.map +1 -0
  981. package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js +178 -0
  982. package/build/dist/UI/Components/Charts/Utils/useHistogramRangeSelection.js.map +1 -0
  983. package/build/dist/UI/Components/Charts/Utils/useHistogramZoom.js +13 -1
  984. package/build/dist/UI/Components/Charts/Utils/useHistogramZoom.js.map +1 -1
  985. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js +20 -4
  986. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js.map +1 -1
  987. package/build/dist/UI/Components/Dropdown/Dropdown.js +33 -9
  988. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  989. package/build/dist/UI/Components/Forms/Fields/FormField.js +36 -13
  990. package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
  991. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +117 -11
  992. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
  993. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +5 -1
  994. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
  995. package/build/dist/UI/Components/Graphs/UptimeDaySummary.js.map +1 -1
  996. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +36 -8
  997. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  998. package/build/dist/UI/Components/LogsViewer/components/ColumnSelector.js +10 -2
  999. package/build/dist/UI/Components/LogsViewer/components/ColumnSelector.js.map +1 -1
  1000. package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js +9 -1
  1001. package/build/dist/UI/Components/LogsViewer/components/KeyboardShortcutsHelp.js.map +1 -1
  1002. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js +16 -15
  1003. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js.map +1 -1
  1004. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +1 -1
  1005. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  1006. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +14 -74
  1007. package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
  1008. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +22 -5
  1009. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
  1010. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +9 -2
  1011. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
  1012. package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js +16 -5
  1013. package/build/dist/UI/Components/LogsViewer/useLogsHistogram.js.map +1 -1
  1014. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +23 -8
  1015. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  1016. package/build/dist/UI/Components/MonitorGraphs/Uptime.js +7 -1
  1017. package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
  1018. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +5 -1
  1019. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
  1020. package/build/dist/UI/Components/Page/ModelPage.js +37 -3
  1021. package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
  1022. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +27 -6
  1023. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  1024. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.js +7 -1
  1025. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryDetailPanel.js.map +1 -1
  1026. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +1 -1
  1027. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
  1028. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +17 -77
  1029. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
  1030. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +10 -1
  1031. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  1032. package/build/dist/UI/Utils/ModelAPI/ProjectUsersModelAPI.js +15 -1
  1033. package/build/dist/UI/Utils/ModelAPI/ProjectUsersModelAPI.js.map +1 -1
  1034. package/build/dist/UI/Utils/Timezone.js +52 -17
  1035. package/build/dist/UI/Utils/Timezone.js.map +1 -1
  1036. package/build/dist/Utils/AI/InvestigationReport.js +116 -21
  1037. package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
  1038. package/build/dist/Utils/AiRemediation/KubectlOutputRedactor.js +1209 -0
  1039. package/build/dist/Utils/AiRemediation/KubectlOutputRedactor.js.map +1 -0
  1040. package/build/dist/Utils/AiRemediation/KubectlPolicy.js +2973 -0
  1041. package/build/dist/Utils/AiRemediation/KubectlPolicy.js.map +1 -0
  1042. package/build/dist/Utils/AiRemediation/KubectlWaitBudget.js +99 -0
  1043. package/build/dist/Utils/AiRemediation/KubectlWaitBudget.js.map +1 -0
  1044. package/build/dist/Utils/AiRemediation/KubectlWriteScope.js +1429 -0
  1045. package/build/dist/Utils/AiRemediation/KubectlWriteScope.js.map +1 -0
  1046. package/build/dist/Utils/Dashboard/Components/DashboardClockComponent.js +7 -6
  1047. package/build/dist/Utils/Dashboard/Components/DashboardClockComponent.js.map +1 -1
  1048. package/build/dist/Utils/Monitor/IncomingEmailMonitorAddress.js +214 -0
  1049. package/build/dist/Utils/Monitor/IncomingEmailMonitorAddress.js.map +1 -0
  1050. package/build/dist/Utils/Monitor/MonitorCheckScheduleUtil.js +471 -0
  1051. package/build/dist/Utils/Monitor/MonitorCheckScheduleUtil.js.map +1 -0
  1052. package/build/dist/Utils/Monitor/MonitorOverviewCriteriaUtil.js +107 -0
  1053. package/build/dist/Utils/Monitor/MonitorOverviewCriteriaUtil.js.map +1 -0
  1054. package/build/dist/Utils/Monitor/MonitorOverviewFamily.js +191 -0
  1055. package/build/dist/Utils/Monitor/MonitorOverviewFamily.js.map +1 -0
  1056. package/build/dist/Utils/Monitor/MonitorOverviewPresentationUtil.js +1259 -0
  1057. package/build/dist/Utils/Monitor/MonitorOverviewPresentationUtil.js.map +1 -0
  1058. package/build/dist/Utils/Monitor/MonitorOverviewProbeUtil.js +593 -0
  1059. package/build/dist/Utils/Monitor/MonitorOverviewProbeUtil.js.map +1 -0
  1060. package/build/dist/Utils/Monitor/MonitorOverviewTargetUtil.js +195 -0
  1061. package/build/dist/Utils/Monitor/MonitorOverviewTargetUtil.js.map +1 -0
  1062. package/build/dist/Utils/Monitor/MonitorStatusHistoryUtil.js +127 -0
  1063. package/build/dist/Utils/Monitor/MonitorStatusHistoryUtil.js.map +1 -0
  1064. package/build/dist/Utils/Monitor/MonitorUptimeSummaryUtil.js +464 -0
  1065. package/build/dist/Utils/Monitor/MonitorUptimeSummaryUtil.js.map +1 -0
  1066. package/build/dist/Utils/Rum/SessionIdentity.js +31 -1
  1067. package/build/dist/Utils/Rum/SessionIdentity.js.map +1 -1
  1068. package/build/dist/Utils/Rum/SessionReplayWireEncoding.js +128 -0
  1069. package/build/dist/Utils/Rum/SessionReplayWireEncoding.js.map +1 -0
  1070. package/build/dist/Utils/Rum/UserFlow.js +941 -0
  1071. package/build/dist/Utils/Rum/UserFlow.js.map +1 -0
  1072. package/build/dist/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.js +82 -0
  1073. package/build/dist/Utils/StatusPage/MonitorGroupMergedDowntimeUtil.js.map +1 -0
  1074. package/build/dist/Utils/StatusPage/ResourceUptime.js +46 -0
  1075. package/build/dist/Utils/StatusPage/ResourceUptime.js.map +1 -1
  1076. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js +148 -0
  1077. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js.map +1 -1
  1078. package/build/dist/Utils/Telemetry/AttributesJSON.js +245 -0
  1079. package/build/dist/Utils/Telemetry/AttributesJSON.js.map +1 -0
  1080. package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js +103 -0
  1081. package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js.map +1 -1
  1082. package/build/dist/Utils/Uptime/UptimeUtil.js +91 -27
  1083. package/build/dist/Utils/Uptime/UptimeUtil.js.map +1 -1
  1084. package/jest.config.json +2 -1
  1085. package/package.json +2 -1
  1086. package/tsconfig.tests.json +36 -0
  1087. package/Tests/UI/Components/EmptyState/EmptyStateGuideLinks.test.tsx +0 -337
  1088. package/UI/Components/EmptyState/EmptyStateGuideLinks.tsx +0 -124
  1089. package/build/dist/UI/Components/EmptyState/EmptyStateGuideLinks.js +0 -47
  1090. package/build/dist/UI/Components/EmptyState/EmptyStateGuideLinks.js.map +0 -1
@@ -0,0 +1,1958 @@
1
+ import OneUptimeDate from "../../Types/Date";
2
+ import { CheckOn } from "../../Types/Monitor/CriteriaFilter";
3
+ import MonitorMetricType from "../../Types/Monitor/MonitorMetricType";
4
+ import MonitorSteps from "../../Types/Monitor/MonitorSteps";
5
+ import MonitorType from "../../Types/Monitor/MonitorType";
6
+ import { formatDurationCompact } from "../Slo/SloDuration";
7
+ import MonitorCheckScheduleUtil, {
8
+ MonitorCheckFreshness,
9
+ MonitorCheckFreshnessResult,
10
+ } from "./MonitorCheckScheduleUtil";
11
+ import MonitorOverviewCriteriaUtil from "./MonitorOverviewCriteriaUtil";
12
+ import MonitorOverviewFamilyUtil, {
13
+ MonitorOverviewFamily,
14
+ MonitorOverviewLayout,
15
+ MonitorOverviewSetupKind,
16
+ MonitorOverviewSideCard,
17
+ MonitorOverviewTelemetryPreview,
18
+ } from "./MonitorOverviewFamily";
19
+ import { MonitorOverviewProbeSummary } from "./MonitorOverviewProbeUtil";
20
+ import MonitorStatusHistoryUtil from "./MonitorStatusHistoryUtil";
21
+ import MonitorOverviewTargetUtil, {
22
+ MonitorOverviewTarget,
23
+ } from "./MonitorOverviewTargetUtil";
24
+ import { MonitorUptimeCaveat } from "./MonitorUptimeSummaryUtil";
25
+
26
+ /*
27
+ * The monitor overview's hero, facts, pulse and section switches, decided in
28
+ * one pure function so every per-type and per-state rule is unit-tested
29
+ * without React.
30
+ *
31
+ * The rule it is built around: never claim health that was not measured. A
32
+ * paused monitor, one nobody is checking, one with no criteria and one still
33
+ * waiting for its first result are never shown as Good, and never lead with
34
+ * the stored status name (which only describes the last thing that was
35
+ * recorded). Unknown is never rendered as zero.
36
+ */
37
+
38
+ export enum MonitorOverviewRunState {
39
+ Manual = "Manual",
40
+ Paused = "Paused",
41
+ NotChecking = "NotChecking",
42
+ NotConfigured = "NotConfigured",
43
+ AwaitingFirstData = "AwaitingFirstData",
44
+ Overdue = "Overdue",
45
+ Running = "Running",
46
+ }
47
+
48
+ export type MonitorOverviewTone =
49
+ | "good"
50
+ | "warning"
51
+ | "danger"
52
+ | "info"
53
+ | "neutral";
54
+
55
+ export type MonitorOverviewLinkKey =
56
+ | "settings"
57
+ | "probes"
58
+ | "criteria"
59
+ | "documentation"
60
+ | "statusTimeline"
61
+ | "incidents"
62
+ | "alerts"
63
+ | "metrics"
64
+ | "owners"
65
+ | "networkDevice";
66
+
67
+ export type MonitorOverviewFactKey =
68
+ | "latest-result"
69
+ | "certificate-expiry"
70
+ | "domain-expiry"
71
+ | "probes"
72
+ | "missing-window"
73
+ | "heartbeat-check"
74
+ | "host"
75
+ | "cpu"
76
+ | "memory"
77
+ | "evaluates"
78
+ | "criteria"
79
+ | "device"
80
+ | "evaluated"
81
+ | "checks"
82
+ | "owners";
83
+
84
+ export interface MonitorOverviewStatusRef {
85
+ id: string;
86
+ name: string;
87
+ color: string | undefined;
88
+ isOperationalState: boolean;
89
+ isOfflineState: boolean;
90
+ }
91
+
92
+ export interface MonitorOverviewFact {
93
+ key: MonitorOverviewFactKey;
94
+ label: string;
95
+ value: string;
96
+ secondary?: string | undefined;
97
+ // When set, the value is shown as a relative time instead of `value`.
98
+ valueDate?: Date | undefined;
99
+ tone?: MonitorOverviewTone | undefined;
100
+ isMono?: boolean | undefined;
101
+ isMuted?: boolean | undefined;
102
+ linkKey?: MonitorOverviewLinkKey | undefined;
103
+ linkId?: string | undefined;
104
+ }
105
+
106
+ export interface MonitorOverviewPulse {
107
+ // Null when there is nothing to time (Manual).
108
+ label: string | null;
109
+ at?: Date | undefined;
110
+ // Shown instead of the time when there is no `at`.
111
+ emptyText: string;
112
+ cadenceText?: string | undefined;
113
+ nextAt?: Date | undefined;
114
+ overdueSeconds?: number | undefined;
115
+ // True when the source could not be read, so "never" is not claimed.
116
+ isUnavailable: boolean;
117
+ }
118
+
119
+ export interface MonitorOverviewSections {
120
+ showUptime: boolean;
121
+ setup: MonitorOverviewSetupKind | null;
122
+ connection: MonitorOverviewSetupKind | null;
123
+ summary: { isShown: boolean; description: string };
124
+ sideCard: MonitorOverviewSideCard | null;
125
+ responseTimeMetric: MonitorMetricType | null;
126
+ telemetryPreview: MonitorOverviewTelemetryPreview | null;
127
+ stepCount: number;
128
+ }
129
+
130
+ /*
131
+ * Where the evaluation log (the newest MonitorLog rows) stands, as the page
132
+ * loaded it. Only "loaded" means its times can be trusted, including the
133
+ * absence of any.
134
+ */
135
+ export type MonitorOverviewEvaluationStatus =
136
+ | "loading"
137
+ | "loaded"
138
+ | "error"
139
+ | "forbidden";
140
+
141
+ export interface MonitorOverviewPresentationInput {
142
+ /*
143
+ * On the server's clock (the browser's clock plus its measured offset).
144
+ * Every age, due time and expiry here is measured against it, and every
145
+ * time it is compared with was stamped by the server.
146
+ */
147
+ now: Date;
148
+ monitorType: MonitorType;
149
+ monitorSteps?: MonitorSteps | undefined;
150
+ monitoringInterval?: string | undefined;
151
+ createdAt?: Date | undefined;
152
+ currentStatus?: MonitorOverviewStatusRef | undefined;
153
+ statusSince?: Date | undefined;
154
+ pause: {
155
+ isDisabled: boolean;
156
+ byManualIncident: boolean;
157
+ byScheduledMaintenance: boolean;
158
+ };
159
+ probeFlags: { isNoProbeEnabled: boolean; isAllProbesDisconnected: boolean };
160
+ // Null when the probes are unknown (forbidden or failed to load).
161
+ probes: MonitorOverviewProbeSummary | null;
162
+ heartbeat: {
163
+ lastReceivedAt?: Date | undefined;
164
+ lastCheckedAt?: Date | undefined;
165
+ requestMethod?: string | undefined;
166
+ };
167
+ email: {
168
+ lastReceivedAt?: Date | undefined;
169
+ lastCheckedAt?: Date | undefined;
170
+ };
171
+ agent: {
172
+ lastReportAt?: Date | undefined;
173
+ hostname?: string | undefined;
174
+ cpuPercent?: number | undefined;
175
+ memoryPercent?: number | undefined;
176
+ };
177
+ telemetry: {
178
+ /*
179
+ * Monitor.telemetryMonitorLastMonitorAt. The worker stamps it when it
180
+ * queues an evaluation, before (and whether or not) one runs, so it is
181
+ * "last scheduled", never "last evaluated".
182
+ */
183
+ lastScheduledAt?: Date | undefined;
184
+ /*
185
+ * Deprecated: the same scheduler stamp under its old name, read only
186
+ * when lastScheduledAt is not given.
187
+ */
188
+ lastEvaluatedAt?: Date | undefined;
189
+ nextEvaluationAt?: Date | undefined;
190
+ };
191
+ /*
192
+ * The newest MonitorLog time: when an evaluation last completed. It is
193
+ * "Last evaluated" for telemetry, infrastructure and network devices.
194
+ */
195
+ latestEvaluationAt?: Date | undefined;
196
+ /*
197
+ * The evaluation log's section status. Without it, a latestEvaluationAt
198
+ * counts as loaded and its absence as unknown. A loaded log with no time
199
+ * only covers what the log still keeps (see
200
+ * MONITOR_LOG_MINIMUM_RETENTION_SECONDS), so it means "never evaluated"
201
+ * only for a monitor younger than that.
202
+ */
203
+ evaluationStatus?: MonitorOverviewEvaluationStatus | undefined;
204
+ minimumProbeAgreement?: number | undefined;
205
+ }
206
+
207
+ export interface MonitorOverviewBadge {
208
+ text: string;
209
+ tone: MonitorOverviewTone;
210
+ // Set only when the badge names the monitor's status.
211
+ statusColor?: string | undefined;
212
+ }
213
+
214
+ export interface MonitorOverviewSecondaryBadge {
215
+ text: string;
216
+ tone: MonitorOverviewTone;
217
+ }
218
+
219
+ export interface MonitorOverviewPresentation {
220
+ family: MonitorOverviewFamily;
221
+ runState: MonitorOverviewRunState;
222
+ tone: MonitorOverviewTone;
223
+ badge: MonitorOverviewBadge;
224
+ secondaryBadges: Array<MonitorOverviewSecondaryBadge>;
225
+ headline: { text: string; since?: Date | undefined };
226
+ explanation?: string | undefined;
227
+ lastKnownStatus?: string | undefined;
228
+ callToAction?: { text: string; linkKey: MonitorOverviewLinkKey } | undefined;
229
+ pulse: MonitorOverviewPulse;
230
+ freshness: MonitorCheckFreshness;
231
+ /*
232
+ * Overdue with nothing ever received (state 6b): no check result, or no
233
+ * evaluation, since the monitor was created.
234
+ */
235
+ isNeverReported?: boolean | undefined;
236
+ facts: Array<MonitorOverviewFact>;
237
+ target: MonitorOverviewTarget | null;
238
+ sections: MonitorOverviewSections;
239
+ }
240
+
241
+ // The part of the presentation that depends on the run state.
242
+ type MonitorOverviewHeroParts = Pick<
243
+ MonitorOverviewPresentation,
244
+ | "tone"
245
+ | "badge"
246
+ | "secondaryBadges"
247
+ | "headline"
248
+ | "explanation"
249
+ | "lastKnownStatus"
250
+ | "callToAction"
251
+ >;
252
+
253
+ /*
254
+ * What the evaluation log says about a monitor's evaluations: "evaluated"
255
+ * (it has a row); "never" (it is empty, and would still hold any
256
+ * evaluation the monitor has had); "expired" (it is empty, but the monitor
257
+ * is older than the log keeps rows, so it says nothing before the last
258
+ * day); "unread" (loading, failed or forbidden).
259
+ */
260
+ type MonitorOverviewEvaluationLog =
261
+ | "evaluated"
262
+ | "never"
263
+ | "expired"
264
+ | "unread";
265
+
266
+ /*
267
+ * Telemetry and infrastructure: the time the pulse shows and freshness is
268
+ * judged from, and what that time is.
269
+ */
270
+ interface MonitorOverviewTelemetryTiming {
271
+ lastAt: Date | undefined;
272
+ // The scheduler's stamp, which only says an evaluation was queued.
273
+ isScheduledTime: boolean;
274
+ /*
275
+ * Overdue because the log has nothing from the last day, although the
276
+ * schedule should have left a row there. When the last evaluation ran is
277
+ * unknown, but that is not "never".
278
+ */
279
+ isMissingFromLog: boolean;
280
+ freshness: MonitorCheckFreshnessResult;
281
+ }
282
+
283
+ // Everything build() and getRunState() both need, worked out once.
284
+ interface MonitorOverviewContext {
285
+ family: MonitorOverviewFamily;
286
+ layout: MonitorOverviewLayout;
287
+ cadenceSeconds: number;
288
+ intervalText: string;
289
+ // describeInterval with a lower-case first letter: "every 5 minutes".
290
+ intervalPhrase: string;
291
+ stepCount: number;
292
+ networkDeviceId: string | null;
293
+ isPaused: boolean;
294
+ isNoProbeEnabled: boolean;
295
+ isAllProbesDisconnected: boolean;
296
+ isNotChecking: boolean;
297
+ // Null when the input neither says nor implies how the log loaded.
298
+ evaluationStatus: MonitorOverviewEvaluationStatus | null;
299
+ evaluationLog: MonitorOverviewEvaluationLog;
300
+ // Null for the families the telemetry worker does not evaluate.
301
+ telemetry: MonitorOverviewTelemetryTiming | null;
302
+ freshness: MonitorCheckFreshnessResult;
303
+ runState: MonitorOverviewRunState;
304
+ /*
305
+ * A heartbeat or agent monitor that has never reported, but that the
306
+ * server has already judged: its status is not operational, or its
307
+ * missing-signal window since creation has passed. Its history is real.
308
+ */
309
+ hasPushVerdict: boolean;
310
+ }
311
+
312
+ const MAX_FACTS: number = 4;
313
+
314
+ /*
315
+ * ServerMonitor/CheckOnlineStatus judges an agent that has not reported for
316
+ * three minutes, counting from creation when it never has.
317
+ */
318
+ const AGENT_MISSING_MINUTES: number = 3;
319
+
320
+ const PAUSED_EXPLANATION: Record<
321
+ "disabled" | "incident" | "maintenance",
322
+ string
323
+ > = {
324
+ disabled:
325
+ "No checks run while monitoring is off, so the status stays at the last one recorded.",
326
+ incident:
327
+ "Checks resume when the incident that paused this monitor is resolved.",
328
+ maintenance: "Checks resume automatically when the maintenance event ends.",
329
+ };
330
+
331
+ const MANUAL_EXPLANATION: string =
332
+ "Manual monitor: OneUptime runs no checks. The status changes when someone sets it, or when an incident or scheduled maintenance event changes it.";
333
+
334
+ /*
335
+ * What an empty evaluation log says once the monitor is older than the
336
+ * log keeps rows (MONITOR_LOG_MINIMUM_RETENTION_SECONDS): not "never".
337
+ */
338
+ const NOT_EVALUATED_IN_LOG_TEXT: string = "Not evaluated in the last day";
339
+
340
+ const pluralize: (count: number, singular: string, plural: string) => string = (
341
+ count: number,
342
+ singular: string,
343
+ plural: string,
344
+ ): string => {
345
+ return `${count} ${count === 1 ? singular : plural}`;
346
+ };
347
+
348
+ const lowerFirst: (text: string) => string = (text: string): string => {
349
+ return text ? text.charAt(0).toLowerCase() + text.slice(1) : text;
350
+ };
351
+
352
+ const secondsSince: (now: Date, then: Date) => number = (
353
+ now: Date,
354
+ then: Date,
355
+ ): number => {
356
+ return Math.max(0, Math.floor((now.getTime() - then.getTime()) / 1000));
357
+ };
358
+
359
+ const HOUR_MS: number = 3600 * 1000;
360
+ const DAY_MS: number = 24 * HOUR_MS;
361
+ const DAY_SECONDS: number = 24 * 3600;
362
+
363
+ /*
364
+ * The evaluation log (MonitorLog) keeps each row for at least
365
+ * MonitorLogUtil.DEFAULT_RETENTION_DAYS, one day, unless an admin has
366
+ * raised GlobalConfig.monitorLogRetentionInDays. So an empty log proves
367
+ * only that nothing was evaluated in the last day and, for a monitor
368
+ * younger than that, that nothing ever was. The copy that says "in the
369
+ * last day" follows this.
370
+ */
371
+ export const MONITOR_LOG_MINIMUM_RETENTION_SECONDS: number = DAY_SECONDS;
372
+
373
+ /*
374
+ * A row can also outlive that by up to about a day: the TTL ("retentionDate
375
+ * DELETE", ttl_only_drop_parts) drops a whole daily partition
376
+ * (toYYYYMMDD(time)) only once its newest row has expired too. So a run
377
+ * between two days and one day ago may or may not still be in the log, and
378
+ * its absence proves nothing. An empty log is therefore judged from one day
379
+ * ago, the guaranteed retention: a schedule that was due after that point
380
+ * would still have its row, so Stale from there really means a missed run.
381
+ * Judging from the two-day maximum instead flagged gapped schedules
382
+ * (weekday business hours) as overdue every weekend.
383
+ */
384
+
385
+ // "3 hours", or "20 minutes" under an hour. Never "0 minutes".
386
+ const describeUnderADay: (ms: number) => string = (ms: number): string => {
387
+ const hours: number = Math.floor(ms / HOUR_MS);
388
+
389
+ if (hours >= 1) {
390
+ return pluralize(hours, "hour", "hours");
391
+ }
392
+
393
+ return pluralize(Math.max(1, Math.floor(ms / 60000)), "minute", "minutes");
394
+ };
395
+
396
+ /*
397
+ * Calendar days from `earlier` to `later` in the zone dates are printed in.
398
+ * Only called for times at least a day apart, so it is at least 1 (a
399
+ * 25-hour daylight-saving day could otherwise make it 0).
400
+ */
401
+ const getCalendarDaysBetween: (earlier: Date, later: Date) => number = (
402
+ earlier: Date,
403
+ later: Date,
404
+ ): number => {
405
+ const timezone: string = OneUptimeDate.getCurrentTimezone();
406
+ const days: number = Math.round(
407
+ (OneUptimeDate.getStartOfDay(later, timezone).getTime() -
408
+ OneUptimeDate.getStartOfDay(earlier, timezone).getTime()) /
409
+ DAY_MS,
410
+ );
411
+
412
+ return Math.max(1, days);
413
+ };
414
+
415
+ const isFutureOf: (date: Date | undefined, now: Date) => boolean = (
416
+ date: Date | undefined,
417
+ now: Date,
418
+ ): boolean => {
419
+ return Boolean(date && date.getTime() > now.getTime());
420
+ };
421
+
422
+ export default class MonitorOverviewPresentationUtil {
423
+ public static build(
424
+ input: MonitorOverviewPresentationInput,
425
+ ): MonitorOverviewPresentation {
426
+ const context: MonitorOverviewContext =
427
+ MonitorOverviewPresentationUtil.getContext(input);
428
+
429
+ const hero: MonitorOverviewHeroParts =
430
+ MonitorOverviewPresentationUtil.getHero(input, context);
431
+
432
+ return {
433
+ family: context.family,
434
+ runState: context.runState,
435
+ ...hero,
436
+ pulse: MonitorOverviewPresentationUtil.getPulse(input, context),
437
+ freshness: context.freshness.freshness,
438
+ isNeverReported: MonitorOverviewPresentationUtil.isNeverReported(context),
439
+ facts: MonitorOverviewPresentationUtil.getFacts(input, context),
440
+ target: MonitorOverviewTargetUtil.getTarget({
441
+ monitorType: input.monitorType,
442
+ monitorSteps: input.monitorSteps,
443
+ serverHostname: input.agent.hostname,
444
+ }),
445
+ sections: MonitorOverviewPresentationUtil.getSections(context),
446
+ };
447
+ }
448
+
449
+ /*
450
+ * First match wins: Manual, Paused, NotChecking (probe checks only),
451
+ * NotConfigured, AwaitingFirstData, Overdue, Running.
452
+ */
453
+ public static getRunState(
454
+ input: MonitorOverviewPresentationInput,
455
+ ): MonitorOverviewRunState {
456
+ return MonitorOverviewPresentationUtil.getContext(input).runState;
457
+ }
458
+
459
+ /*
460
+ * What the uptime tiles must add about time the status timeline counts
461
+ * but nothing measured: its open row keeps the last status while
462
+ * monitoring is paused, while nothing checks, and before the first check
463
+ * completes. A manual monitor has no checks to pause, so it never gets
464
+ * one.
465
+ */
466
+ public static getUptimeCaveat(
467
+ presentation: Pick<
468
+ MonitorOverviewPresentation,
469
+ "family" | "runState" | "isNeverReported"
470
+ >,
471
+ ): MonitorUptimeCaveat | null {
472
+ if (presentation.family === MonitorOverviewFamily.Manual) {
473
+ return null;
474
+ }
475
+
476
+ switch (presentation.runState) {
477
+ case MonitorOverviewRunState.Paused:
478
+ return "paused";
479
+ case MonitorOverviewRunState.NotChecking:
480
+ case MonitorOverviewRunState.NotConfigured:
481
+ return "not-checking";
482
+ case MonitorOverviewRunState.Overdue:
483
+ return presentation.isNeverReported ? "no-results" : null;
484
+ default:
485
+ return null;
486
+ }
487
+ }
488
+
489
+ public static getStatusTone(
490
+ status: MonitorOverviewStatusRef | undefined,
491
+ ): MonitorOverviewTone {
492
+ if (!status) {
493
+ return "neutral";
494
+ }
495
+
496
+ // Offline first: a status flagged both ways must never read as good.
497
+ if (status.isOfflineState) {
498
+ return "danger";
499
+ }
500
+
501
+ if (status.isOperationalState) {
502
+ return "good";
503
+ }
504
+
505
+ return "warning";
506
+ }
507
+
508
+ public static getExpiryFact(data: {
509
+ key: "certificate-expiry" | "domain-expiry";
510
+ expiresAt: Date | undefined;
511
+ isValidCertificate?: boolean | undefined;
512
+ now: Date;
513
+ }): MonitorOverviewFact {
514
+ const label: string =
515
+ data.key === "certificate-expiry"
516
+ ? "Certificate expires"
517
+ : "Domain expires";
518
+
519
+ const secondary: string | undefined = data.expiresAt
520
+ ? OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
521
+ data.expiresAt,
522
+ true,
523
+ )
524
+ : undefined;
525
+
526
+ if (data.isValidCertificate === false) {
527
+ return {
528
+ key: data.key,
529
+ label: label,
530
+ value: "Not valid",
531
+ secondary: secondary,
532
+ tone: "danger",
533
+ };
534
+ }
535
+
536
+ if (!data.expiresAt) {
537
+ return { key: data.key, label: label, value: "—", isMuted: true };
538
+ }
539
+
540
+ const msLeft: number = data.expiresAt.getTime() - data.now.getTime();
541
+
542
+ /*
543
+ * Within a day either way, hours say it exactly. Beyond that, days are
544
+ * counted on the calendar of the zone the date below is printed in, so
545
+ * "in 2 days" and the printed date agree: 36 hours from noon is two
546
+ * calendar days away, not the one day a floor would give.
547
+ */
548
+ if (msLeft < 0) {
549
+ return {
550
+ key: data.key,
551
+ label: label,
552
+ value:
553
+ -msLeft < DAY_MS
554
+ ? `Expired ${describeUnderADay(-msLeft)} ago`
555
+ : `Expired ${pluralize(
556
+ getCalendarDaysBetween(data.expiresAt, data.now),
557
+ "day",
558
+ "days",
559
+ )} ago`,
560
+ secondary: secondary,
561
+ tone: "danger",
562
+ };
563
+ }
564
+
565
+ if (msLeft < DAY_MS) {
566
+ return {
567
+ key: data.key,
568
+ label: label,
569
+ value: `Expires in ${describeUnderADay(msLeft)}`,
570
+ secondary: secondary,
571
+ tone: "danger",
572
+ };
573
+ }
574
+
575
+ // The tone keeps counting whole days left, as it always has.
576
+ const wholeDays: number = Math.floor(msLeft / DAY_MS);
577
+ let tone: MonitorOverviewTone = "neutral";
578
+
579
+ if (wholeDays <= 7) {
580
+ tone = "danger";
581
+ } else if (wholeDays <= 30) {
582
+ tone = "warning";
583
+ }
584
+
585
+ return {
586
+ key: data.key,
587
+ label: label,
588
+ value: `in ${pluralize(
589
+ getCalendarDaysBetween(data.now, data.expiresAt),
590
+ "day",
591
+ "days",
592
+ )}`,
593
+ secondary: secondary,
594
+ tone: tone,
595
+ };
596
+ }
597
+
598
+ private static getContext(
599
+ input: MonitorOverviewPresentationInput,
600
+ ): MonitorOverviewContext {
601
+ const layout: MonitorOverviewLayout = MonitorOverviewFamilyUtil.getLayout(
602
+ input.monitorType,
603
+ );
604
+ const family: MonitorOverviewFamily = layout.family;
605
+ const cadenceSeconds: number =
606
+ MonitorCheckScheduleUtil.resolveCadenceSeconds({
607
+ monitoringInterval: input.monitoringInterval,
608
+ from: input.now,
609
+ });
610
+ const intervalText: string = MonitorCheckScheduleUtil.describeInterval(
611
+ input.monitoringInterval,
612
+ );
613
+ const stepCount: number = MonitorOverviewCriteriaUtil.getStepCount(
614
+ input.monitorSteps,
615
+ );
616
+ const networkDeviceId: string | null =
617
+ MonitorOverviewCriteriaUtil.getNetworkDeviceId(input.monitorSteps);
618
+
619
+ const isPaused: boolean =
620
+ input.pause.isDisabled ||
621
+ input.pause.byManualIncident ||
622
+ input.pause.byScheduledMaintenance;
623
+
624
+ const isProbeCheck: boolean = family === MonitorOverviewFamily.ProbeCheck;
625
+
626
+ /*
627
+ * The server keeps these flags on the Monitor row; the probe rows, when
628
+ * they could be read, say the same thing sooner.
629
+ */
630
+ const isNoProbeEnabled: boolean =
631
+ isProbeCheck &&
632
+ (input.probeFlags.isNoProbeEnabled ||
633
+ (input.probes !== null && input.probes.enabledCount === 0));
634
+ const isAllProbesDisconnected: boolean =
635
+ isProbeCheck &&
636
+ (input.probeFlags.isAllProbesDisconnected ||
637
+ (input.probes !== null &&
638
+ input.probes.enabledCount > 0 &&
639
+ input.probes.disconnectedCount === input.probes.enabledCount));
640
+ const isNotChecking: boolean = isNoProbeEnabled || isAllProbesDisconnected;
641
+
642
+ const evaluationStatus: MonitorOverviewEvaluationStatus | null =
643
+ MonitorOverviewPresentationUtil.getEvaluationStatus(input);
644
+ const evaluationLog: MonitorOverviewEvaluationLog =
645
+ MonitorOverviewPresentationUtil.readEvaluationLog({
646
+ input: input,
647
+ family: family,
648
+ evaluationStatus: evaluationStatus,
649
+ });
650
+ const isScheduled: boolean = !isPaused && !isNotChecking;
651
+ const telemetry: MonitorOverviewTelemetryTiming | null =
652
+ MonitorOverviewPresentationUtil.isTelemetryFamily(family)
653
+ ? MonitorOverviewPresentationUtil.getTelemetryTiming({
654
+ input: input,
655
+ evaluationLog: evaluationLog,
656
+ cadenceSeconds: cadenceSeconds,
657
+ isScheduled: isScheduled,
658
+ })
659
+ : null;
660
+
661
+ const freshness: MonitorCheckFreshnessResult = telemetry
662
+ ? telemetry.freshness
663
+ : MonitorOverviewPresentationUtil.getFreshness({
664
+ input: input,
665
+ family: family,
666
+ cadenceSeconds: cadenceSeconds,
667
+ isScheduled: isScheduled,
668
+ });
669
+
670
+ let runState: MonitorOverviewRunState = MonitorOverviewRunState.Running;
671
+
672
+ if (family === MonitorOverviewFamily.Manual) {
673
+ runState = MonitorOverviewRunState.Manual;
674
+ } else if (isPaused) {
675
+ runState = MonitorOverviewRunState.Paused;
676
+ } else if (isNotChecking) {
677
+ runState = MonitorOverviewRunState.NotChecking;
678
+ } else if (
679
+ stepCount === 0 ||
680
+ (family === MonitorOverviewFamily.NetworkDevice && !networkDeviceId)
681
+ ) {
682
+ runState = MonitorOverviewRunState.NotConfigured;
683
+ } else if (
684
+ MonitorOverviewPresentationUtil.isAwaitingFirstData({
685
+ input: input,
686
+ family: family,
687
+ freshness: freshness.freshness,
688
+ evaluationLog: evaluationLog,
689
+ telemetry: telemetry,
690
+ })
691
+ ) {
692
+ runState = MonitorOverviewRunState.AwaitingFirstData;
693
+ } else if (freshness.freshness === MonitorCheckFreshness.Stale) {
694
+ runState = MonitorOverviewRunState.Overdue;
695
+ }
696
+
697
+ return {
698
+ family: family,
699
+ layout: layout,
700
+ cadenceSeconds: cadenceSeconds,
701
+ intervalText: intervalText,
702
+ intervalPhrase: lowerFirst(intervalText),
703
+ stepCount: stepCount,
704
+ networkDeviceId: networkDeviceId,
705
+ isPaused: isPaused,
706
+ isNoProbeEnabled: isNoProbeEnabled,
707
+ isAllProbesDisconnected: isAllProbesDisconnected,
708
+ isNotChecking: isNotChecking,
709
+ evaluationStatus: evaluationStatus,
710
+ evaluationLog: evaluationLog,
711
+ telemetry: telemetry,
712
+ freshness: freshness,
713
+ runState: runState,
714
+ hasPushVerdict:
715
+ runState === MonitorOverviewRunState.AwaitingFirstData &&
716
+ MonitorOverviewPresentationUtil.hasPushVerdict({
717
+ input: input,
718
+ family: family,
719
+ }),
720
+ };
721
+ }
722
+
723
+ /*
724
+ * Without an explicit status (callers from before evaluationStatus), a
725
+ * time means the log was read; its absence says nothing.
726
+ */
727
+ private static getEvaluationStatus(
728
+ input: MonitorOverviewPresentationInput,
729
+ ): MonitorOverviewEvaluationStatus | null {
730
+ if (input.evaluationStatus) {
731
+ return input.evaluationStatus;
732
+ }
733
+
734
+ return input.latestEvaluationAt ? "loaded" : null;
735
+ }
736
+
737
+ private static isTelemetryFamily(family: MonitorOverviewFamily): boolean {
738
+ return (
739
+ family === MonitorOverviewFamily.TelemetrySignal ||
740
+ family === MonitorOverviewFamily.Infrastructure
741
+ );
742
+ }
743
+
744
+ /*
745
+ * An empty log means "never evaluated" only while it would still hold
746
+ * every evaluation the monitor could have had. Past that, its rows may
747
+ * simply have expired.
748
+ */
749
+ private static readEvaluationLog(data: {
750
+ input: MonitorOverviewPresentationInput;
751
+ family: MonitorOverviewFamily;
752
+ evaluationStatus: MonitorOverviewEvaluationStatus | null;
753
+ }): MonitorOverviewEvaluationLog {
754
+ const input: MonitorOverviewPresentationInput = data.input;
755
+
756
+ if (data.evaluationStatus !== "loaded") {
757
+ return "unread";
758
+ }
759
+
760
+ if (input.latestEvaluationAt) {
761
+ return "evaluated";
762
+ }
763
+
764
+ const isYoungerThanLog: boolean =
765
+ !input.createdAt ||
766
+ input.now.getTime() - input.createdAt.getTime() <
767
+ MONITOR_LOG_MINIMUM_RETENTION_SECONDS * 1000;
768
+ /*
769
+ * The telemetry worker stamps a monitor each time it queues an
770
+ * evaluation, so one it has never stamped has never been evaluated,
771
+ * however old it is.
772
+ */
773
+ const isNeverQueued: boolean =
774
+ MonitorOverviewPresentationUtil.isTelemetryFamily(data.family) &&
775
+ !input.telemetry.lastScheduledAt &&
776
+ !input.telemetry.lastEvaluatedAt;
777
+
778
+ return isYoungerThanLog || isNeverQueued ? "never" : "expired";
779
+ }
780
+
781
+ /*
782
+ * With a row in the evaluation log, its time. Without the log, the
783
+ * scheduler's stamp, named for what it is. With a log that is empty only
784
+ * because its rows expired, the log still says nothing was evaluated in
785
+ * the last day: that is overdue when the schedule should have left a row
786
+ * there, and otherwise (a weekly schedule, say) expected, so the stamp is
787
+ * all there is, as without the log.
788
+ */
789
+ private static getTelemetryTiming(data: {
790
+ input: MonitorOverviewPresentationInput;
791
+ evaluationLog: MonitorOverviewEvaluationLog;
792
+ cadenceSeconds: number;
793
+ isScheduled: boolean;
794
+ }): MonitorOverviewTelemetryTiming {
795
+ const input: MonitorOverviewPresentationInput = data.input;
796
+ const scheduledAt: Date | undefined =
797
+ input.telemetry.lastScheduledAt || input.telemetry.lastEvaluatedAt;
798
+
799
+ const judge: (
800
+ lastResultAt: Date | undefined,
801
+ createdAt: Date | undefined,
802
+ ) => MonitorCheckFreshnessResult = (
803
+ lastResultAt: Date | undefined,
804
+ createdAt: Date | undefined,
805
+ ): MonitorCheckFreshnessResult => {
806
+ return MonitorCheckScheduleUtil.getCheckFreshness({
807
+ isScheduled: data.isScheduled,
808
+ isKnown: true,
809
+ lastResultAt: lastResultAt,
810
+ nextCheckAt: input.telemetry.nextEvaluationAt,
811
+ cadenceSeconds: data.cadenceSeconds,
812
+ createdAt: createdAt,
813
+ now: input.now,
814
+ monitoringInterval: input.monitoringInterval,
815
+ });
816
+ };
817
+
818
+ const fromScheduler: () => MonitorOverviewTelemetryTiming =
819
+ (): MonitorOverviewTelemetryTiming => {
820
+ return {
821
+ lastAt: scheduledAt,
822
+ isScheduledTime: true,
823
+ isMissingFromLog: false,
824
+ freshness: judge(scheduledAt, input.createdAt),
825
+ };
826
+ };
827
+
828
+ switch (data.evaluationLog) {
829
+ case "evaluated":
830
+ return {
831
+ lastAt: input.latestEvaluationAt,
832
+ isScheduledTime: false,
833
+ isMissingFromLog: false,
834
+ freshness: judge(input.latestEvaluationAt, input.createdAt),
835
+ };
836
+
837
+ case "never":
838
+ return {
839
+ lastAt: undefined,
840
+ isScheduledTime: false,
841
+ isMissingFromLog: false,
842
+ freshness: judge(undefined, input.createdAt),
843
+ };
844
+
845
+ case "expired": {
846
+ // The log only reads as expired for a monitor with a creation time.
847
+ const createdAt: Date = input.createdAt || input.now;
848
+ const horizonStart: Date = new Date(
849
+ Math.max(
850
+ createdAt.getTime(),
851
+ input.now.getTime() - MONITOR_LOG_MINIMUM_RETENTION_SECONDS * 1000,
852
+ ),
853
+ );
854
+
855
+ if (
856
+ judge(undefined, horizonStart).freshness !==
857
+ MonitorCheckFreshness.Stale
858
+ ) {
859
+ return fromScheduler();
860
+ }
861
+
862
+ /*
863
+ * How long ago the last evaluation ran, and so how late the next
864
+ * one is, is unknown: the log only says it was before the last day.
865
+ */
866
+ return {
867
+ lastAt: undefined,
868
+ isScheduledTime: false,
869
+ isMissingFromLog: true,
870
+ freshness: {
871
+ freshness: MonitorCheckFreshness.Stale,
872
+ overdueSeconds: null,
873
+ resultAgeSeconds: null,
874
+ },
875
+ };
876
+ }
877
+
878
+ default:
879
+ return fromScheduler();
880
+ }
881
+ }
882
+
883
+ /*
884
+ * A push monitor's missing-signal check counts from creation when nothing
885
+ * has arrived yet, so the server judges it once this window has passed.
886
+ * Null when its criteria have no such check.
887
+ */
888
+ private static getPushMissingMinutes(data: {
889
+ input: MonitorOverviewPresentationInput;
890
+ family: MonitorOverviewFamily;
891
+ }): number | null {
892
+ const monitorSteps: MonitorSteps | undefined = data.input.monitorSteps;
893
+
894
+ if (data.family === MonitorOverviewFamily.Agent) {
895
+ return MonitorOverviewCriteriaUtil.hasFilterOn({
896
+ monitorSteps: monitorSteps,
897
+ checkOn: CheckOn.IsOnline,
898
+ })
899
+ ? AGENT_MISSING_MINUTES
900
+ : null;
901
+ }
902
+
903
+ if (data.family !== MonitorOverviewFamily.Heartbeat) {
904
+ return null;
905
+ }
906
+
907
+ return MonitorOverviewCriteriaUtil.getMissingSignalMinutes({
908
+ monitorSteps: monitorSteps,
909
+ checkOn:
910
+ data.input.monitorType === MonitorType.IncomingEmail
911
+ ? CheckOn.EmailReceivedAt
912
+ : CheckOn.IncomingRequest,
913
+ });
914
+ }
915
+
916
+ private static hasPushVerdict(data: {
917
+ input: MonitorOverviewPresentationInput;
918
+ family: MonitorOverviewFamily;
919
+ }): boolean {
920
+ if (
921
+ data.family !== MonitorOverviewFamily.Heartbeat &&
922
+ data.family !== MonitorOverviewFamily.Agent
923
+ ) {
924
+ return false;
925
+ }
926
+
927
+ if (MonitorOverviewPresentationUtil.isJudgedStatus(data.input)) {
928
+ return true;
929
+ }
930
+
931
+ const minutes: number | null =
932
+ MonitorOverviewPresentationUtil.getPushMissingMinutes(data);
933
+ const createdAt: Date | undefined = data.input.createdAt;
934
+
935
+ return (
936
+ minutes !== null &&
937
+ createdAt !== undefined &&
938
+ data.input.now.getTime() - createdAt.getTime() > minutes * 60 * 1000
939
+ );
940
+ }
941
+
942
+ /*
943
+ * A status that is not operational was set by something: for a push
944
+ * monitor that never reported, the server's missing-signal check.
945
+ */
946
+ private static isJudgedStatus(
947
+ input: MonitorOverviewPresentationInput,
948
+ ): boolean {
949
+ const tone: MonitorOverviewTone =
950
+ MonitorOverviewPresentationUtil.getStatusTone(input.currentStatus);
951
+
952
+ return tone === "danger" || tone === "warning";
953
+ }
954
+
955
+ /*
956
+ * Freshness is only judged for the families that run on a schedule we can
957
+ * see: probe checks here, and the worker-evaluated telemetry and
958
+ * infrastructure monitors in getTelemetryTiming. Push-based monitors
959
+ * decide "missing" in their own criteria.
960
+ */
961
+ private static getFreshness(data: {
962
+ input: MonitorOverviewPresentationInput;
963
+ family: MonitorOverviewFamily;
964
+ cadenceSeconds: number;
965
+ isScheduled: boolean;
966
+ }): MonitorCheckFreshnessResult {
967
+ const input: MonitorOverviewPresentationInput = data.input;
968
+
969
+ if (data.family === MonitorOverviewFamily.ProbeCheck) {
970
+ return MonitorCheckScheduleUtil.getCheckFreshness({
971
+ isScheduled: data.isScheduled,
972
+ isKnown: input.probes !== null,
973
+ lastResultAt: input.probes?.lastResultAt,
974
+ /*
975
+ * Behind schedule only when every probe that is checking is: a
976
+ * summary from before latestNextCheckAt existed has only the
977
+ * earliest.
978
+ */
979
+ nextCheckAt:
980
+ input.probes?.latestNextCheckAt || input.probes?.nextCheckAt,
981
+ cadenceSeconds: data.cadenceSeconds,
982
+ createdAt: input.createdAt,
983
+ now: input.now,
984
+ monitoringInterval: input.monitoringInterval,
985
+ });
986
+ }
987
+
988
+ return MonitorCheckScheduleUtil.getCheckFreshness({
989
+ isScheduled: false,
990
+ isKnown: true,
991
+ lastResultAt: undefined,
992
+ nextCheckAt: undefined,
993
+ cadenceSeconds: data.cadenceSeconds,
994
+ createdAt: input.createdAt,
995
+ now: input.now,
996
+ });
997
+ }
998
+
999
+ private static isAwaitingFirstData(data: {
1000
+ input: MonitorOverviewPresentationInput;
1001
+ family: MonitorOverviewFamily;
1002
+ freshness: MonitorCheckFreshness;
1003
+ evaluationLog: MonitorOverviewEvaluationLog;
1004
+ telemetry: MonitorOverviewTelemetryTiming | null;
1005
+ }): boolean {
1006
+ const input: MonitorOverviewPresentationInput = data.input;
1007
+
1008
+ switch (data.family) {
1009
+ case MonitorOverviewFamily.ProbeCheck:
1010
+ return (
1011
+ input.probes !== null &&
1012
+ input.probes.enabledCount > 0 &&
1013
+ data.freshness === MonitorCheckFreshness.AwaitingFirstResult
1014
+ );
1015
+ case MonitorOverviewFamily.Heartbeat:
1016
+ return input.monitorType === MonitorType.IncomingEmail
1017
+ ? !input.email.lastReceivedAt
1018
+ : !input.heartbeat.lastReceivedAt;
1019
+ case MonitorOverviewFamily.Agent:
1020
+ return !input.agent.lastReportAt;
1021
+ case MonitorOverviewFamily.TelemetrySignal:
1022
+ case MonitorOverviewFamily.Infrastructure:
1023
+ /*
1024
+ * Without the evaluation log, the scheduler's stamp is all there
1025
+ * is. With it, "waiting" needs a log that says nothing was ever
1026
+ * evaluated, and, like a probe check, lasts only while the monitor
1027
+ * is young: past that, no evaluation is overdue (6b).
1028
+ */
1029
+ if (data.evaluationLog === "unread") {
1030
+ return !data.telemetry?.lastAt;
1031
+ }
1032
+
1033
+ return (
1034
+ data.evaluationLog === "never" &&
1035
+ data.freshness === MonitorCheckFreshness.AwaitingFirstResult
1036
+ );
1037
+ case MonitorOverviewFamily.NetworkDevice:
1038
+ /*
1039
+ * A device is evaluated on its polls and traps, which leave no
1040
+ * trace on the monitor row: only an empty log that would still hold
1041
+ * every evaluation says none has happened yet. For an older
1042
+ * monitor, it says only that none happened in the last day.
1043
+ */
1044
+ return data.evaluationLog === "never";
1045
+ default:
1046
+ // Manual monitors are never evaluated.
1047
+ return false;
1048
+ }
1049
+ }
1050
+
1051
+ private static getHero(
1052
+ input: MonitorOverviewPresentationInput,
1053
+ context: MonitorOverviewContext,
1054
+ ): MonitorOverviewHeroParts {
1055
+ const status: MonitorOverviewStatusRef | undefined = input.currentStatus;
1056
+ const statusTone: MonitorOverviewTone =
1057
+ MonitorOverviewPresentationUtil.getStatusTone(status);
1058
+ const lastKnownStatus: string | undefined = status
1059
+ ? `Last recorded status: ${status.name}`
1060
+ : undefined;
1061
+
1062
+ // The badge and headline for the states that lead with the status.
1063
+ const statusBadge: MonitorOverviewBadge = status
1064
+ ? {
1065
+ text: status.name,
1066
+ tone: statusTone,
1067
+ statusColor: MonitorStatusHistoryUtil.normalizeColor(status.color),
1068
+ }
1069
+ : { text: "Unknown status", tone: "neutral" };
1070
+ const statusHeadline: { text: string; since?: Date | undefined } = status
1071
+ ? { text: status.name, since: input.statusSince }
1072
+ : { text: "No status recorded yet" };
1073
+
1074
+ switch (context.runState) {
1075
+ case MonitorOverviewRunState.Manual:
1076
+ return {
1077
+ tone: statusTone,
1078
+ badge: statusBadge,
1079
+ secondaryBadges: [{ text: "Manual", tone: "neutral" }],
1080
+ headline: statusHeadline,
1081
+ explanation: MANUAL_EXPLANATION,
1082
+ callToAction: { text: "Change status", linkKey: "statusTimeline" },
1083
+ };
1084
+
1085
+ case MonitorOverviewRunState.Paused: {
1086
+ const secondaryBadges: Array<MonitorOverviewSecondaryBadge> = [];
1087
+
1088
+ /*
1089
+ * Pausing does not fix a probe problem, and the problem is still
1090
+ * there when monitoring resumes, so it stays visible.
1091
+ */
1092
+ if (context.isNoProbeEnabled) {
1093
+ secondaryBadges.push({ text: "Probes Not Enabled", tone: "danger" });
1094
+ } else if (context.isAllProbesDisconnected) {
1095
+ secondaryBadges.push({
1096
+ text: "Probes Disconnected",
1097
+ tone: "danger",
1098
+ });
1099
+ }
1100
+
1101
+ if (input.pause.isDisabled) {
1102
+ return {
1103
+ tone: "neutral",
1104
+ badge: { text: "Disabled", tone: "neutral" },
1105
+ secondaryBadges: secondaryBadges,
1106
+ headline: { text: "Monitoring is turned off" },
1107
+ explanation: PAUSED_EXPLANATION.disabled,
1108
+ lastKnownStatus: lastKnownStatus,
1109
+ callToAction: { text: "Open settings", linkKey: "settings" },
1110
+ };
1111
+ }
1112
+
1113
+ if (input.pause.byManualIncident) {
1114
+ return {
1115
+ tone: "neutral",
1116
+ badge: { text: "Paused", tone: "neutral" },
1117
+ secondaryBadges: secondaryBadges,
1118
+ headline: { text: "Monitoring is paused by an incident" },
1119
+ explanation: PAUSED_EXPLANATION.incident,
1120
+ lastKnownStatus: lastKnownStatus,
1121
+ callToAction: { text: "View incidents", linkKey: "incidents" },
1122
+ };
1123
+ }
1124
+
1125
+ return {
1126
+ tone: "neutral",
1127
+ badge: { text: "Paused", tone: "neutral" },
1128
+ secondaryBadges: secondaryBadges,
1129
+ headline: { text: "Monitoring is paused for scheduled maintenance" },
1130
+ explanation: PAUSED_EXPLANATION.maintenance,
1131
+ lastKnownStatus: lastKnownStatus,
1132
+ };
1133
+ }
1134
+
1135
+ case MonitorOverviewRunState.NotChecking:
1136
+ return MonitorOverviewPresentationUtil.getNotCheckingHero({
1137
+ input: input,
1138
+ context: context,
1139
+ lastKnownStatus: lastKnownStatus,
1140
+ });
1141
+
1142
+ case MonitorOverviewRunState.NotConfigured: {
1143
+ const isMissingDevice: boolean =
1144
+ context.family === MonitorOverviewFamily.NetworkDevice &&
1145
+ context.stepCount > 0;
1146
+
1147
+ return {
1148
+ tone: "neutral",
1149
+ badge: { text: "Not set up", tone: "neutral" },
1150
+ secondaryBadges: [],
1151
+ headline: {
1152
+ text: isMissingDevice
1153
+ ? "No network device is selected"
1154
+ : "This monitor has no criteria yet",
1155
+ },
1156
+ explanation: isMissingDevice
1157
+ ? "Choose the device this monitor alerts on."
1158
+ : "Add criteria to tell this monitor what to check.",
1159
+ callToAction: {
1160
+ text: isMissingDevice ? "Choose a device" : "Set up criteria",
1161
+ linkKey: "criteria",
1162
+ },
1163
+ };
1164
+ }
1165
+
1166
+ case MonitorOverviewRunState.AwaitingFirstData:
1167
+ return MonitorOverviewPresentationUtil.getAwaitingHero({
1168
+ input: input,
1169
+ context: context,
1170
+ lastKnownStatus: lastKnownStatus,
1171
+ });
1172
+
1173
+ case MonitorOverviewRunState.Overdue: {
1174
+ const isProbeCheck: boolean =
1175
+ context.family === MonitorOverviewFamily.ProbeCheck;
1176
+ /*
1177
+ * Nothing has ever been measured (6b), so the stored status is only
1178
+ * the default the monitor was created with: it is not the headline,
1179
+ * and it has not "held" for any length of time.
1180
+ */
1181
+ const isNeverReported: boolean =
1182
+ MonitorOverviewPresentationUtil.isNeverReported(context);
1183
+
1184
+ return {
1185
+ // A late check cannot vouch for "good"; danger stays danger.
1186
+ tone: statusTone === "danger" ? "danger" : "warning",
1187
+ badge: isNeverReported
1188
+ ? { text: "No results yet", tone: "warning" }
1189
+ : statusBadge,
1190
+ secondaryBadges: [{ text: "Checks overdue", tone: "warning" }],
1191
+ headline: isNeverReported
1192
+ ? {
1193
+ text: isProbeCheck
1194
+ ? "No check has completed yet"
1195
+ : "No evaluation has completed yet",
1196
+ }
1197
+ : statusHeadline,
1198
+ explanation: MonitorOverviewPresentationUtil.getOverdueExplanation({
1199
+ input: input,
1200
+ context: context,
1201
+ }),
1202
+ lastKnownStatus: isNeverReported ? lastKnownStatus : undefined,
1203
+ callToAction: isProbeCheck
1204
+ ? { text: "Check probes", linkKey: "probes" }
1205
+ : undefined,
1206
+ };
1207
+ }
1208
+
1209
+ default: {
1210
+ const running: MonitorOverviewHeroParts = {
1211
+ tone: statusTone,
1212
+ badge: statusBadge,
1213
+ secondaryBadges: [],
1214
+ headline: statusHeadline,
1215
+ };
1216
+
1217
+ /*
1218
+ * A device's polling interval is not known here, so a quiet log is
1219
+ * not called overdue, but the status is not presented as fresh
1220
+ * either.
1221
+ */
1222
+ if (
1223
+ context.family === MonitorOverviewFamily.NetworkDevice &&
1224
+ context.evaluationLog === "expired"
1225
+ ) {
1226
+ running.explanation =
1227
+ "No poll or trap from this device has been evaluated in the last day, so the status shown is the last one recorded.";
1228
+ }
1229
+
1230
+ return running;
1231
+ }
1232
+ }
1233
+ }
1234
+
1235
+ private static getNotCheckingHero(data: {
1236
+ input: MonitorOverviewPresentationInput;
1237
+ context: MonitorOverviewContext;
1238
+ lastKnownStatus: string | undefined;
1239
+ }): MonitorOverviewHeroParts {
1240
+ const probes: MonitorOverviewProbeSummary | null = data.input.probes;
1241
+
1242
+ if (!data.context.isNoProbeEnabled) {
1243
+ return {
1244
+ tone: "danger",
1245
+ badge: { text: "Probes Disconnected", tone: "danger" },
1246
+ secondaryBadges: [],
1247
+ headline: { text: "Every probe checking this monitor is disconnected" },
1248
+ explanation:
1249
+ "Checks stopped when the probes lost their connection. The status shown is the last one recorded.",
1250
+ lastKnownStatus: data.lastKnownStatus,
1251
+ callToAction: { text: "Check probes", linkKey: "probes" },
1252
+ };
1253
+ }
1254
+
1255
+ const badge: MonitorOverviewBadge = {
1256
+ text: "Probes Not Enabled",
1257
+ tone: "danger",
1258
+ };
1259
+
1260
+ // Unknown probes must never be described as "no probes attached".
1261
+ if (probes === null) {
1262
+ return {
1263
+ tone: "danger",
1264
+ badge: badge,
1265
+ secondaryBadges: [],
1266
+ headline: { text: "Nothing is checking this monitor" },
1267
+ explanation: "No probe is enabled for this monitor, so no checks run.",
1268
+ lastKnownStatus: data.lastKnownStatus,
1269
+ callToAction: { text: "Manage probes", linkKey: "probes" },
1270
+ };
1271
+ }
1272
+
1273
+ if (probes.attachedCount === 0) {
1274
+ return {
1275
+ tone: "danger",
1276
+ badge: badge,
1277
+ secondaryBadges: [],
1278
+ headline: { text: "No probes are attached to this monitor" },
1279
+ explanation: "Add a probe to start checking this resource.",
1280
+ lastKnownStatus: data.lastKnownStatus,
1281
+ callToAction: { text: "Add a probe", linkKey: "probes" },
1282
+ };
1283
+ }
1284
+
1285
+ return {
1286
+ tone: "danger",
1287
+ badge: badge,
1288
+ secondaryBadges: [],
1289
+ headline: { text: "Every probe is turned off for this monitor" },
1290
+ explanation: `${
1291
+ probes.attachedCount === 1
1292
+ ? "1 probe is"
1293
+ : `${probes.attachedCount} probes are`
1294
+ } attached but switched off, so nothing is checking this resource.`,
1295
+ lastKnownStatus: data.lastKnownStatus,
1296
+ callToAction: { text: "Manage probes", linkKey: "probes" },
1297
+ };
1298
+ }
1299
+
1300
+ private static getAwaitingHero(data: {
1301
+ input: MonitorOverviewPresentationInput;
1302
+ context: MonitorOverviewContext;
1303
+ lastKnownStatus: string | undefined;
1304
+ }): MonitorOverviewHeroParts {
1305
+ const input: MonitorOverviewPresentationInput = data.input;
1306
+ const context: MonitorOverviewContext = data.context;
1307
+
1308
+ let headline: string = "Waiting for the first evaluation";
1309
+ let explanation: string = `This monitor is evaluated ${context.intervalPhrase} once saved.`;
1310
+ let hasSetup: boolean = false;
1311
+ // What has never arrived, for a push monitor the server has judged.
1312
+ let missingSince: string | null = null;
1313
+
1314
+ if (context.family === MonitorOverviewFamily.ProbeCheck) {
1315
+ const enabledCount: number = input.probes?.enabledCount || 0;
1316
+
1317
+ headline = "Waiting for the first check";
1318
+ explanation = `${
1319
+ enabledCount === 1 ? "1 probe checks" : `${enabledCount} probes check`
1320
+ } this ${context.intervalPhrase}. The first result usually arrives within a few minutes.`;
1321
+ } else if (context.family === MonitorOverviewFamily.NetworkDevice) {
1322
+ headline = "Waiting for the first poll";
1323
+ explanation =
1324
+ "No poll or trap from this device has been evaluated yet. Check that a probe is assigned to poll it.";
1325
+ } else if (input.monitorType === MonitorType.IncomingRequest) {
1326
+ headline = "Waiting for the first heartbeat";
1327
+ explanation =
1328
+ "Send a GET or POST request to this monitor's heartbeat URL to start tracking it.";
1329
+ hasSetup = true;
1330
+ missingSince = "No heartbeat has arrived";
1331
+ } else if (input.monitorType === MonitorType.IncomingEmail) {
1332
+ headline = "Waiting for the first email";
1333
+ explanation =
1334
+ "Send an email to this monitor's address to start tracking it.";
1335
+ hasSetup = true;
1336
+ missingSince = "No email has arrived";
1337
+ } else if (context.family === MonitorOverviewFamily.Agent) {
1338
+ headline = "Waiting for the agent to report";
1339
+ explanation = "Install the server agent to start sending reports.";
1340
+ hasSetup = true;
1341
+ missingSince = "The agent has not reported";
1342
+ }
1343
+
1344
+ const callToAction: MonitorOverviewHeroParts["callToAction"] = hasSetup
1345
+ ? { text: "Setup instructions", linkKey: "documentation" }
1346
+ : undefined;
1347
+ const status: MonitorOverviewStatusRef | undefined = input.currentStatus;
1348
+
1349
+ /*
1350
+ * The server judges a push monitor that never reported as if its last
1351
+ * signal arrived at creation, so it can be Offline, with an incident
1352
+ * open, while the page is still "waiting". Lead with that verdict's
1353
+ * tone and keep the setup steps: sending the first signal is still the
1354
+ * fix.
1355
+ */
1356
+ if (
1357
+ missingSince !== null &&
1358
+ status &&
1359
+ MonitorOverviewPresentationUtil.isJudgedStatus(input)
1360
+ ) {
1361
+ const statusTone: MonitorOverviewTone =
1362
+ MonitorOverviewPresentationUtil.getStatusTone(status);
1363
+
1364
+ return {
1365
+ tone: statusTone,
1366
+ badge: { text: "Waiting for data", tone: "info" },
1367
+ secondaryBadges: [{ text: status.name, tone: statusTone }],
1368
+ headline: {
1369
+ text: input.createdAt
1370
+ ? `${missingSince} since this monitor was created ${formatDurationCompact(
1371
+ secondsSince(input.now, input.createdAt),
1372
+ )} ago`
1373
+ : headline,
1374
+ },
1375
+ explanation: explanation,
1376
+ callToAction: callToAction,
1377
+ };
1378
+ }
1379
+
1380
+ return {
1381
+ tone: "info",
1382
+ badge: { text: "Waiting for data", tone: "info" },
1383
+ secondaryBadges: [],
1384
+ headline: { text: headline },
1385
+ explanation: explanation,
1386
+ lastKnownStatus: data.lastKnownStatus,
1387
+ callToAction: callToAction,
1388
+ };
1389
+ }
1390
+
1391
+ private static isNeverReported(context: MonitorOverviewContext): boolean {
1392
+ return (
1393
+ context.runState === MonitorOverviewRunState.Overdue &&
1394
+ context.freshness.resultAgeSeconds === null &&
1395
+ !context.telemetry?.isMissingFromLog
1396
+ );
1397
+ }
1398
+
1399
+ /*
1400
+ * "No result for 12m" states how long it has been since the last result -
1401
+ * the same age the pulse's "Last checked" shows - so the two never
1402
+ * disagree. The pulse's "Overdue by" line carries how late that is.
1403
+ */
1404
+ private static getOverdueExplanation(data: {
1405
+ input: MonitorOverviewPresentationInput;
1406
+ context: MonitorOverviewContext;
1407
+ }): string {
1408
+ const input: MonitorOverviewPresentationInput = data.input;
1409
+ const context: MonitorOverviewContext = data.context;
1410
+ const isProbeCheck: boolean =
1411
+ context.family === MonitorOverviewFamily.ProbeCheck;
1412
+ const resultAgeSeconds: number | null = context.freshness.resultAgeSeconds;
1413
+
1414
+ if (context.telemetry?.isMissingFromLog) {
1415
+ return `No evaluation recorded in the last day, but this monitor is evaluated ${context.intervalPhrase}.`;
1416
+ }
1417
+
1418
+ if (resultAgeSeconds === null) {
1419
+ const createdAgo: string = input.createdAt
1420
+ ? formatDurationCompact(secondsSince(input.now, input.createdAt))
1421
+ : formatDurationCompact(context.freshness.overdueSeconds || 0);
1422
+
1423
+ return isProbeCheck
1424
+ ? `No check result has arrived since this monitor was created ${createdAgo} ago.`
1425
+ : `No evaluation has run since this monitor was created ${createdAgo} ago.`;
1426
+ }
1427
+
1428
+ const age: string = formatDurationCompact(resultAgeSeconds);
1429
+
1430
+ return isProbeCheck
1431
+ ? `No result for ${age}, but this monitor checks ${context.intervalPhrase}. A probe may be overloaded or offline.`
1432
+ : `No evaluation for ${age}, but this monitor is evaluated ${context.intervalPhrase}.`;
1433
+ }
1434
+
1435
+ private static getPulse(
1436
+ input: MonitorOverviewPresentationInput,
1437
+ context: MonitorOverviewContext,
1438
+ ): MonitorOverviewPulse {
1439
+ const isScheduled: boolean =
1440
+ context.runState !== MonitorOverviewRunState.Paused &&
1441
+ context.runState !== MonitorOverviewRunState.NotChecking &&
1442
+ context.runState !== MonitorOverviewRunState.NotConfigured;
1443
+ const overdueSeconds: number | undefined =
1444
+ context.runState === MonitorOverviewRunState.Overdue &&
1445
+ context.freshness.overdueSeconds !== null
1446
+ ? context.freshness.overdueSeconds
1447
+ : undefined;
1448
+
1449
+ switch (context.family) {
1450
+ case MonitorOverviewFamily.ProbeCheck: {
1451
+ const nextAt: Date | undefined = input.probes?.nextCheckAt;
1452
+
1453
+ return {
1454
+ label: "Last checked",
1455
+ at: input.probes?.lastResultAt,
1456
+ emptyText: "Not checked yet",
1457
+ // A paused or unchecked monitor has no cadence to promise.
1458
+ cadenceText: isScheduled ? context.intervalText : undefined,
1459
+ nextAt:
1460
+ isScheduled && isFutureOf(nextAt, input.now) ? nextAt : undefined,
1461
+ overdueSeconds: overdueSeconds,
1462
+ isUnavailable: input.probes === null,
1463
+ };
1464
+ }
1465
+
1466
+ case MonitorOverviewFamily.Heartbeat: {
1467
+ const isEmail: boolean =
1468
+ input.monitorType === MonitorType.IncomingEmail;
1469
+
1470
+ /*
1471
+ * No cadence line: the missing-request check time is already the
1472
+ * "Last missing-request check" fact, and a push-based monitor has no
1473
+ * schedule of its own to promise.
1474
+ */
1475
+ return {
1476
+ label: isEmail ? "Last email" : "Last request",
1477
+ at: isEmail
1478
+ ? input.email.lastReceivedAt
1479
+ : input.heartbeat.lastReceivedAt,
1480
+ emptyText: isEmail ? "No email yet" : "No request yet",
1481
+ isUnavailable: false,
1482
+ };
1483
+ }
1484
+
1485
+ case MonitorOverviewFamily.Agent:
1486
+ return {
1487
+ label: "Last report",
1488
+ at: input.agent.lastReportAt,
1489
+ emptyText: "No report yet",
1490
+ isUnavailable: false,
1491
+ };
1492
+
1493
+ case MonitorOverviewFamily.TelemetrySignal:
1494
+ case MonitorOverviewFamily.Infrastructure: {
1495
+ const nextAt: Date | undefined = input.telemetry.nextEvaluationAt;
1496
+ /*
1497
+ * Without a time from the evaluation log, the only time is the
1498
+ * worker's stamp, which it writes when it queues an evaluation: it
1499
+ * is named for what it is.
1500
+ */
1501
+ const isScheduledTime: boolean = Boolean(
1502
+ context.telemetry?.isScheduledTime,
1503
+ );
1504
+ let emptyText: string = "Not evaluated yet";
1505
+
1506
+ if (isScheduledTime) {
1507
+ emptyText = "Not scheduled yet";
1508
+ } else if (context.evaluationLog === "expired") {
1509
+ emptyText = NOT_EVALUATED_IN_LOG_TEXT;
1510
+ }
1511
+
1512
+ return {
1513
+ label: isScheduledTime ? "Last scheduled" : "Last evaluated",
1514
+ at: context.telemetry?.lastAt,
1515
+ emptyText: emptyText,
1516
+ cadenceText: isScheduled ? context.intervalText : undefined,
1517
+ nextAt:
1518
+ isScheduled && isFutureOf(nextAt, input.now) ? nextAt : undefined,
1519
+ overdueSeconds: overdueSeconds,
1520
+ isUnavailable: false,
1521
+ };
1522
+ }
1523
+
1524
+ case MonitorOverviewFamily.NetworkDevice: {
1525
+ let emptyText: string = "Not evaluated yet";
1526
+
1527
+ if (context.evaluationStatus === "loading") {
1528
+ emptyText = "Loading…";
1529
+ } else if (context.evaluationLog === "expired") {
1530
+ emptyText = NOT_EVALUATED_IN_LOG_TEXT;
1531
+ }
1532
+
1533
+ // The time only comes from the evaluation log, so it follows its read.
1534
+ return {
1535
+ label: "Last evaluated",
1536
+ at:
1537
+ context.evaluationStatus === "loaded"
1538
+ ? input.latestEvaluationAt
1539
+ : undefined,
1540
+ emptyText: emptyText,
1541
+ isUnavailable:
1542
+ context.evaluationStatus === "error" ||
1543
+ context.evaluationStatus === "forbidden",
1544
+ };
1545
+ }
1546
+
1547
+ default:
1548
+ return {
1549
+ label: null,
1550
+ emptyText: "No automated checks",
1551
+ isUnavailable: false,
1552
+ };
1553
+ }
1554
+ }
1555
+
1556
+ private static getFacts(
1557
+ input: MonitorOverviewPresentationInput,
1558
+ context: MonitorOverviewContext,
1559
+ ): Array<MonitorOverviewFact> {
1560
+ const facts: Array<MonitorOverviewFact> = [];
1561
+
1562
+ switch (context.family) {
1563
+ case MonitorOverviewFamily.ProbeCheck:
1564
+ facts.push(MonitorOverviewPresentationUtil.getLatestResultFact(input));
1565
+
1566
+ if (input.monitorType === MonitorType.SSLCertificate) {
1567
+ facts.push(
1568
+ input.probes === null
1569
+ ? {
1570
+ key: "certificate-expiry",
1571
+ label: "Certificate expires",
1572
+ value: "Unavailable",
1573
+ isMuted: true,
1574
+ }
1575
+ : MonitorOverviewPresentationUtil.getExpiryFact({
1576
+ key: "certificate-expiry",
1577
+ expiresAt: input.probes.latestResult?.sslExpiresAt,
1578
+ isValidCertificate:
1579
+ input.probes.latestResult?.isValidCertificate,
1580
+ now: input.now,
1581
+ }),
1582
+ );
1583
+ }
1584
+
1585
+ if (input.monitorType === MonitorType.Domain) {
1586
+ facts.push(
1587
+ input.probes === null
1588
+ ? {
1589
+ key: "domain-expiry",
1590
+ label: "Domain expires",
1591
+ value: "Unavailable",
1592
+ isMuted: true,
1593
+ }
1594
+ : MonitorOverviewPresentationUtil.getExpiryFact({
1595
+ key: "domain-expiry",
1596
+ expiresAt: input.probes.latestResult?.domainExpiresAt,
1597
+ now: input.now,
1598
+ }),
1599
+ );
1600
+ }
1601
+
1602
+ facts.push(
1603
+ MonitorOverviewPresentationUtil.getProbesFact(input, context),
1604
+ );
1605
+ break;
1606
+
1607
+ case MonitorOverviewFamily.Heartbeat: {
1608
+ const isEmail: boolean =
1609
+ input.monitorType === MonitorType.IncomingEmail;
1610
+ const minutes: number | null =
1611
+ MonitorOverviewCriteriaUtil.getMissingSignalMinutes({
1612
+ monitorSteps: input.monitorSteps,
1613
+ checkOn: isEmail
1614
+ ? CheckOn.EmailReceivedAt
1615
+ : CheckOn.IncomingRequest,
1616
+ });
1617
+ const lastCheckedAt: Date | undefined = isEmail
1618
+ ? input.email.lastCheckedAt
1619
+ : input.heartbeat.lastCheckedAt;
1620
+
1621
+ facts.push(
1622
+ minutes === null
1623
+ ? {
1624
+ key: "missing-window",
1625
+ label: isEmail
1626
+ ? "Missing-email window"
1627
+ : "Missing-request window",
1628
+ value: "Set in Criteria",
1629
+ linkKey: "criteria",
1630
+ }
1631
+ : {
1632
+ key: "missing-window",
1633
+ label: isEmail
1634
+ ? "Missing-email window"
1635
+ : "Missing-request window",
1636
+ value: pluralize(minutes, "minute", "minutes"),
1637
+ secondary: "From this monitor's criteria",
1638
+ },
1639
+ );
1640
+
1641
+ facts.push(
1642
+ lastCheckedAt
1643
+ ? {
1644
+ key: "heartbeat-check",
1645
+ label: isEmail
1646
+ ? "Last missing-email check"
1647
+ : "Last missing-request check",
1648
+ value: "",
1649
+ valueDate: lastCheckedAt,
1650
+ }
1651
+ : {
1652
+ key: "heartbeat-check",
1653
+ label: isEmail
1654
+ ? "Last missing-email check"
1655
+ : "Last missing-request check",
1656
+ value: "Not run yet",
1657
+ isMuted: true,
1658
+ },
1659
+ );
1660
+ break;
1661
+ }
1662
+
1663
+ case MonitorOverviewFamily.Agent: {
1664
+ const hostname: string = (input.agent.hostname || "").trim();
1665
+
1666
+ facts.push(
1667
+ hostname
1668
+ ? { key: "host", label: "Host", value: hostname, isMono: true }
1669
+ : {
1670
+ key: "host",
1671
+ label: "Host",
1672
+ value: "Not reported yet",
1673
+ isMuted: true,
1674
+ },
1675
+ );
1676
+ facts.push(
1677
+ MonitorOverviewPresentationUtil.getPercentFact({
1678
+ key: "cpu",
1679
+ label: "CPU",
1680
+ percent: input.agent.cpuPercent,
1681
+ }),
1682
+ );
1683
+ facts.push(
1684
+ MonitorOverviewPresentationUtil.getPercentFact({
1685
+ key: "memory",
1686
+ label: "Memory",
1687
+ percent: input.agent.memoryPercent,
1688
+ }),
1689
+ );
1690
+ break;
1691
+ }
1692
+
1693
+ case MonitorOverviewFamily.TelemetrySignal:
1694
+ case MonitorOverviewFamily.Infrastructure:
1695
+ facts.push({
1696
+ key: "evaluates",
1697
+ label: "Evaluates",
1698
+ value: context.intervalText,
1699
+ });
1700
+ facts.push({
1701
+ key: "criteria",
1702
+ label: "Criteria",
1703
+ value: pluralize(context.stepCount, "step", "steps"),
1704
+ linkKey: "criteria",
1705
+ });
1706
+ break;
1707
+
1708
+ case MonitorOverviewFamily.NetworkDevice:
1709
+ facts.push(
1710
+ context.networkDeviceId
1711
+ ? {
1712
+ key: "device",
1713
+ label: "Device",
1714
+ value: "View device",
1715
+ linkKey: "networkDevice",
1716
+ linkId: context.networkDeviceId,
1717
+ }
1718
+ : {
1719
+ key: "device",
1720
+ label: "Device",
1721
+ value: "Not selected",
1722
+ isMuted: true,
1723
+ },
1724
+ );
1725
+ facts.push({
1726
+ key: "evaluated",
1727
+ label: "Evaluated",
1728
+ value: "On every poll and matching trap",
1729
+ });
1730
+ break;
1731
+
1732
+ default:
1733
+ facts.push({
1734
+ key: "checks",
1735
+ label: "Checks",
1736
+ value: "None",
1737
+ secondary: "Status is set by hand or by incidents",
1738
+ });
1739
+ break;
1740
+ }
1741
+
1742
+ /*
1743
+ * Owners always close the band; the component renders them from the
1744
+ * owners section, so the value here is empty.
1745
+ */
1746
+ return [
1747
+ ...facts.slice(0, MAX_FACTS - 1),
1748
+ { key: "owners", label: "Owners", value: "" },
1749
+ ];
1750
+ }
1751
+
1752
+ private static getLatestResultFact(
1753
+ input: MonitorOverviewPresentationInput,
1754
+ ): MonitorOverviewFact {
1755
+ const base: { key: MonitorOverviewFactKey; label: string } = {
1756
+ key: "latest-result",
1757
+ label: "Latest result",
1758
+ };
1759
+
1760
+ if (input.probes === null) {
1761
+ return { ...base, value: "Unavailable", isMuted: true };
1762
+ }
1763
+
1764
+ const result: MonitorOverviewProbeSummary["latestResult"] =
1765
+ input.probes.latestResult;
1766
+
1767
+ if (!result) {
1768
+ return {
1769
+ ...base,
1770
+ value: "—",
1771
+ secondary: "No results yet",
1772
+ isMuted: true,
1773
+ };
1774
+ }
1775
+
1776
+ const isScripted: boolean =
1777
+ input.monitorType === MonitorType.SyntheticMonitor ||
1778
+ input.monitorType === MonitorType.CustomJavaScriptCode;
1779
+ const upCount: number = input.probes.upCount || 0;
1780
+ const downCount: number = input.probes.downCount || 0;
1781
+
1782
+ /*
1783
+ * When the probes disagree, the newest single result is just whichever
1784
+ * probe reported last, and would flip between Up and Down from one poll
1785
+ * to the next. Say they disagree instead.
1786
+ */
1787
+ if (upCount > 0 && downCount > 0) {
1788
+ return {
1789
+ ...base,
1790
+ value: isScripted
1791
+ ? `Mixed · ${upCount} passed, ${downCount} failed`
1792
+ : `Mixed · ${upCount} up, ${downCount} down`,
1793
+ tone: "warning",
1794
+ };
1795
+ }
1796
+
1797
+ let value: string = "Reported";
1798
+ let tone: MonitorOverviewTone = "neutral";
1799
+
1800
+ if (result.isOnline === true) {
1801
+ value = isScripted ? "Passed" : "Up";
1802
+ tone = "good";
1803
+ } else if (result.isOnline === false) {
1804
+ value = isScripted ? "Failed" : "Down";
1805
+ tone = "danger";
1806
+ }
1807
+
1808
+ if (result.responseTimeInMs !== undefined) {
1809
+ value += ` · ${Math.round(result.responseTimeInMs)} ms`;
1810
+ }
1811
+
1812
+ if (
1813
+ result.responseCode !== undefined &&
1814
+ (input.monitorType === MonitorType.API ||
1815
+ input.monitorType === MonitorType.Website)
1816
+ ) {
1817
+ value += ` · HTTP ${result.responseCode}`;
1818
+ }
1819
+
1820
+ return {
1821
+ ...base,
1822
+ value: value,
1823
+ secondary:
1824
+ result.isOnline === false && result.failureCause
1825
+ ? result.failureCause
1826
+ : `from ${result.probeName}`,
1827
+ tone: tone,
1828
+ };
1829
+ }
1830
+
1831
+ private static getProbesFact(
1832
+ input: MonitorOverviewPresentationInput,
1833
+ context: MonitorOverviewContext,
1834
+ ): MonitorOverviewFact {
1835
+ const base: {
1836
+ key: MonitorOverviewFactKey;
1837
+ label: string;
1838
+ linkKey: MonitorOverviewLinkKey;
1839
+ } = { key: "probes", label: "Probes", linkKey: "probes" };
1840
+
1841
+ if (input.probes === null) {
1842
+ return { ...base, value: "Unavailable", isMuted: true };
1843
+ }
1844
+
1845
+ const probes: MonitorOverviewProbeSummary = input.probes;
1846
+ const downCount: number = probes.downCount || 0;
1847
+ const connectionParts: Array<string> = [];
1848
+
1849
+ if (probes.disabledCount > 0) {
1850
+ connectionParts.push(`${probes.disabledCount} disabled`);
1851
+ }
1852
+
1853
+ if (probes.disconnectedCount > 0) {
1854
+ connectionParts.push(`${probes.disconnectedCount} disconnected`);
1855
+ }
1856
+
1857
+ const joinParts: (parts: Array<string>) => string | undefined = (
1858
+ parts: Array<string>,
1859
+ ): string | undefined => {
1860
+ return parts.length > 0 ? parts.join(" · ") : undefined;
1861
+ };
1862
+
1863
+ if (probes.enabledCount === 0) {
1864
+ return {
1865
+ ...base,
1866
+ value: "None enabled",
1867
+ secondary: joinParts(connectionParts),
1868
+ tone: "danger",
1869
+ };
1870
+ }
1871
+
1872
+ /*
1873
+ * No probe is meant to report while monitoring is paused, so a
1874
+ * reporting ratio would read as a probe fault that does not exist.
1875
+ */
1876
+ if (context.isPaused) {
1877
+ return {
1878
+ ...base,
1879
+ value: `${probes.enabledCount} enabled`,
1880
+ secondary: joinParts(["Checks paused", ...connectionParts]),
1881
+ tone: "neutral",
1882
+ };
1883
+ }
1884
+
1885
+ let tone: MonitorOverviewTone = "neutral";
1886
+
1887
+ if (probes.reportingCount === 0 || downCount >= probes.reportingCount) {
1888
+ // Nothing reporting, or every probe that reports sees it down.
1889
+ tone = "danger";
1890
+ } else if (downCount > 0 || probes.reportingCount < probes.enabledCount) {
1891
+ tone = "warning";
1892
+ }
1893
+
1894
+ const isScripted: boolean =
1895
+ input.monitorType === MonitorType.SyntheticMonitor ||
1896
+ input.monitorType === MonitorType.CustomJavaScriptCode;
1897
+ // A probe that reports Down is reporting, but it is not fine.
1898
+ const downPart: string = `${downCount} ${isScripted ? "failing" : "down"}`;
1899
+
1900
+ return {
1901
+ ...base,
1902
+ value: `${probes.reportingCount} of ${probes.enabledCount} reporting`,
1903
+ secondary: joinParts(
1904
+ downCount > 0 ? [downPart, ...connectionParts] : connectionParts,
1905
+ ),
1906
+ tone: tone,
1907
+ };
1908
+ }
1909
+
1910
+ private static getPercentFact(data: {
1911
+ key: "cpu" | "memory";
1912
+ label: string;
1913
+ percent: number | undefined;
1914
+ }): MonitorOverviewFact {
1915
+ if (data.percent === undefined || !Number.isFinite(data.percent)) {
1916
+ return { key: data.key, label: data.label, value: "—", isMuted: true };
1917
+ }
1918
+
1919
+ return {
1920
+ key: data.key,
1921
+ label: data.label,
1922
+ value: `${Math.round(data.percent)}%`,
1923
+ };
1924
+ }
1925
+
1926
+ private static getSections(
1927
+ context: MonitorOverviewContext,
1928
+ ): MonitorOverviewSections {
1929
+ const isAwaiting: boolean =
1930
+ context.runState === MonitorOverviewRunState.AwaitingFirstData;
1931
+ const layout: MonitorOverviewLayout = context.layout;
1932
+ const isPushFamily: boolean =
1933
+ context.family === MonitorOverviewFamily.Heartbeat ||
1934
+ context.family === MonitorOverviewFamily.Agent;
1935
+
1936
+ return {
1937
+ /*
1938
+ * Bars for a monitor that has never reported would all be "No data",
1939
+ * unless the server has already judged it: then its history (and what
1940
+ * is open now) is the point.
1941
+ */
1942
+ showUptime: !isAwaiting || context.hasPushVerdict,
1943
+ setup: isAwaiting ? layout.setupKind : null,
1944
+ connection: isAwaiting ? null : layout.setupKind,
1945
+ summary: {
1946
+ isShown:
1947
+ layout.summaryDescription !== null && !(isAwaiting && isPushFamily),
1948
+ description: layout.summaryDescription || "",
1949
+ },
1950
+ // The connection card only makes sense once something has connected.
1951
+ sideCard:
1952
+ layout.sideCard === "connection" && isAwaiting ? null : layout.sideCard,
1953
+ responseTimeMetric: isAwaiting ? null : layout.responseTimeMetric,
1954
+ telemetryPreview: context.stepCount > 0 ? layout.telemetryPreview : null,
1955
+ stepCount: context.stepCount,
1956
+ };
1957
+ }
1958
+ }