@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,518 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compact "Mar 1, 2:30 PM" label the metrics / traces / logs time range
|
|
3
|
+
* picker puts on its button once a custom window is applied.
|
|
4
|
+
*
|
|
5
|
+
* The bug these lock in: the picker read the digits straight off the Date
|
|
6
|
+
* (`date.getHours().padStart(2, "0")`), so the label was always on a 24-hour
|
|
7
|
+
* clock and always in whatever zone the browser process happened to be in. A
|
|
8
|
+
* user whose computer is set to AM/PM picked "1 Mar, 2:30 PM" and got back a
|
|
9
|
+
* button reading "Mar 1, 14:30" — and a user who had set a different timezone
|
|
10
|
+
* in User Settings got a label that disagreed with every other date on screen.
|
|
11
|
+
*
|
|
12
|
+
* Every case here pins the timezone explicitly and passes `use12HourFormat`
|
|
13
|
+
* rather than letting the host machine decide, so the assertions hold under
|
|
14
|
+
* whatever TZ and locale the suite runs in. Detection of the machine's own
|
|
15
|
+
* preference is covered separately in DateUserPrefers12HourFormat.test.ts.
|
|
16
|
+
*/
|
|
17
|
+
import OneUptimeDate from "../../Types/Date";
|
|
18
|
+
import Timezone from "../../Types/Timezone";
|
|
19
|
+
import moment from "moment-timezone";
|
|
20
|
+
import {
|
|
21
|
+
afterEach,
|
|
22
|
+
beforeEach,
|
|
23
|
+
describe,
|
|
24
|
+
expect,
|
|
25
|
+
it,
|
|
26
|
+
jest,
|
|
27
|
+
} from "@jest/globals";
|
|
28
|
+
|
|
29
|
+
const UTC: Timezone = Timezone.UTC;
|
|
30
|
+
const NEW_YORK: Timezone = Timezone.AmericaNew_York;
|
|
31
|
+
const KOLKATA: Timezone = Timezone.AsiaKolkata;
|
|
32
|
+
|
|
33
|
+
type FormatFunction = (
|
|
34
|
+
isoString: string,
|
|
35
|
+
options?: {
|
|
36
|
+
use12HourFormat?: boolean | undefined;
|
|
37
|
+
includeSeconds?: boolean | undefined;
|
|
38
|
+
},
|
|
39
|
+
) => string;
|
|
40
|
+
|
|
41
|
+
const format: FormatFunction = (
|
|
42
|
+
isoString: string,
|
|
43
|
+
options?: {
|
|
44
|
+
use12HourFormat?: boolean | undefined;
|
|
45
|
+
includeSeconds?: boolean | undefined;
|
|
46
|
+
},
|
|
47
|
+
): string => {
|
|
48
|
+
return OneUptimeDate.getDateAsLocalShortDateTimeString(
|
|
49
|
+
new Date(isoString),
|
|
50
|
+
options,
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe("OneUptimeDate.getDateAsLocalShortDateTimeString", () => {
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
// Never leak a pinned zone or a mocked preference into the rest of the suite.
|
|
57
|
+
OneUptimeDate.setUserTimezone(null);
|
|
58
|
+
jest.restoreAllMocks();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe("12-hour clock", () => {
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("writes an afternoon time with a PM marker", () => {
|
|
67
|
+
expect(
|
|
68
|
+
format("2024-03-01T14:30:00.000Z", { use12HourFormat: true }),
|
|
69
|
+
).toBe("Mar 1, 2:30 PM");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("writes a morning time with an AM marker", () => {
|
|
73
|
+
expect(
|
|
74
|
+
format("2024-03-01T09:05:00.000Z", { use12HourFormat: true }),
|
|
75
|
+
).toBe("Mar 1, 9:05 AM");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("writes midnight as 12 AM rather than 0 AM", () => {
|
|
79
|
+
expect(
|
|
80
|
+
format("2024-03-01T00:00:00.000Z", { use12HourFormat: true }),
|
|
81
|
+
).toBe("Mar 1, 12:00 AM");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("keeps the minute after midnight in the AM half", () => {
|
|
85
|
+
expect(
|
|
86
|
+
format("2024-03-01T00:01:00.000Z", { use12HourFormat: true }),
|
|
87
|
+
).toBe("Mar 1, 12:01 AM");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("writes noon as 12 PM rather than 0 PM", () => {
|
|
91
|
+
expect(
|
|
92
|
+
format("2024-03-01T12:00:00.000Z", { use12HourFormat: true }),
|
|
93
|
+
).toBe("Mar 1, 12:00 PM");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("keeps the last minute before 1 PM in the 12 PM hour", () => {
|
|
97
|
+
expect(
|
|
98
|
+
format("2024-03-01T12:59:00.000Z", { use12HourFormat: true }),
|
|
99
|
+
).toBe("Mar 1, 12:59 PM");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("rolls 13:00 over to 1 PM", () => {
|
|
103
|
+
expect(
|
|
104
|
+
format("2024-03-01T13:00:00.000Z", { use12HourFormat: true }),
|
|
105
|
+
).toBe("Mar 1, 1:00 PM");
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("writes the last minute of the day as 11:59 PM", () => {
|
|
109
|
+
expect(
|
|
110
|
+
format("2024-03-01T23:59:00.000Z", { use12HourFormat: true }),
|
|
111
|
+
).toBe("Mar 1, 11:59 PM");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("leaves a single-digit hour unpadded", () => {
|
|
115
|
+
/*
|
|
116
|
+
* "09:05 AM" is not how a 12-hour clock is written; the padding only
|
|
117
|
+
* belongs on the 24-hour form, where it keeps the column aligned.
|
|
118
|
+
*/
|
|
119
|
+
const label: string = format("2024-03-01T09:05:00.000Z", {
|
|
120
|
+
use12HourFormat: true,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
expect(label).toBe("Mar 1, 9:05 AM");
|
|
124
|
+
expect(label).not.toContain("09:05");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("covers every hour of the day with an AM or PM marker", () => {
|
|
128
|
+
const markers: Array<string> = [];
|
|
129
|
+
|
|
130
|
+
for (let hour: number = 0; hour < 24; hour++) {
|
|
131
|
+
const isoHour: string = hour.toString().padStart(2, "0");
|
|
132
|
+
const label: string = format(`2024-03-01T${isoHour}:00:00.000Z`, {
|
|
133
|
+
use12HourFormat: true,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
expect(label).toMatch(/^Mar 1, (1[0-2]|[1-9]):00 (AM|PM)$/);
|
|
137
|
+
markers.push(label.slice(-2));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Twelve of each, and never a bare 24-hour reading.
|
|
141
|
+
expect(
|
|
142
|
+
markers.filter((marker: string) => {
|
|
143
|
+
return marker === "AM";
|
|
144
|
+
}),
|
|
145
|
+
).toHaveLength(12);
|
|
146
|
+
expect(
|
|
147
|
+
markers.filter((marker: string) => {
|
|
148
|
+
return marker === "PM";
|
|
149
|
+
}),
|
|
150
|
+
).toHaveLength(12);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe("24-hour clock", () => {
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("writes an afternoon time on the 24-hour clock with no marker", () => {
|
|
160
|
+
const label: string = format("2024-03-01T14:30:00.000Z", {
|
|
161
|
+
use12HourFormat: false,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
expect(label).toBe("Mar 1, 14:30");
|
|
165
|
+
expect(label).not.toMatch(/AM|PM/);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("pads a single-digit hour", () => {
|
|
169
|
+
expect(
|
|
170
|
+
format("2024-03-01T09:05:00.000Z", { use12HourFormat: false }),
|
|
171
|
+
).toBe("Mar 1, 09:05");
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it("writes midnight as 00:00", () => {
|
|
175
|
+
expect(
|
|
176
|
+
format("2024-03-01T00:00:00.000Z", { use12HourFormat: false }),
|
|
177
|
+
).toBe("Mar 1, 00:00");
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("writes noon as 12:00", () => {
|
|
181
|
+
expect(
|
|
182
|
+
format("2024-03-01T12:00:00.000Z", { use12HourFormat: false }),
|
|
183
|
+
).toBe("Mar 1, 12:00");
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it("writes the last minute of the day as 23:59", () => {
|
|
187
|
+
expect(
|
|
188
|
+
format("2024-03-01T23:59:00.000Z", { use12HourFormat: false }),
|
|
189
|
+
).toBe("Mar 1, 23:59");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("never emits a day period on any hour of the day", () => {
|
|
193
|
+
for (let hour: number = 0; hour < 24; hour++) {
|
|
194
|
+
const isoHour: string = hour.toString().padStart(2, "0");
|
|
195
|
+
const label: string = format(`2024-03-01T${isoHour}:00:00.000Z`, {
|
|
196
|
+
use12HourFormat: false,
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
expect(label).toBe(`Mar 1, ${isoHour}:00`);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
describe("seconds", () => {
|
|
205
|
+
beforeEach(() => {
|
|
206
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it("is omitted by default", () => {
|
|
210
|
+
expect(
|
|
211
|
+
format("2024-03-01T14:30:45.000Z", { use12HourFormat: false }),
|
|
212
|
+
).toBe("Mar 1, 14:30");
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it("sits before the day period on a 12-hour clock", () => {
|
|
216
|
+
expect(
|
|
217
|
+
format("2024-03-01T14:30:45.000Z", {
|
|
218
|
+
use12HourFormat: true,
|
|
219
|
+
includeSeconds: true,
|
|
220
|
+
}),
|
|
221
|
+
).toBe("Mar 1, 2:30:45 PM");
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("is appended to a 24-hour clock", () => {
|
|
225
|
+
expect(
|
|
226
|
+
format("2024-03-01T14:30:45.000Z", {
|
|
227
|
+
use12HourFormat: false,
|
|
228
|
+
includeSeconds: true,
|
|
229
|
+
}),
|
|
230
|
+
).toBe("Mar 1, 14:30:45");
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("pads a single-digit second", () => {
|
|
234
|
+
expect(
|
|
235
|
+
format("2024-03-01T14:30:05.000Z", {
|
|
236
|
+
use12HourFormat: false,
|
|
237
|
+
includeSeconds: true,
|
|
238
|
+
}),
|
|
239
|
+
).toBe("Mar 1, 14:30:05");
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
describe("the date half", () => {
|
|
244
|
+
beforeEach(() => {
|
|
245
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it("leaves the day of the month unpadded", () => {
|
|
249
|
+
expect(
|
|
250
|
+
format("2024-03-01T14:30:00.000Z", { use12HourFormat: false }),
|
|
251
|
+
).toBe("Mar 1, 14:30");
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("writes a two-digit day as-is", () => {
|
|
255
|
+
expect(
|
|
256
|
+
format("2024-03-21T14:30:00.000Z", { use12HourFormat: false }),
|
|
257
|
+
).toBe("Mar 21, 14:30");
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("abbreviates every month", () => {
|
|
261
|
+
const months: Array<string> = [];
|
|
262
|
+
|
|
263
|
+
for (let month: number = 1; month <= 12; month++) {
|
|
264
|
+
const isoMonth: string = month.toString().padStart(2, "0");
|
|
265
|
+
months.push(
|
|
266
|
+
format(`2024-${isoMonth}-15T12:00:00.000Z`, {
|
|
267
|
+
use12HourFormat: false,
|
|
268
|
+
}),
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
expect(months).toEqual([
|
|
273
|
+
"Jan 15, 12:00",
|
|
274
|
+
"Feb 15, 12:00",
|
|
275
|
+
"Mar 15, 12:00",
|
|
276
|
+
"Apr 15, 12:00",
|
|
277
|
+
"May 15, 12:00",
|
|
278
|
+
"Jun 15, 12:00",
|
|
279
|
+
"Jul 15, 12:00",
|
|
280
|
+
"Aug 15, 12:00",
|
|
281
|
+
"Sep 15, 12:00",
|
|
282
|
+
"Oct 15, 12:00",
|
|
283
|
+
"Nov 15, 12:00",
|
|
284
|
+
"Dec 15, 12:00",
|
|
285
|
+
]);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it("carries no year, which is what keeps the label short", () => {
|
|
289
|
+
expect(
|
|
290
|
+
format("2024-03-01T14:30:00.000Z", { use12HourFormat: false }),
|
|
291
|
+
).not.toMatch(/2024/);
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
describe("timezone", () => {
|
|
296
|
+
it("reads the wall clock in the timezone the user configured", () => {
|
|
297
|
+
OneUptimeDate.setUserTimezone(NEW_YORK);
|
|
298
|
+
|
|
299
|
+
// 02:30 UTC on 1 Mar is 21:30 the previous evening in New York (EST).
|
|
300
|
+
expect(
|
|
301
|
+
format("2024-03-01T02:30:00.000Z", { use12HourFormat: true }),
|
|
302
|
+
).toBe("Feb 29, 9:30 PM");
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it("moves the date as well as the time when the zone crosses midnight", () => {
|
|
306
|
+
OneUptimeDate.setUserTimezone(KOLKATA);
|
|
307
|
+
|
|
308
|
+
// 20:00 UTC is 01:30 the next morning at +05:30.
|
|
309
|
+
expect(
|
|
310
|
+
format("2024-03-01T20:00:00.000Z", { use12HourFormat: true }),
|
|
311
|
+
).toBe("Mar 2, 1:30 AM");
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it("gives a different label for the same instant in a different zone", () => {
|
|
315
|
+
const instant: string = "2024-03-01T20:00:00.000Z";
|
|
316
|
+
|
|
317
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
318
|
+
const inUtc: string = format(instant, { use12HourFormat: false });
|
|
319
|
+
|
|
320
|
+
OneUptimeDate.setUserTimezone(KOLKATA);
|
|
321
|
+
const inKolkata: string = format(instant, { use12HourFormat: false });
|
|
322
|
+
|
|
323
|
+
expect(inUtc).toBe("Mar 1, 20:00");
|
|
324
|
+
expect(inKolkata).toBe("Mar 2, 01:30");
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("follows a zone change without the instant moving", () => {
|
|
328
|
+
const instant: Date = new Date("2024-07-04T16:00:00.000Z");
|
|
329
|
+
|
|
330
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
331
|
+
expect(
|
|
332
|
+
OneUptimeDate.getDateAsLocalShortDateTimeString(instant, {
|
|
333
|
+
use12HourFormat: true,
|
|
334
|
+
}),
|
|
335
|
+
).toBe("Jul 4, 4:00 PM");
|
|
336
|
+
|
|
337
|
+
OneUptimeDate.setUserTimezone(NEW_YORK);
|
|
338
|
+
expect(
|
|
339
|
+
OneUptimeDate.getDateAsLocalShortDateTimeString(instant, {
|
|
340
|
+
use12HourFormat: true,
|
|
341
|
+
}),
|
|
342
|
+
).toBe("Jul 4, 12:00 PM");
|
|
343
|
+
|
|
344
|
+
// The Date itself was never mutated.
|
|
345
|
+
expect(instant.toISOString()).toBe("2024-07-04T16:00:00.000Z");
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it("falls back to the zone the browser reports when none is configured", () => {
|
|
349
|
+
OneUptimeDate.setUserTimezone(null);
|
|
350
|
+
|
|
351
|
+
/*
|
|
352
|
+
* The digits depend on the zone the suite runs under, so derive the
|
|
353
|
+
* expectation the same way - anchored to moment.tz.guess() rather than
|
|
354
|
+
* to a literal. A shape-only regex would have accepted a hardcoded UTC,
|
|
355
|
+
* which is the mistake this guards.
|
|
356
|
+
*/
|
|
357
|
+
const instant: string = "2024-03-01T14:30:00.000Z";
|
|
358
|
+
const expected: string = moment(new Date(instant))
|
|
359
|
+
.tz(moment.tz.guess())
|
|
360
|
+
.format("MMM D, HH:mm");
|
|
361
|
+
|
|
362
|
+
expect(format(instant, { use12HourFormat: false })).toBe(expected);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it("does not silently render in UTC when no zone is configured", () => {
|
|
366
|
+
/*
|
|
367
|
+
* Pin the fallback against the specific wrong answer: hardcoding UTC
|
|
368
|
+
* passes every other case in this file, because they all set a zone.
|
|
369
|
+
*/
|
|
370
|
+
OneUptimeDate.setUserTimezone(null);
|
|
371
|
+
|
|
372
|
+
const instant: string = "2024-03-01T14:30:00.000Z";
|
|
373
|
+
const inUtc: string = moment(new Date(instant))
|
|
374
|
+
.tz("UTC")
|
|
375
|
+
.format("MMM D, HH:mm");
|
|
376
|
+
const inGuessedZone: string = moment(new Date(instant))
|
|
377
|
+
.tz(moment.tz.guess())
|
|
378
|
+
.format("MMM D, HH:mm");
|
|
379
|
+
|
|
380
|
+
if (inGuessedZone === inUtc) {
|
|
381
|
+
/*
|
|
382
|
+
* The suite is running on a zone that agrees with UTC at this instant,
|
|
383
|
+
* so it cannot tell the two apart. Assert against a zone that never
|
|
384
|
+
* does instead.
|
|
385
|
+
*/
|
|
386
|
+
OneUptimeDate.setUserTimezone(KOLKATA);
|
|
387
|
+
expect(format(instant, { use12HourFormat: false })).not.toBe(inUtc);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
expect(format(instant, { use12HourFormat: false })).toBe(inGuessedZone);
|
|
392
|
+
expect(format(instant, { use12HourFormat: false })).not.toBe(inUtc);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
describe("daylight saving", () => {
|
|
397
|
+
beforeEach(() => {
|
|
398
|
+
OneUptimeDate.setUserTimezone(NEW_YORK);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it("reads the minute before a spring-forward jump on standard time", () => {
|
|
402
|
+
expect(
|
|
403
|
+
format("2024-03-10T06:59:00.000Z", { use12HourFormat: true }),
|
|
404
|
+
).toBe("Mar 10, 1:59 AM");
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it("skips the hour that does not exist on the spring-forward day", () => {
|
|
408
|
+
// 07:00 UTC is 03:00 EDT - 02:00 never happens in New York that day.
|
|
409
|
+
expect(
|
|
410
|
+
format("2024-03-10T07:00:00.000Z", { use12HourFormat: true }),
|
|
411
|
+
).toBe("Mar 10, 3:00 AM");
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it("writes both halves of the repeated fall-back hour on the same clock", () => {
|
|
415
|
+
/*
|
|
416
|
+
* 05:00 and 06:00 UTC are two different instants that both read 01:00 in
|
|
417
|
+
* New York on the day the clocks go back. Both are correct - the label is
|
|
418
|
+
* a wall clock, and this pins that it does not silently offset one.
|
|
419
|
+
*/
|
|
420
|
+
expect(
|
|
421
|
+
format("2024-11-03T05:00:00.000Z", { use12HourFormat: true }),
|
|
422
|
+
).toBe("Nov 3, 1:00 AM");
|
|
423
|
+
expect(
|
|
424
|
+
format("2024-11-03T06:00:00.000Z", { use12HourFormat: true }),
|
|
425
|
+
).toBe("Nov 3, 1:00 AM");
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
describe("input handling", () => {
|
|
430
|
+
beforeEach(() => {
|
|
431
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it("accepts an ISO string as well as a Date", () => {
|
|
435
|
+
expect(
|
|
436
|
+
OneUptimeDate.getDateAsLocalShortDateTimeString(
|
|
437
|
+
"2024-03-01T14:30:00.000Z",
|
|
438
|
+
{ use12HourFormat: true },
|
|
439
|
+
),
|
|
440
|
+
).toBe("Mar 1, 2:30 PM");
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
it("gives the same answer for a Date and its ISO string", () => {
|
|
444
|
+
const instant: Date = new Date("2024-03-01T14:30:00.000Z");
|
|
445
|
+
|
|
446
|
+
expect(
|
|
447
|
+
OneUptimeDate.getDateAsLocalShortDateTimeString(instant, {
|
|
448
|
+
use12HourFormat: true,
|
|
449
|
+
}),
|
|
450
|
+
).toBe(
|
|
451
|
+
OneUptimeDate.getDateAsLocalShortDateTimeString(instant.toISOString(), {
|
|
452
|
+
use12HourFormat: true,
|
|
453
|
+
}),
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
describe("defaulting to the machine's preference", () => {
|
|
459
|
+
beforeEach(() => {
|
|
460
|
+
OneUptimeDate.setUserTimezone(UTC);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it("uses a 12-hour clock when the machine is on one", () => {
|
|
464
|
+
jest
|
|
465
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
466
|
+
.mockReturnValue(true);
|
|
467
|
+
|
|
468
|
+
expect(format("2024-03-01T14:30:00.000Z")).toBe("Mar 1, 2:30 PM");
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
it("uses a 24-hour clock when the machine is on one", () => {
|
|
472
|
+
jest
|
|
473
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
474
|
+
.mockReturnValue(false);
|
|
475
|
+
|
|
476
|
+
expect(format("2024-03-01T14:30:00.000Z")).toBe("Mar 1, 14:30");
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
it("lets an explicit 24-hour caller override a 12-hour machine", () => {
|
|
480
|
+
jest
|
|
481
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
482
|
+
.mockReturnValue(true);
|
|
483
|
+
|
|
484
|
+
expect(
|
|
485
|
+
format("2024-03-01T14:30:00.000Z", { use12HourFormat: false }),
|
|
486
|
+
).toBe("Mar 1, 14:30");
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
it("lets an explicit 12-hour caller override a 24-hour machine", () => {
|
|
490
|
+
jest
|
|
491
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
492
|
+
.mockReturnValue(false);
|
|
493
|
+
|
|
494
|
+
expect(
|
|
495
|
+
format("2024-03-01T14:30:00.000Z", { use12HourFormat: true }),
|
|
496
|
+
).toBe("Mar 1, 2:30 PM");
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it("asks the machine once per call rather than caching an answer", () => {
|
|
500
|
+
/*
|
|
501
|
+
* The preference can change under a running tab - the user flips their
|
|
502
|
+
* OS clock setting and comes back. Nothing may hold a stale copy.
|
|
503
|
+
*/
|
|
504
|
+
jest
|
|
505
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
506
|
+
.mockReturnValue(false);
|
|
507
|
+
|
|
508
|
+
expect(format("2024-03-01T14:30:00.000Z")).toBe("Mar 1, 14:30");
|
|
509
|
+
|
|
510
|
+
// The same tab, after the user flips their OS clock setting.
|
|
511
|
+
jest
|
|
512
|
+
.spyOn(OneUptimeDate, "getUserPrefers12HourFormat")
|
|
513
|
+
.mockReturnValue(true);
|
|
514
|
+
|
|
515
|
+
expect(format("2024-03-01T14:30:00.000Z")).toBe("Mar 1, 2:30 PM");
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
});
|