@oneuptime/common 12.0.28 → 12.0.30
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.
- package/Models/DatabaseModels/DashboardDomain.ts +43 -0
- package/Models/DatabaseModels/Index.ts +11 -0
- package/Models/DatabaseModels/MonitorTemplate.ts +15 -3
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.ts +43 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.ts +662 -0
- package/Models/DatabaseModels/ProjectOnCallCalendarFeed.ts +584 -0
- package/Models/DatabaseModels/StatusPageDomain.ts +43 -0
- package/Models/DatabaseModels/UserOnCallCalendarFeed.ts +546 -0
- package/Models/DatabaseModels/UserOnCallShiftReminder.ts +231 -0
- package/Models/DatabaseModels/UserOnCallShiftReminderLog.ts +331 -0
- package/Server/API/DashboardDomainAPI.ts +74 -0
- package/Server/API/MicrosoftTeamsAPI.ts +81 -180
- package/Server/API/OnCallCalendarAPI.ts +2194 -0
- package/Server/API/StatusPageDomainAPI.ts +74 -0
- package/Server/EnvironmentConfig.ts +138 -0
- package/Server/Infrastructure/OnCallCalendarFeedCache.ts +1050 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.ts +43 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.ts +40 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790400000000-AddOnCallCalendarFeeds.ts +253 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Middleware/OnCallCalendarFeedRateLimit.ts +487 -0
- package/Server/Middleware/ProjectAuthorization.ts +6 -1
- package/Server/Services/DashboardDomainService.ts +131 -0
- package/Server/Services/Index.ts +12 -0
- package/Server/Services/LogPipelineProcessorService.ts +88 -0
- package/Server/Services/MonitorTemplateService.ts +70 -11
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +32 -0
- package/Server/Services/OnCallDutyPolicyScheduleCalendarFeedService.ts +260 -0
- package/Server/Services/OnCallDutyPolicyScheduleLayerService.ts +70 -3
- package/Server/Services/OnCallDutyPolicyScheduleLayerUserService.ts +138 -3
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +1465 -134
- package/Server/Services/OnCallDutyPolicyUserOverrideService.ts +167 -31
- package/Server/Services/ProjectOnCallCalendarFeedService.ts +192 -0
- package/Server/Services/StatusPageDomainService.ts +163 -3
- package/Server/Services/StatusPagePrivateUserSessionService.ts +197 -56
- package/Server/Services/TeamMemberService.ts +489 -1
- package/Server/Services/TeamService.ts +50 -0
- package/Server/Services/UserNotificationSettingService.ts +44 -1
- package/Server/Services/UserOnCallCalendarFeedService.ts +159 -0
- package/Server/Services/UserOnCallShiftReminderLogService.ts +151 -0
- package/Server/Services/UserOnCallShiftReminderService.ts +112 -0
- package/Server/Types/Domain.ts +17 -0
- package/Server/Utils/APIKey/AccessPermission.ts +24 -0
- package/Server/Utils/Greenlock/Greenlock.ts +156 -58
- package/Server/Utils/LogPipelineProcessorValidation.ts +112 -0
- package/Server/Utils/OnCall/CalendarFeedToken.ts +241 -0
- package/Server/Utils/OnCall/OnCallCalendarFeedRenderer.ts +1488 -0
- package/Server/Utils/OnCall/OnCallCalendarFeedUrls.ts +230 -0
- package/Server/Utils/OnCall/OnCallShiftChangeListeners.ts +227 -0
- package/Server/Utils/OnCall/OnCallShiftMaterializer.ts +1127 -0
- package/Server/Utils/OnCall/OnCallShiftReminderListener.ts +174 -0
- package/Server/Utils/OnCall/OnCallShiftReminderRunner.ts +2584 -0
- package/Server/Utils/Response.ts +134 -0
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.ts +1094 -45
- package/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.ts +153 -17
- package/Server/Utils/StartServer.ts +10 -0
- package/Server/Utils/Telemetry/AppMetrics.ts +51 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +0 -170
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.ts +158 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +23 -11
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +35 -13
- package/Tests/App/Dashboard/MonitorTemplateColumnAndFacet.test.tsx +505 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedLinks.test.tsx +229 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedPlanGate.test.tsx +489 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedSideMenus.test.tsx +149 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedUtil.test.ts +855 -0
- package/Tests/App/Dashboard/OnCallPersonalCalendarFeed.test.tsx +1209 -0
- package/Tests/App/Dashboard/OnCallSharedCalendarFeedCard.test.tsx +1019 -0
- package/Tests/App/Dashboard/OnCallShiftRemindersAndUpcomingShifts.test.tsx +655 -0
- package/Tests/App/Dashboard/UserSettingsSetupChecklistModel.test.ts +73 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeBootstrap.test.ts +106 -0
- package/Tests/App/StatusPage/StatusPageLoginCodeUtil.test.ts +84 -0
- package/Tests/App/StatusPage/StatusPageRedirectSafety.test.ts +119 -0
- package/Tests/Models/MonitorTemplateMonitorNameColumn.test.ts +258 -0
- package/Tests/Models/OnCallCalendarFeedModels.test.ts +642 -0
- package/Tests/Models/OnCallDutyPolicyScheduleCalendarFeed.test.ts +288 -0
- package/Tests/Models/OnCallDutyPolicyScheduleShiftConfigVersion.test.ts +88 -0
- package/Tests/Models/UserOnCallShiftReminderModels.test.ts +368 -0
- package/Tests/Server/API/CustomDomainReissueSslAPI.test.ts +469 -0
- package/Tests/Server/API/Helpers.ts +8 -0
- package/Tests/Server/API/MicrosoftTeamsBotMessagesEndpoint.test.ts +729 -0
- package/Tests/Server/API/MicrosoftTeamsBotTestEndpoint.test.ts +26 -0
- package/Tests/Server/API/MicrosoftTeamsLegacyWebhookRemoval.test.ts +402 -0
- package/Tests/Server/API/OnCallCalendarAPI.test.ts +4461 -0
- package/Tests/Server/EnvironmentConfigOnCallCalendarFeed.test.ts +357 -0
- package/Tests/Server/Infrastructure/OnCallCalendarFeedCache.test.ts +1589 -0
- package/Tests/Server/Infrastructure/Postgres/AddOnCallCalendarFeedsMigration.test.ts +369 -0
- package/Tests/Server/Middleware/OnCallCalendarFeedRateLimit.test.ts +1365 -0
- package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +4 -0
- package/Tests/Server/Services/AddCertificateReissueRequestedAtToDomainsMigration.test.ts +287 -0
- package/Tests/Server/Services/CustomDomainCertificateReissue.test.ts +477 -0
- package/Tests/Server/Services/FeedRetentionConsistency.test.ts +70 -0
- package/Tests/Server/Services/LogPipelineProcessorSaveValidation.test.ts +249 -0
- package/Tests/Server/Services/MonitorTemplateServiceBulkSync.test.ts +549 -0
- package/Tests/Server/Services/MonitorTemplateServiceNetworkDeviceSync.test.ts +16 -3
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +57 -0
- package/Tests/Server/Services/OnCallCalendarFeedServices.test.ts +1103 -0
- package/Tests/Server/Services/OnCallDutyPolicyScheduleResolver.test.ts +1037 -0
- package/Tests/Server/Services/OnCallShiftConfigPropagation.test.ts +1270 -0
- package/Tests/Server/Services/SecurityEventLastErrorColumnWidth.test.ts +151 -15
- package/Tests/Server/Services/StatusPagePrivateUserSessionService.test.ts +587 -0
- package/Tests/Server/Services/TeamDeleteMemberCleanup.test.ts +156 -0
- package/Tests/Server/Services/TeamMemberOnCallCleanup.test.ts +755 -0
- package/Tests/Server/Services/UserNotificationSettingShiftReminderDefaults.test.ts +267 -0
- package/Tests/Server/Services/UserOnCallShiftReminderServices.test.ts +583 -0
- package/Tests/Server/Types/Database/Permissions/ApiKeyFileAccess.test.ts +286 -0
- package/Tests/Server/Types/Database/Permissions/MonitorTemplateColumnAccess.test.ts +328 -0
- package/Tests/Server/Types/Database/Permissions/OnCallCalendarFeedPermissions.test.ts +254 -0
- package/Tests/Server/Types/Database/QueryHelperFindWithSameTextAndIsNull.test.ts +83 -0
- package/Tests/Server/Utils/AI/SRE/ConfidenceSignal.test.ts +377 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +16 -1
- package/Tests/Server/Utils/Greenlock/CertificateRenewalSchedule.test.ts +250 -0
- package/Tests/Server/Utils/LogPipelineProcessorValidation.test.ts +198 -0
- package/Tests/Server/Utils/OnCall/CalendarFeedToken.test.ts +467 -0
- package/Tests/Server/Utils/OnCall/OnCallCalendarFeedRenderer.test.ts +2142 -0
- package/Tests/Server/Utils/OnCall/OnCallCalendarFeedUrls.test.ts +278 -0
- package/Tests/Server/Utils/OnCall/OnCallResolverTestHarness.ts +440 -0
- package/Tests/Server/Utils/OnCall/OnCallShiftChangeListeners.test.ts +314 -0
- package/Tests/Server/Utils/OnCall/OnCallShiftMaterializer.test.ts +1502 -0
- package/Tests/Server/Utils/OnCall/OnCallShiftReminderListener.test.ts +491 -0
- package/Tests/Server/Utils/OnCall/OnCallShiftReminderRunner.test.ts +3088 -0
- package/Tests/Server/Utils/OnCall/OnCallShiftReminderTestHarness.ts +910 -0
- package/Tests/Server/Utils/ResponseSendCalendarResponse.test.ts +561 -0
- package/Tests/Server/Utils/SecurityEvent/ConnectorErrorMessage.test.ts +48 -9
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsAuth.test.ts +726 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsClient.test.ts +74 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsErrorHandling.test.ts +1107 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPoller.test.ts +20 -3
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerFailureTaxonomy.test.ts +51 -11
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsPollerHardening.test.ts +1246 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsRequestContract.test.ts +961 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsResponseParsing.test.ts +653 -0
- package/Tests/Server/Utils/StartServerEncryptionSecretWarning.test.ts +64 -0
- package/Tests/Server/Utils/Telemetry/AppMetrics.test.ts +29 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsActionAuthorization.test.ts +880 -0
- package/Tests/Types/API/HTTPResponse.test.ts +175 -0
- package/Tests/Types/API/Route.test.ts +36 -4
- package/Tests/Types/Calendar/ICalendar.test.ts +488 -0
- package/Tests/Types/Database/DatabaseProperty.test.ts +171 -0
- package/Tests/Types/DateLocalShortDateTimeString.test.ts +518 -0
- package/Tests/Types/DateLocalTimeString.test.ts +259 -0
- package/Tests/Types/DateUserPrefers12HourFormat.test.ts +316 -0
- package/Tests/Types/NotificationSetting/NotificationSettingEventType.test.ts +53 -0
- package/Tests/Types/OnCallDutyPolicy/CalendarFeedTestFixtures.ts +310 -0
- package/Tests/Types/OnCallDutyPolicy/CalendarFeedWindow.test.ts +205 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilLayerMetaAndIterationCap.test.ts +458 -0
- package/Tests/Types/OnCallDutyPolicy/MaterializedShift.test.ts +197 -0
- package/Tests/Types/OnCallDutyPolicy/OnCallCalendarFeedUtil.test.ts +1986 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleShiftUtilGroupKey.test.ts +678 -0
- package/Tests/Types/OnCallDutyPolicy/ShiftSeamUtil.test.ts +417 -0
- package/Tests/UI/Components/LogsHistogram.test.tsx +41 -2
- package/Tests/UI/Components/LogsViewerEmptyStateTimeRange.test.tsx +212 -0
- package/Tests/UI/Components/TelemetryChartClockFormat.test.tsx +359 -0
- package/Tests/UI/Components/TimeRangePickerClockFormat.test.tsx +422 -0
- package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +146 -8
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsMessagingEndpointGuidance.test.tsx +520 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +10 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +2 -0
- package/Tests/UI/Utils/Navigation.test.ts +82 -0
- package/Tests/Utils/Array.test.ts +100 -0
- package/Tests/Utils/CertificateReissue.test.ts +225 -0
- package/Tests/Utils/Grok/Grok.test.ts +492 -0
- package/Tests/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.test.ts +181 -13
- package/Types/API/Route.ts +20 -5
- package/Types/Calendar/ICalendar.ts +442 -0
- package/Types/Date.ts +143 -13
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
- package/Types/OnCallDutyPolicy/CalendarFeedWindow.ts +140 -0
- package/Types/OnCallDutyPolicy/Layer.ts +190 -35
- package/Types/OnCallDutyPolicy/MaterializedShift.ts +274 -0
- package/Types/OnCallDutyPolicy/OnCallCalendarFeedUtil.ts +1415 -0
- package/Types/OnCallDutyPolicy/ScheduleShiftUtil.ts +159 -4
- package/Types/OnCallDutyPolicy/ShiftSeamUtil.ts +106 -0
- package/Types/Rum/SessionReplay.ts +62 -1
- package/UI/Components/Date/TimeRangePickerDropdown.tsx +9 -5
- package/UI/Components/LogsViewer/LogsViewer.tsx +12 -7
- package/UI/Components/LogsViewer/components/HistogramTooltip.tsx +18 -17
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +21 -28
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +2 -4
- package/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.tsx +17 -16
- package/UI/Utils/Navigation.ts +42 -0
- package/Utils/Array.ts +37 -0
- package/Utils/CertificateReissue.ts +128 -0
- package/Utils/Grok/Grok.ts +461 -0
- package/Utils/Grok/GrokPatterns.ts +118 -0
- package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +58 -6
- package/build/dist/Models/DatabaseModels/DashboardDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +11 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js +17 -4
- package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js +44 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +699 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js +620 -0
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +44 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js +585 -0
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserOnCallShiftReminder.js +247 -0
- package/build/dist/Models/DatabaseModels/UserOnCallShiftReminder.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserOnCallShiftReminderLog.js +355 -0
- package/build/dist/Models/DatabaseModels/UserOnCallShiftReminderLog.js.map +1 -0
- package/build/dist/Server/API/DashboardDomainAPI.js +43 -1
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +74 -118
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallCalendarAPI.js +1371 -0
- package/build/dist/Server/API/OnCallCalendarAPI.js.map +1 -0
- package/build/dist/Server/API/StatusPageDomainAPI.js +43 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +102 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/OnCallCalendarFeedCache.js +663 -0
- package/build/dist/Server/Infrastructure/OnCallCalendarFeedCache.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790200000000-AllowNullMonitorNameOnMonitorTemplate.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js +28 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790300000000-AddCertificateReissueRequestedAtToDomains.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790400000000-AddOnCallCalendarFeeds.js +103 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790400000000-AddOnCallCalendarFeeds.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/OnCallCalendarFeedRateLimit.js +342 -0
- package/build/dist/Server/Middleware/OnCallCalendarFeedRateLimit.js.map +1 -0
- package/build/dist/Server/Middleware/ProjectAuthorization.js +6 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +104 -0
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +12 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LogPipelineProcessorService.js +65 -0
- package/build/dist/Server/Services/LogPipelineProcessorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +57 -11
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +20 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleCalendarFeedService.js +219 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleCalendarFeedService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js +47 -3
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js +112 -3
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +955 -9
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js +93 -6
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js.map +1 -1
- package/build/dist/Server/Services/ProjectOnCallCalendarFeedService.js +157 -0
- package/build/dist/Server/Services/ProjectOnCallCalendarFeedService.js.map +1 -0
- package/build/dist/Server/Services/StatusPageDomainService.js +132 -3
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js +112 -32
- package/build/dist/Server/Services/StatusPagePrivateUserSessionService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +396 -1
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TeamService.js +43 -0
- package/build/dist/Server/Services/TeamService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +26 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallCalendarFeedService.js +140 -0
- package/build/dist/Server/Services/UserOnCallCalendarFeedService.js.map +1 -0
- package/build/dist/Server/Services/UserOnCallShiftReminderLogService.js +116 -0
- package/build/dist/Server/Services/UserOnCallShiftReminderLogService.js.map +1 -0
- package/build/dist/Server/Services/UserOnCallShiftReminderService.js +92 -0
- package/build/dist/Server/Services/UserOnCallShiftReminderService.js.map +1 -0
- package/build/dist/Server/Types/Domain.js +16 -0
- package/build/dist/Server/Types/Domain.js.map +1 -1
- package/build/dist/Server/Utils/APIKey/AccessPermission.js +24 -0
- package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +110 -35
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js +77 -0
- package/build/dist/Server/Utils/LogPipelineProcessorValidation.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/CalendarFeedToken.js +161 -0
- package/build/dist/Server/Utils/OnCall/CalendarFeedToken.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallCalendarFeedRenderer.js +983 -0
- package/build/dist/Server/Utils/OnCall/OnCallCalendarFeedRenderer.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallCalendarFeedUrls.js +155 -0
- package/build/dist/Server/Utils/OnCall/OnCallCalendarFeedUrls.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftChangeListeners.js +145 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftChangeListeners.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftMaterializer.js +752 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftMaterializer.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftReminderListener.js +92 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftReminderListener.js.map +1 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js +1786 -0
- package/build/dist/Server/Utils/OnCall/OnCallShiftReminderRunner.js.map +1 -0
- package/build/dist/Server/Utils/Response.js +97 -0
- package/build/dist/Server/Utils/Response.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js +777 -36
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsClient.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js +108 -17
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOps/GoogleSecOpsPoller.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +9 -1
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/AppMetrics.js +41 -0
- package/build/dist/Server/Utils/Telemetry/AppMetrics.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +0 -159
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js +128 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Authorization.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +17 -6
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +25 -13
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/API/Route.js +16 -5
- package/build/dist/Types/API/Route.js.map +1 -1
- package/build/dist/Types/Calendar/ICalendar.js +290 -0
- package/build/dist/Types/Calendar/ICalendar.js.map +1 -0
- package/build/dist/Types/Date.js +115 -13
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +2 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/CalendarFeedWindow.js +97 -0
- package/build/dist/Types/OnCallDutyPolicy/CalendarFeedWindow.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/Layer.js +113 -19
- package/build/dist/Types/OnCallDutyPolicy/Layer.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/MaterializedShift.js +134 -0
- package/build/dist/Types/OnCallDutyPolicy/MaterializedShift.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/OnCallCalendarFeedUtil.js +800 -0
- package/build/dist/Types/OnCallDutyPolicy/OnCallCalendarFeedUtil.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js +97 -3
- package/build/dist/Types/OnCallDutyPolicy/ScheduleShiftUtil.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/ShiftSeamUtil.js +77 -0
- package/build/dist/Types/OnCallDutyPolicy/ShiftSeamUtil.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplay.js +38 -0
- package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +9 -5
- package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +12 -7
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js +15 -14
- package/build/dist/UI/Components/LogsViewer/components/HistogramTooltip.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +17 -22
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +2 -4
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +2 -4
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js +15 -14
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogramTooltip.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +30 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/Utils/Array.js +25 -0
- package/build/dist/Utils/Array.js.map +1 -1
- package/build/dist/Utils/CertificateReissue.js +97 -0
- package/build/dist/Utils/CertificateReissue.js.map +1 -0
- package/build/dist/Utils/Grok/Grok.js +324 -0
- package/build/dist/Utils/Grok/Grok.js.map +1 -0
- package/build/dist/Utils/Grok/GrokPatterns.js +112 -0
- package/build/dist/Utils/Grok/GrokPatterns.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +63 -3
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
- package/package.json +1 -1
- package/UI/Utils/JsonWebToken.ts +0 -14
- package/build/dist/UI/Utils/JsonWebToken.js +0 -10
- package/build/dist/UI/Utils/JsonWebToken.js.map +0 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import CalendarEvent from "../../../Types/Calendar/CalendarEvent";
|
|
2
|
+
import EventInterval from "../../../Types/Events/EventInterval";
|
|
3
|
+
import LayerUtil, {
|
|
4
|
+
LayerProps,
|
|
5
|
+
PriorityCalendarEvents,
|
|
6
|
+
} from "../../../Types/OnCallDutyPolicy/Layer";
|
|
7
|
+
import ScheduleShiftUtil, {
|
|
8
|
+
OnCallShift,
|
|
9
|
+
} from "../../../Types/OnCallDutyPolicy/ScheduleShiftUtil";
|
|
10
|
+
import ShiftSeamUtil, {
|
|
11
|
+
SEAM_TOLERANCE_MILLISECONDS,
|
|
12
|
+
TimeSegment,
|
|
13
|
+
} from "../../../Types/OnCallDutyPolicy/ShiftSeamUtil";
|
|
14
|
+
import UserOverrideUtil from "../../../Types/OnCallDutyPolicy/UserOverrideUtil";
|
|
15
|
+
import {
|
|
16
|
+
at,
|
|
17
|
+
dailyRestriction,
|
|
18
|
+
hhmm,
|
|
19
|
+
noRestriction,
|
|
20
|
+
rotation,
|
|
21
|
+
tzInstant,
|
|
22
|
+
user,
|
|
23
|
+
} from "./CalendarFeedTestFixtures";
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Seam normalisation is what turns the engine's 1-second artefacts into
|
|
27
|
+
* calendar entries that read 09:00-17:00 and touch their neighbours exactly.
|
|
28
|
+
* The fixtures are the ones the design cites: the LayerUtilAuditFixes "Fix 3"
|
|
29
|
+
* primary/fallback schedule (A[10:00-11:00], B[11:00:01-12:00]) and an
|
|
30
|
+
* override split A / B / A.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const UTC: string = "UTC";
|
|
34
|
+
|
|
35
|
+
function seg(start: string, end: string): TimeSegment {
|
|
36
|
+
return { start: at(start), end: at(end) };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function assertTouchingChain(segments: Array<TimeSegment>): void {
|
|
40
|
+
for (let i: number = 0; i < segments.length - 1; i++) {
|
|
41
|
+
expect(segments[i]!.end.getTime()).toBe(segments[i + 1]!.start.getTime());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describe("ShiftSeamUtil.snapStart / snapEnd", () => {
|
|
46
|
+
test("a start on second 1 snaps down to the minute, including any milliseconds", () => {
|
|
47
|
+
expect(
|
|
48
|
+
ShiftSeamUtil.snapStart(at("2026-03-02T11:00:01Z")).toISOString(),
|
|
49
|
+
).toBe("2026-03-02T11:00:00.000Z");
|
|
50
|
+
expect(
|
|
51
|
+
ShiftSeamUtil.snapStart(at("2026-03-02T11:00:01.750Z")).toISOString(),
|
|
52
|
+
).toBe("2026-03-02T11:00:00.000Z");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("an end on second 59 snaps up to the next minute, including across an hour/day", () => {
|
|
56
|
+
expect(
|
|
57
|
+
ShiftSeamUtil.snapEnd(at("2026-03-02T10:59:59Z")).toISOString(),
|
|
58
|
+
).toBe("2026-03-02T11:00:00.000Z");
|
|
59
|
+
expect(
|
|
60
|
+
ShiftSeamUtil.snapEnd(at("2026-03-02T23:59:59Z")).toISOString(),
|
|
61
|
+
).toBe("2026-03-03T00:00:00.000Z");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("other seconds are left alone and a copy is returned", () => {
|
|
65
|
+
const original: Date = at("2026-03-02T11:00:30Z");
|
|
66
|
+
const start: Date = ShiftSeamUtil.snapStart(original);
|
|
67
|
+
const end: Date = ShiftSeamUtil.snapEnd(original);
|
|
68
|
+
|
|
69
|
+
expect(start.getTime()).toBe(original.getTime());
|
|
70
|
+
expect(end.getTime()).toBe(original.getTime());
|
|
71
|
+
expect(start).not.toBe(original);
|
|
72
|
+
expect(end).not.toBe(original);
|
|
73
|
+
|
|
74
|
+
expect(ShiftSeamUtil.snapStart(at("2026-03-02T11:00:02Z")).getTime()).toBe(
|
|
75
|
+
at("2026-03-02T11:00:02Z").getTime(),
|
|
76
|
+
);
|
|
77
|
+
expect(ShiftSeamUtil.snapEnd(at("2026-03-02T11:00:58Z")).getTime()).toBe(
|
|
78
|
+
at("2026-03-02T11:00:58Z").getTime(),
|
|
79
|
+
);
|
|
80
|
+
expect(ShiftSeamUtil.snapEnd(at("2026-03-02T11:00:00Z")).getTime()).toBe(
|
|
81
|
+
at("2026-03-02T11:00:00Z").getTime(),
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe("ShiftSeamUtil.normalizeSeams", () => {
|
|
87
|
+
test("the cited audit fixture: A[10:00-11:00], B[11:00:01-12:00] becomes touching at 11:00", () => {
|
|
88
|
+
const calStart: Date = at("2026-03-02T00:00:00Z");
|
|
89
|
+
const calEnd: Date = at("2026-03-03T00:00:00Z");
|
|
90
|
+
|
|
91
|
+
const primary: LayerProps = {
|
|
92
|
+
users: [user("A"), user("B")],
|
|
93
|
+
startDateTimeOfLayer: calStart,
|
|
94
|
+
restrictionTimes: dailyRestriction("10:00", "12:00", UTC),
|
|
95
|
+
handOffTime: at("2026-03-02T11:00:00Z"),
|
|
96
|
+
rotation: rotation(EventInterval.Hour, 1),
|
|
97
|
+
timezone: UTC,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const events: Array<CalendarEvent> = new LayerUtil().getEvents({
|
|
101
|
+
...primary,
|
|
102
|
+
calendarStartDate: calStart,
|
|
103
|
+
calendarEndDate: calEnd,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const a: CalendarEvent | undefined = events.find((event: CalendarEvent) => {
|
|
107
|
+
return event.title === "A";
|
|
108
|
+
});
|
|
109
|
+
const b: CalendarEvent | undefined = events.find((event: CalendarEvent) => {
|
|
110
|
+
return event.title === "B";
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// The raw engine output really has the 1-second seam we are fixing.
|
|
114
|
+
expect(a!.end.toISOString()).toBe("2026-03-02T11:00:00.000Z");
|
|
115
|
+
expect(b!.start.toISOString()).toBe("2026-03-02T11:00:01.000Z");
|
|
116
|
+
|
|
117
|
+
const normalized: Array<CalendarEvent> =
|
|
118
|
+
ShiftSeamUtil.normalizeSeams(events);
|
|
119
|
+
const na: CalendarEvent = normalized.find((event: CalendarEvent) => {
|
|
120
|
+
return event.title === "A";
|
|
121
|
+
})!;
|
|
122
|
+
const nb: CalendarEvent = normalized.find((event: CalendarEvent) => {
|
|
123
|
+
return event.title === "B";
|
|
124
|
+
})!;
|
|
125
|
+
|
|
126
|
+
expect(na.start.toISOString()).toBe("2026-03-02T10:00:00.000Z");
|
|
127
|
+
expect(na.end.toISOString()).toBe("2026-03-02T11:00:00.000Z");
|
|
128
|
+
expect(nb.start.toISOString()).toBe("2026-03-02T11:00:00.000Z");
|
|
129
|
+
expect(nb.end.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
130
|
+
expect(na.end.getTime()).toBe(nb.start.getTime());
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("a daily 09:00-17:00 restriction reads 09:00-17:00 on every day, not 09:00:01", () => {
|
|
134
|
+
const tz: string = "Europe/Stockholm";
|
|
135
|
+
const calStart: Date = tzInstant("2026-01-05 00:00", tz);
|
|
136
|
+
const calEnd: Date = tzInstant("2026-01-09 00:00", tz);
|
|
137
|
+
|
|
138
|
+
const events: Array<CalendarEvent> = new LayerUtil().getEvents({
|
|
139
|
+
users: [user("A")],
|
|
140
|
+
startDateTimeOfLayer: calStart,
|
|
141
|
+
restrictionTimes: dailyRestriction("09:00", "17:00", tz),
|
|
142
|
+
handOffTime: tzInstant("2026-01-05 09:00", tz),
|
|
143
|
+
rotation: rotation(EventInterval.Week, 1),
|
|
144
|
+
timezone: tz,
|
|
145
|
+
calendarStartDate: calStart,
|
|
146
|
+
calendarEndDate: calEnd,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// The engine's own artefact: at least one window opens on second 1.
|
|
150
|
+
expect(
|
|
151
|
+
events.some((event: CalendarEvent) => {
|
|
152
|
+
return event.start.getUTCSeconds() === 1;
|
|
153
|
+
}),
|
|
154
|
+
).toBe(true);
|
|
155
|
+
|
|
156
|
+
const normalized: Array<CalendarEvent> =
|
|
157
|
+
ShiftSeamUtil.normalizeSeams(events);
|
|
158
|
+
|
|
159
|
+
expect(normalized).toHaveLength(4);
|
|
160
|
+
for (const event of normalized) {
|
|
161
|
+
expect(hhmm(event.start, tz)).toBe("09:00");
|
|
162
|
+
expect(hhmm(event.end, tz)).toBe("17:00");
|
|
163
|
+
expect(event.start.getUTCSeconds()).toBe(0);
|
|
164
|
+
expect(event.end.getUTCSeconds()).toBe(0);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("an override split yields A / B / A that touch exactly", () => {
|
|
169
|
+
const base: CalendarEvent = {
|
|
170
|
+
id: 1,
|
|
171
|
+
title: "A",
|
|
172
|
+
allDay: false,
|
|
173
|
+
start: at("2026-03-02T09:00:00Z"),
|
|
174
|
+
end: at("2026-03-02T17:00:00Z"),
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const events: Array<CalendarEvent> =
|
|
178
|
+
UserOverrideUtil.applyOverridesToEvents({
|
|
179
|
+
events: [base],
|
|
180
|
+
overrides: [
|
|
181
|
+
{
|
|
182
|
+
overrideUserId: "A",
|
|
183
|
+
routeAlertsToUserId: "B",
|
|
184
|
+
startsAt: at("2026-03-02T12:00:00Z"),
|
|
185
|
+
endsAt: at("2026-03-02T13:00:00Z"),
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
expect(
|
|
191
|
+
events.map((event: CalendarEvent) => {
|
|
192
|
+
return event.title;
|
|
193
|
+
}),
|
|
194
|
+
).toEqual(["A", "B", "A"]);
|
|
195
|
+
|
|
196
|
+
const normalized: Array<CalendarEvent> =
|
|
197
|
+
ShiftSeamUtil.normalizeSeams(events);
|
|
198
|
+
assertTouchingChain(normalized);
|
|
199
|
+
|
|
200
|
+
const shifts: Array<OnCallShift> = ScheduleShiftUtil.groupEventsIntoShifts(
|
|
201
|
+
normalized,
|
|
202
|
+
{ groupKey: ScheduleShiftUtil.groupKeyByUserOverrideAndLayer },
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
expect(shifts).toHaveLength(3);
|
|
206
|
+
assertTouchingChain(shifts);
|
|
207
|
+
expect(shifts[0]!.start.toISOString()).toBe("2026-03-02T09:00:00.000Z");
|
|
208
|
+
expect(shifts[1]!.start.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
209
|
+
expect(shifts[2]!.start.toISOString()).toBe("2026-03-02T13:00:00.000Z");
|
|
210
|
+
expect(shifts[2]!.end.toISOString()).toBe("2026-03-02T17:00:00.000Z");
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("priority-merge seams (end = start-1s, start = end+1s) are closed", () => {
|
|
214
|
+
const merged: Array<CalendarEvent> =
|
|
215
|
+
new LayerUtil().removeOverlappingEvents([
|
|
216
|
+
{
|
|
217
|
+
id: 1,
|
|
218
|
+
title: "fallback",
|
|
219
|
+
allDay: false,
|
|
220
|
+
start: at("2026-03-02T00:00:00Z"),
|
|
221
|
+
end: at("2026-03-03T00:00:00Z"),
|
|
222
|
+
priority: 2,
|
|
223
|
+
} as PriorityCalendarEvents,
|
|
224
|
+
{
|
|
225
|
+
id: 2,
|
|
226
|
+
title: "primary",
|
|
227
|
+
allDay: false,
|
|
228
|
+
start: at("2026-03-02T10:00:00Z"),
|
|
229
|
+
end: at("2026-03-02T12:00:00Z"),
|
|
230
|
+
priority: 1,
|
|
231
|
+
} as PriorityCalendarEvents,
|
|
232
|
+
]);
|
|
233
|
+
|
|
234
|
+
// Raw merge output carries the 1s seams.
|
|
235
|
+
expect(merged[0]!.end.toISOString()).toBe("2026-03-02T09:59:59.000Z");
|
|
236
|
+
expect(merged[2]!.start.toISOString()).toBe("2026-03-02T12:00:01.000Z");
|
|
237
|
+
|
|
238
|
+
const normalized: Array<CalendarEvent> =
|
|
239
|
+
ShiftSeamUtil.normalizeSeams(merged);
|
|
240
|
+
|
|
241
|
+
expect(normalized[0]!.end.toISOString()).toBe("2026-03-02T10:00:00.000Z");
|
|
242
|
+
expect(normalized[1]!.start.toISOString()).toBe("2026-03-02T10:00:00.000Z");
|
|
243
|
+
expect(normalized[1]!.end.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
244
|
+
expect(normalized[2]!.start.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
245
|
+
assertTouchingChain(normalized);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test("a full multi-layer expansion normalises into a gapless, overlap-free chain", () => {
|
|
249
|
+
const calStart: Date = at("2026-03-02T00:00:00Z");
|
|
250
|
+
const calEnd: Date = at("2026-03-05T00:00:00Z");
|
|
251
|
+
|
|
252
|
+
const events: Array<CalendarEvent> = new LayerUtil().getMultiLayerEvents({
|
|
253
|
+
layers: [
|
|
254
|
+
{
|
|
255
|
+
users: [user("A"), user("B")],
|
|
256
|
+
startDateTimeOfLayer: calStart,
|
|
257
|
+
restrictionTimes: dailyRestriction("10:00", "12:00", UTC),
|
|
258
|
+
handOffTime: at("2026-03-02T11:00:00Z"),
|
|
259
|
+
rotation: rotation(EventInterval.Hour, 1),
|
|
260
|
+
timezone: UTC,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
users: [user("C")],
|
|
264
|
+
startDateTimeOfLayer: calStart,
|
|
265
|
+
restrictionTimes: noRestriction(),
|
|
266
|
+
handOffTime: calStart,
|
|
267
|
+
rotation: rotation(EventInterval.Week, 1),
|
|
268
|
+
timezone: UTC,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
calendarStartDate: calStart,
|
|
272
|
+
calendarEndDate: calEnd,
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
const normalized: Array<CalendarEvent> =
|
|
276
|
+
ShiftSeamUtil.normalizeSeams(events);
|
|
277
|
+
|
|
278
|
+
expect(normalized.length).toBeGreaterThan(6);
|
|
279
|
+
expect(normalized[0]!.start.getTime()).toBe(calStart.getTime());
|
|
280
|
+
expect(normalized[normalized.length - 1]!.end.getTime()).toBe(
|
|
281
|
+
calEnd.getTime(),
|
|
282
|
+
);
|
|
283
|
+
assertTouchingChain(normalized);
|
|
284
|
+
|
|
285
|
+
for (const event of normalized) {
|
|
286
|
+
expect(event.end.getTime()).toBeGreaterThan(event.start.getTime());
|
|
287
|
+
expect(event.start.getUTCSeconds()).toBe(0);
|
|
288
|
+
expect(event.end.getUTCSeconds()).toBe(0);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test("segments 0..1000 ms apart are made to touch; anything further stays a gap", () => {
|
|
293
|
+
const zero: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
294
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:00Z"),
|
|
295
|
+
seg("2026-03-02T10:00:00Z", "2026-03-02T11:00:00Z"),
|
|
296
|
+
]);
|
|
297
|
+
assertTouchingChain(zero);
|
|
298
|
+
|
|
299
|
+
/*
|
|
300
|
+
* The inclusive upper bound itself: exactly SEAM_TOLERANCE_MILLISECONDS
|
|
301
|
+
* apart. The seconds are :30 / :31 on purpose — a :59 end or a :01 start
|
|
302
|
+
* would snap to the minute first and reach the glue loop as a 0 ms delta,
|
|
303
|
+
* which is what a previous version of this test measured (it named a 0 ms
|
|
304
|
+
* case "exactlyTolerance"), leaving `delta <= SEAM_TOLERANCE_MILLISECONDS`
|
|
305
|
+
* free to be an off-by-one.
|
|
306
|
+
*/
|
|
307
|
+
const exactlyTolerance: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
308
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:30.000Z"),
|
|
309
|
+
seg("2026-03-02T10:00:31.000Z", "2026-03-02T11:00:00Z"),
|
|
310
|
+
]);
|
|
311
|
+
expect(
|
|
312
|
+
exactlyTolerance[1]!.start.getTime() -
|
|
313
|
+
at("2026-03-02T10:00:30.000Z").getTime(),
|
|
314
|
+
).toBe(SEAM_TOLERANCE_MILLISECONDS);
|
|
315
|
+
assertTouchingChain(exactlyTolerance);
|
|
316
|
+
expect(exactlyTolerance[0]!.end.toISOString()).toBe(
|
|
317
|
+
"2026-03-02T10:00:31.000Z",
|
|
318
|
+
);
|
|
319
|
+
expect(SEAM_TOLERANCE_MILLISECONDS).toBe(1000);
|
|
320
|
+
|
|
321
|
+
// One millisecond past the bound is a gap and must be left alone.
|
|
322
|
+
const oneOverTolerance: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
323
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:30.000Z"),
|
|
324
|
+
seg("2026-03-02T10:00:31.001Z", "2026-03-02T11:00:00Z"),
|
|
325
|
+
]);
|
|
326
|
+
expect(oneOverTolerance[0]!.end.toISOString()).toBe(
|
|
327
|
+
"2026-03-02T10:00:30.000Z",
|
|
328
|
+
);
|
|
329
|
+
expect(oneOverTolerance[1]!.start.toISOString()).toBe(
|
|
330
|
+
"2026-03-02T10:00:31.001Z",
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const halfSecond: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
334
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:00.000Z"),
|
|
335
|
+
seg("2026-03-02T10:00:00.500Z", "2026-03-02T11:00:00Z"),
|
|
336
|
+
]);
|
|
337
|
+
assertTouchingChain(halfSecond);
|
|
338
|
+
|
|
339
|
+
const twoSeconds: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
340
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:00Z"),
|
|
341
|
+
seg("2026-03-02T10:00:02Z", "2026-03-02T11:00:00Z"),
|
|
342
|
+
]);
|
|
343
|
+
expect(twoSeconds[0]!.end.toISOString()).toBe("2026-03-02T10:00:00.000Z");
|
|
344
|
+
expect(twoSeconds[1]!.start.toISOString()).toBe("2026-03-02T10:00:02.000Z");
|
|
345
|
+
|
|
346
|
+
const realGap: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
347
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T10:00:00Z"),
|
|
348
|
+
seg("2026-03-02T14:00:00Z", "2026-03-02T15:00:00Z"),
|
|
349
|
+
]);
|
|
350
|
+
expect(realGap[0]!.end.toISOString()).toBe("2026-03-02T10:00:00.000Z");
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test("overlapping segments are not altered", () => {
|
|
354
|
+
const overlapping: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
355
|
+
seg("2026-03-02T09:00:00Z", "2026-03-02T11:00:00Z"),
|
|
356
|
+
seg("2026-03-02T10:00:00Z", "2026-03-02T12:00:00Z"),
|
|
357
|
+
]);
|
|
358
|
+
|
|
359
|
+
expect(overlapping[0]!.end.toISOString()).toBe("2026-03-02T11:00:00.000Z");
|
|
360
|
+
expect(overlapping[1]!.start.toISOString()).toBe(
|
|
361
|
+
"2026-03-02T10:00:00.000Z",
|
|
362
|
+
);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test("snapping only ever widens a segment, so a sub-minute one still grows outward", () => {
|
|
366
|
+
const tiny: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
367
|
+
seg("2026-03-02T09:00:01Z", "2026-03-02T09:00:59Z"),
|
|
368
|
+
]);
|
|
369
|
+
|
|
370
|
+
expect(tiny[0]!.start.toISOString()).toBe("2026-03-02T09:00:00.000Z");
|
|
371
|
+
expect(tiny[0]!.end.toISOString()).toBe("2026-03-02T09:01:00.000Z");
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
test("an empty or inverted segment is left exactly as it was", () => {
|
|
375
|
+
const empty: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
376
|
+
seg("2026-03-02T09:00:01Z", "2026-03-02T09:00:01Z"),
|
|
377
|
+
]);
|
|
378
|
+
expect(empty[0]!.start.toISOString()).toBe("2026-03-02T09:00:01.000Z");
|
|
379
|
+
expect(empty[0]!.end.toISOString()).toBe("2026-03-02T09:00:01.000Z");
|
|
380
|
+
|
|
381
|
+
const inverted: Array<TimeSegment> = ShiftSeamUtil.normalizeSeams([
|
|
382
|
+
seg("2026-03-02T10:00:01Z", "2026-03-02T09:59:59Z"),
|
|
383
|
+
]);
|
|
384
|
+
expect(inverted[0]!.start.toISOString()).toBe("2026-03-02T10:00:01.000Z");
|
|
385
|
+
expect(inverted[0]!.end.toISOString()).toBe("2026-03-02T09:59:59.000Z");
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
test("returns sorted copies, preserves extra properties and never mutates the input", () => {
|
|
389
|
+
const first: TimeSegment & { label: string } = {
|
|
390
|
+
...seg("2026-03-02T12:00:01Z", "2026-03-02T13:59:59Z"),
|
|
391
|
+
label: "second-by-time",
|
|
392
|
+
};
|
|
393
|
+
const second: TimeSegment & { label: string } = {
|
|
394
|
+
...seg("2026-03-02T09:00:01Z", "2026-03-02T11:59:59Z"),
|
|
395
|
+
label: "first-by-time",
|
|
396
|
+
};
|
|
397
|
+
const input: Array<TimeSegment & { label: string }> = [first, second];
|
|
398
|
+
const snapshot: string = JSON.stringify(input);
|
|
399
|
+
|
|
400
|
+
const normalized: Array<TimeSegment & { label: string }> =
|
|
401
|
+
ShiftSeamUtil.normalizeSeams(input);
|
|
402
|
+
|
|
403
|
+
expect(JSON.stringify(input)).toBe(snapshot);
|
|
404
|
+
expect(normalized).not.toBe(input);
|
|
405
|
+
expect(normalized[0]!.label).toBe("first-by-time");
|
|
406
|
+
expect(normalized[1]!.label).toBe("second-by-time");
|
|
407
|
+
expect(normalized[0]!.start).not.toBe(second.start);
|
|
408
|
+
expect(normalized[0]!.start.toISOString()).toBe("2026-03-02T09:00:00.000Z");
|
|
409
|
+
expect(normalized[0]!.end.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
410
|
+
expect(normalized[1]!.start.toISOString()).toBe("2026-03-02T12:00:00.000Z");
|
|
411
|
+
expect(normalized[1]!.end.toISOString()).toBe("2026-03-02T14:00:00.000Z");
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test("an empty input yields an empty output", () => {
|
|
415
|
+
expect(ShiftSeamUtil.normalizeSeams([])).toEqual([]);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
import LogsHistogram from "../../../UI/Components/LogsViewer/components/LogsHistogram";
|
|
4
4
|
import { HistogramBucket } from "../../../UI/Components/LogsViewer/types";
|
|
5
5
|
import LogSeverity from "../../../Types/Log/LogSeverity";
|
|
6
|
+
import OneUptimeDate from "../../../Types/Date";
|
|
6
7
|
import { render, screen } from "@testing-library/react";
|
|
7
8
|
import React from "react";
|
|
8
|
-
import { describe, expect, test } from "@jest/globals";
|
|
9
|
+
import { afterEach, describe, expect, test } from "@jest/globals";
|
|
9
10
|
|
|
10
11
|
/*
|
|
11
12
|
* ResponsiveContainer measures its parent, which is always 0x0 in jsdom, so the
|
|
@@ -39,7 +40,27 @@ function seriesCount(container: HTMLElement): number {
|
|
|
39
40
|
return container.querySelectorAll(".recharts-bar").length;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
/*
|
|
44
|
+
* Matches a tick on either clock. The axis follows the machine's 12/24-hour
|
|
45
|
+
* preference now, so a pattern that only knew "HH:mm" would quietly classify
|
|
46
|
+
* every tick as a count label on an AM/PM machine and leave the assertions
|
|
47
|
+
* below comparing empty arrays.
|
|
48
|
+
*/
|
|
49
|
+
const CLOCK_LABEL: RegExp = /^\d{1,2}:\d{2}( [AP]M)?$/;
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* The tick labels are the machine's business, not the test's, so every case
|
|
53
|
+
* that reads them says which clock it is asking about.
|
|
54
|
+
*/
|
|
55
|
+
function pinClock(use12HourFormat: boolean): void {
|
|
56
|
+
jest
|
|
57
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
58
|
+
.mockReturnValue(use12HourFormat);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
afterEach(() => {
|
|
62
|
+
jest.restoreAllMocks();
|
|
63
|
+
});
|
|
43
64
|
|
|
44
65
|
/*
|
|
45
66
|
* Recharts portals tick labels out of their axis group, so the two axes are
|
|
@@ -126,6 +147,8 @@ describe("LogsHistogram", () => {
|
|
|
126
147
|
});
|
|
127
148
|
|
|
128
149
|
test("labels the time axis in the reader's clock", () => {
|
|
150
|
+
pinClock(false);
|
|
151
|
+
|
|
129
152
|
const { container } = render(
|
|
130
153
|
<LogsHistogram buckets={ONE_SEVERITY} isLoading={false} />,
|
|
131
154
|
);
|
|
@@ -133,6 +156,20 @@ describe("LogsHistogram", () => {
|
|
|
133
156
|
expect(axisLabels(container, "time")).toContain("12:00");
|
|
134
157
|
});
|
|
135
158
|
|
|
159
|
+
/*
|
|
160
|
+
* Noon is where the two clocks are hardest to tell apart - "12:00" is a
|
|
161
|
+
* valid reading on both - so the marker is the whole assertion.
|
|
162
|
+
*/
|
|
163
|
+
test("labels the time axis with AM/PM when that is the reader's clock", () => {
|
|
164
|
+
pinClock(true);
|
|
165
|
+
|
|
166
|
+
const { container } = render(
|
|
167
|
+
<LogsHistogram buckets={ONE_SEVERITY} isLoading={false} />,
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
expect(axisLabels(container, "time")).toContain("12:00 PM");
|
|
171
|
+
});
|
|
172
|
+
|
|
136
173
|
test("lists only the severities present in the window", () => {
|
|
137
174
|
render(
|
|
138
175
|
<LogsHistogram
|
|
@@ -176,6 +213,8 @@ describe("LogsHistogram", () => {
|
|
|
176
213
|
});
|
|
177
214
|
|
|
178
215
|
test("follows the window as it slides off the oldest bucket", () => {
|
|
216
|
+
pinClock(false);
|
|
217
|
+
|
|
179
218
|
const view: ReturnType<typeof render> = render(
|
|
180
219
|
<LogsHistogram buckets={ONE_SEVERITY} isLoading={false} />,
|
|
181
220
|
);
|