@oneuptime/common 13.0.7 → 13.0.8
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/OnCallDutyPolicyScheduleCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/ProjectOnCallCalendarFeed.ts +1 -1
- package/Models/DatabaseModels/UserOnCallCalendarFeed.ts +1 -1
- package/Server/API/AIBillingAPI.ts +1 -0
- package/Server/API/AIInsightAPI.ts +1 -4
- package/Server/API/AIInvestigationAPI.ts +1 -4
- package/Server/API/AIReadinessAPI.ts +4 -5
- package/Server/API/AlertAPI.ts +1 -0
- package/Server/API/AutoRemediationAPI.ts +1 -4
- package/Server/API/BaseAPI.ts +13 -0
- package/Server/API/BaseAnalyticsAPI.ts +80 -9
- package/Server/API/BillingAPI.ts +2 -0
- package/Server/API/BillingInvoiceAPI.ts +1 -0
- package/Server/API/BillingPaymentMethodAPI.ts +2 -0
- package/Server/API/CodeFixRunAPI.ts +1 -3
- package/Server/API/CommonAPI.ts +68 -4
- package/Server/API/DashboardAPI.ts +12 -12
- package/Server/API/GlobalConfigAPI.ts +17 -0
- package/Server/API/IncidentAPI.ts +2 -0
- package/Server/API/IncidentEpisodeAPI.ts +1 -0
- package/Server/API/NotificationAPI.ts +1 -0
- package/Server/API/OnCallCalendarAPI.ts +4 -5
- package/Server/API/OnCallDutyPolicyAPI.ts +7 -0
- package/Server/API/OnCallReadinessAPI.ts +4 -1
- package/Server/API/OnCallScheduleTimelineAPI.ts +731 -0
- package/Server/API/ProjectAPI.ts +1 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +1 -0
- package/Server/API/StatusPageAPI.ts +161 -32
- package/Server/API/TeamMemberAPI.ts +3 -0
- package/Server/API/UserCallAPI.ts +2 -0
- package/Server/API/UserEmailAPI.ts +2 -0
- package/Server/API/UserIncomingCallNumberAPI.ts +2 -0
- package/Server/API/UserMicrosoftTeamsAPI.ts +1 -0
- package/Server/API/UserSlackAPI.ts +1 -0
- package/Server/API/UserSmsAPI.ts +2 -0
- package/Server/API/UserTotpAuthAPI.ts +1 -0
- package/Server/API/UserWebAuthnAPI.ts +2 -0
- package/Server/API/UserWebhookAPI.ts +1 -0
- package/Server/API/UserWhatsAppAPI.ts +2 -0
- package/Server/Middleware/MasterAdminAuthorization.ts +13 -2
- package/Server/Middleware/UserAuthorization.ts +79 -5
- package/Server/Services/ApiKeyPermissionService.ts +101 -4
- package/Server/Services/DatabaseService.ts +245 -0
- package/Server/Services/DetectionRuleService.ts +5 -4
- package/Server/Services/OnCallDutyPolicyChildService.ts +261 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +2 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +2 -2
- package/Server/Services/PayAsYouGoBillingService.ts +23 -28
- package/Server/Services/ProjectService.ts +18 -0
- package/Server/Services/RumSessionPinService.ts +274 -22
- package/Server/Services/TeamPermissionService.ts +120 -26
- package/Server/Services/ThreatIntelFeedService.ts +6 -3
- package/Server/Types/Database/Permissions/BasePermission.ts +9 -7
- package/Server/Types/Database/Permissions/Index.ts +75 -11
- package/Server/Types/Database/Permissions/TablePermission.ts +24 -28
- package/Server/Utils/AI/AIChatPrivacyFilter.ts +8 -0
- package/Server/Utils/AI/AIRunPrivacyFilter.ts +8 -0
- package/Server/Utils/MasterAdminPageAccess.ts +61 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +3 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +3 -1
- package/Server/Utils/OnCall/OnCallCalendarFeedRenderer.ts +1 -1
- package/Server/Utils/Realtime.ts +163 -45
- package/Server/Utils/SecurityEvent/DetectionRuleEvaluator.ts +11 -28
- package/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.ts +170 -0
- package/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.ts +1 -1
- package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.ts +6 -2
- package/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.ts +10 -9
- package/Tests/App/Dashboard/AffectedResourcesPicker.test.tsx +1059 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerEditForm.test.tsx +376 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerHiddenTypes.test.tsx +757 -0
- package/Tests/App/Dashboard/AffectedResourcesSummaryStep.test.tsx +307 -0
- package/Tests/App/Dashboard/ArgumentsFormGroupByUnlistedAttributes.test.tsx +131 -0
- package/Tests/App/Dashboard/DashboardHeaderRequests.test.tsx +1 -1
- package/Tests/App/Dashboard/DashboardMonitorLabelVariable.test.tsx +9 -1
- package/Tests/App/Dashboard/DashboardVariableAllContract.test.tsx +24 -0
- package/Tests/App/Dashboard/DashboardVariableSelector.test.tsx +162 -8
- package/Tests/App/Dashboard/EntityFilterDropdownArchivedSlos.test.tsx +105 -6
- package/Tests/App/Dashboard/EntityFilterDropdownUnlistedSelection.test.tsx +434 -0
- package/Tests/App/Dashboard/EscalationRuleReadiness.test.tsx +276 -1
- package/Tests/App/Dashboard/OnCallCalendarFeedSideMenus.test.tsx +9 -1
- package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +58 -42
- package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +42 -5
- package/Tests/App/Dashboard/ResourceAuditLogsSideMenus.test.tsx +34 -23
- package/Tests/App/Dashboard/ScheduleTimeline.test.tsx +1580 -0
- package/Tests/App/Dashboard/ScheduleTimelineAPI.test.ts +280 -0
- package/Tests/App/Dashboard/ScheduleTimelineModel.test.ts +673 -0
- package/Tests/App/Dashboard/SecurityEventConnectionDiagnostics.test.tsx +95 -68
- package/Tests/App/Dashboard/SecurityEventsDetectionRulesPage.test.tsx +86 -3
- package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +28 -3
- package/Tests/App/Dashboard/SecurityEventsExplorer.test.tsx +761 -0
- package/Tests/App/Dashboard/SecurityEventsGuideContent.test.ts +1313 -0
- package/Tests/App/Dashboard/SecurityEventsHowItWorksCard.test.tsx +536 -0
- package/Tests/App/Dashboard/SecurityEventsNoResults.test.tsx +222 -0
- package/Tests/App/Dashboard/SecurityEventsThreatIntelPage.test.tsx +199 -0
- package/Tests/App/Dashboard/SecurityEventsVolumeChart.test.tsx +321 -0
- package/Tests/App/Dashboard/SloOverviewHero.test.tsx +171 -36
- package/Tests/App/Dashboard/SloViewSideMenu.test.tsx +215 -0
- package/Tests/App/Dashboard/SloViewSideMenuCounts.test.tsx +40 -3
- package/Tests/App/PublicDashboard/DashboardVariableSelector.test.tsx +12 -4
- package/Tests/App/PublicDashboard/PublicDashboardWidgetListAuth.test.tsx +623 -0
- package/Tests/Models/OnCallCalendarFeedModels.test.ts +23 -1
- package/Tests/Server/API/AIChatRouteAuthorization.test.ts +138 -5
- package/Tests/Server/API/AIGenerationProjectAIToggle.test.ts +187 -0
- package/Tests/Server/API/AIInvestigationAvailabilityAuthorization.test.ts +51 -3
- package/Tests/Server/API/AIInvestigationEvidenceAPI.test.ts +55 -2
- package/Tests/Server/API/BaseAnalyticsAPIAggregateCache.test.ts +729 -0
- package/Tests/Server/API/BillingPayAsYouGoStatus.test.ts +93 -7
- package/Tests/Server/API/BillingPaymentMethodAPI.test.ts +36 -3
- package/Tests/Server/API/CommonAPIAuthGuard.test.ts +1003 -24
- package/Tests/Server/API/DashboardPublicRateLimit.test.ts +6 -3
- package/Tests/Server/API/ExpiredSessionAIRoutes.test.ts +708 -0
- package/Tests/Server/API/ExpiredSessionCustomRoutes.test.ts +928 -0
- package/Tests/Server/API/ExpiredSessionMonitorTemplate.test.ts +319 -0
- package/Tests/Server/API/ExpiredSessionOnCallDutyPolicy.test.ts +336 -0
- package/Tests/Server/API/ExpiredSessionRouteGuards.test.ts +820 -0
- package/Tests/Server/API/GlobalConfigLicense.test.ts +140 -0
- package/Tests/Server/API/NotificationChannelVerificationAPI.test.ts +115 -12
- package/Tests/Server/API/OnCallCalendarAPI.test.ts +375 -8
- package/Tests/Server/API/OnCallReadinessAPI.test.ts +175 -17
- package/Tests/Server/API/OnCallScheduleTimelineAPI.test.ts +1513 -0
- package/Tests/Server/API/OnCallSetupReminderAPI.test.ts +119 -7
- package/Tests/Server/API/ProjectScopedCustomRouteAuth.test.ts +111 -4
- package/Tests/Server/API/PublicRouteInvalidAccessToken.test.ts +615 -0
- package/Tests/Server/API/SecurityEventAttributesAPI.test.ts +89 -2
- package/Tests/Server/API/SessionReplayAPI.test.ts +121 -0
- package/Tests/Server/API/StatusPageMasterPasswordRateLimit.test.ts +4 -2
- package/Tests/Server/API/StatusPagePostmortemVisibility.test.ts +441 -0
- package/Tests/Server/API/StatusPageTestEmailReportAuth.test.ts +664 -0
- package/Tests/Server/API/TeamMemberRemoveUserFromProjectAPI.test.ts +7 -0
- package/Tests/Server/API/UserIncomingCallNumberApi.test.ts +6 -0
- package/Tests/Server/API/UserNotificationSettingAPI.test.ts +65 -4
- package/Tests/Server/API/UserProjectsAPI.test.ts +63 -3
- package/Tests/Server/API/UserTotpAuthAPI.test.ts +48 -2
- package/Tests/Server/API/UserWebAuthnAuthenticationOptionsRoute.test.ts +11 -2
- package/Tests/Server/API/UserWebAuthnBackupCodeMinting.test.ts +46 -3
- package/Tests/Server/API/UserWebAuthnPasskeyAPI.test.ts +18 -2
- package/Tests/Server/API/ZZVerifyChatsAuth.test.ts +24 -7
- package/Tests/Server/Middleware/ExpiredSessionUserMiddleware.test.ts +563 -0
- package/Tests/Server/Middleware/MasterAdminAuthorization.test.ts +299 -19
- package/Tests/Server/Middleware/PublicRouteUserMiddleware.test.ts +453 -0
- package/Tests/Server/Services/AIChatPrivacyPin.test.ts +24 -0
- package/Tests/Server/Services/ApiKeyPermissionSecurity.test.ts +2 -0
- package/Tests/Server/Services/ApiKeyPermissionService.test.ts +3 -3
- package/Tests/Server/Services/DatabaseServiceCreateSuppliedId.test.ts +147 -0
- package/Tests/Server/Services/DatabaseServiceLoginBeforeHooks.test.ts +1078 -0
- package/Tests/Server/Services/DatabaseServiceTenantRelationGuard.test.ts +259 -0
- package/Tests/Server/Services/DatabaseServiceWriteOperatorValues.test.ts +147 -0
- package/Tests/Server/Services/MonitorPayAsYouGoBilling.test.ts +115 -1
- package/Tests/Server/Services/OnCallChildCreateAuthorizationPostgres.test.ts +711 -0
- package/Tests/Server/Services/OnCallDutyPolicyChildService.test.ts +733 -0
- package/Tests/Server/Services/PayAsYouGoBillingService.test.ts +190 -140
- package/Tests/Server/Services/PayAsYouGoStripeRateLimitBudget.test.ts +4 -9
- package/Tests/Server/Services/PermissionBlockDeletion.test.ts +780 -0
- package/Tests/Server/Services/PermissionBlockDeletionPostgres.test.ts +628 -0
- package/Tests/Server/Services/ProjectServiceCreateSubscriptionStarted.test.ts +77 -1
- package/Tests/Server/Services/RumSessionPinCreatePermission.test.ts +715 -0
- package/Tests/Server/Services/TeamMemberMultiTenantReadPostgres.test.ts +394 -0
- package/Tests/Server/Services/TeamPrivilegeEscalation.test.ts +6 -0
- package/Tests/Server/Services/TelemetryPayAsYouGoBilling.test.ts +131 -0
- package/Tests/Server/Services/UserNotificationRuleAdminGuards.test.ts +13 -2
- package/Tests/Server/Types/Database/Permissions/ModelPermissionAnonymousRefusal.test.ts +518 -0
- package/Tests/Server/Types/Database/Permissions/MultiTenantPermissions.test.ts +350 -0
- package/Tests/Server/Types/Database/Permissions/OnCallCalendarFeedPermissions.test.ts +282 -25
- package/Tests/Server/Types/Database/Permissions/TableLevelBlockPermission.test.ts +459 -0
- package/Tests/Server/Utils/AI/AIRunPrivacyFilter.test.ts +101 -9
- package/Tests/Server/Utils/AI/ChatAgentHelpers.test.ts +88 -4
- package/Tests/Server/Utils/AI/Toolbox/ExceptionTools.test.ts +459 -0
- package/Tests/Server/Utils/AI/Toolbox/LogTools.test.ts +794 -0
- package/Tests/Server/Utils/AI/Toolbox/RecentChangesTools.test.ts +574 -0
- package/Tests/Server/Utils/AI/Toolbox/SecurityEventTools.test.ts +596 -0
- package/Tests/Server/Utils/CaptchaRequestAndLogging.test.ts +395 -0
- package/Tests/Server/Utils/MasterAdminPageAccess.test.ts +251 -0
- package/Tests/Server/Utils/Monitor/MonitorActionTimestamps.test.ts +616 -0
- package/Tests/Server/Utils/Realtime.test.ts +502 -0
- package/Tests/Server/Utils/SecurityEvent/Connectors/GoogleSecOps/GoogleSecOpsConnectorSeverity.test.ts +216 -0
- package/Tests/Server/Utils/SecurityEvent/DetectionRuleEvaluator.test.ts +142 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.test.ts +140 -0
- package/Tests/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepairClickhouseIntegration.test.ts +542 -0
- package/Tests/Server/Utils/Telemetry/ChangeEventRow.test.ts +743 -0
- package/Tests/Server/Utils/Telemetry/RuntimeMetrics.test.ts +465 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.test.ts +202 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/Incident.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/Messages/ScheduledMaintenance.test.ts +231 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/Alert.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/AlertEpisode.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/Incident.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.test.ts +194 -0
- package/Tests/Server/Utils/Workspace/Slack/Messages/ScheduledMaintenance.test.ts +247 -0
- package/Tests/Types/AI/AIInsightEvidence.test.ts +206 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtilAnonymous.test.ts +144 -0
- package/Tests/Types/Call/CallProvider.test.ts +528 -0
- package/Tests/Types/Kubernetes/KubernetesCostIngest.test.ts +236 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleTimeline.test.ts +736 -0
- package/Tests/Types/OnCallDutyPolicy/ScheduleTimelineLayout.test.ts +996 -0
- package/Tests/Types/SecurityEvent/SigmaRule.test.ts +142 -0
- package/Tests/Types/Workflow/Components/JSON.test.ts +182 -0
- package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +116 -1
- package/Tests/UI/Components/Dropdown/DropdownAsyncOptions.test.tsx +81 -0
- package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +89 -1
- package/Tests/UI/Components/EventAttachmentList.test.tsx +174 -0
- package/Tests/UI/Components/Forms/BasicFormBurnRateTemplateDefaults.test.tsx +395 -0
- package/Tests/UI/Components/Forms/BasicFormCollapsibleSections.test.tsx +286 -0
- package/Tests/UI/Components/Forms/FormSummary.test.tsx +128 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableQueryChange.test.tsx +365 -0
- package/Tests/UI/Components/OpenAuthenticatedUrl.test.ts +358 -0
- package/Tests/UI/Components/SessionAwareImage.test.tsx +496 -0
- package/Tests/UI/Components/TelemetryHistogramZeroBuckets.test.tsx +190 -0
- package/Tests/UI/Components/TooltipInteractive.test.tsx +97 -0
- package/Tests/UI/MicrosoftTeams/MicrosoftTeamsChatsCardInstallGuidance.test.tsx +1 -1
- package/Tests/UI/Monitor/EvaluationLogListTimestamps.test.tsx +367 -0
- package/Tests/UI/Utils/API/BaseAPIRefreshSession.test.ts +1087 -0
- package/Tests/UI/Utils/API/DashboardHost.ts +12 -0
- package/Tests/UI/Utils/API/FakeAxiosServer.ts +183 -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/Cookie.test.ts +440 -0
- package/Tests/UI/Utils/ModelAPIRequestClient.test.ts +278 -0
- package/Tests/UI/Utils/Navigation.test.ts +33 -0
- package/Tests/UI/Utils/PricingPlan.test.ts +295 -0
- package/Tests/UI/Utils/Realtime.test.ts +759 -0
- package/Tests/UI/Utils/Telemetry/Telemetry.test.ts +500 -0
- package/Tests/Utils/APIInstanceDispatch.test.ts +311 -0
- package/Tests/Utils/SecurityEvent/GoogleSecOpsAlertNormalizerSeverity.test.ts +565 -0
- package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.ts +40 -0
- package/Types/Monitor/MonitorEvaluationSummary.ts +3 -0
- package/Types/OnCallDutyPolicy/ScheduleTimeline.ts +507 -0
- package/Types/OnCallDutyPolicy/ScheduleTimelineLayout.ts +589 -0
- package/Types/Realtime/EventName.ts +11 -0
- package/Types/SecurityEvent/DetectionFindingConstants.ts +14 -0
- package/Types/SecurityEvent/OcsfSeverity.ts +31 -26
- package/Types/SecurityEvent/SigmaRule.ts +51 -0
- package/Types/SecurityEvent/ThreatIntelConstants.ts +18 -0
- package/UI/Components/AttachmentList/EventAttachmentList.tsx +30 -2
- package/UI/Components/Dashboard/DashboardVariableControl.tsx +12 -2
- package/UI/Components/Dropdown/Dropdown.tsx +6 -1
- package/UI/Components/EditionLabel/EditionLabel.tsx +12 -0
- package/UI/Components/EventItem/EventItem.tsx +12 -1
- package/UI/Components/Forms/BasicForm.tsx +151 -126
- package/UI/Components/Forms/CollapsibleFormSection.tsx +63 -0
- package/UI/Components/Forms/Fields/FormField.tsx +10 -4
- package/UI/Components/Forms/FormSummary.tsx +7 -0
- package/UI/Components/Forms/Types/Field.ts +10 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +2 -1
- package/UI/Components/Markdown.tsx/SessionAwareImage.tsx +122 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +34 -5
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +8 -1
- package/UI/Components/Tooltip/Tooltip.tsx +8 -1
- package/UI/Utils/API/API.ts +173 -12
- package/UI/Utils/API/RequestOptions.ts +11 -0
- package/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.ts +31 -7
- package/UI/Utils/ModelAPI/ModelAPI.ts +30 -9
- package/UI/Utils/Navigation.ts +9 -0
- package/UI/Utils/OpenAuthenticatedUrl.ts +154 -0
- package/UI/Utils/Realtime.ts +176 -30
- package/Utils/API.ts +14 -5
- package/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.ts +157 -7
- package/Utils/SecurityEvent/Sigma/SigmaRuleParser.ts +9 -17
- package/Utils/Slo/SloBurnRateTemplate.ts +2 -2
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/ProjectOnCallCalendarFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallCalendarFeed.js.map +1 -1
- package/build/dist/Server/API/AIBillingAPI.js +1 -1
- package/build/dist/Server/API/AIBillingAPI.js.map +1 -1
- package/build/dist/Server/API/AIInsightAPI.js +1 -4
- package/build/dist/Server/API/AIInsightAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +1 -4
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AIReadinessAPI.js +1 -3
- package/build/dist/Server/API/AIReadinessAPI.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +1 -1
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +1 -4
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +12 -0
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js +55 -10
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/BillingAPI.js +2 -2
- package/build/dist/Server/API/BillingAPI.js.map +1 -1
- package/build/dist/Server/API/BillingInvoiceAPI.js +1 -1
- package/build/dist/Server/API/BillingInvoiceAPI.js.map +1 -1
- package/build/dist/Server/API/BillingPaymentMethodAPI.js +2 -2
- package/build/dist/Server/API/BillingPaymentMethodAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +1 -3
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +50 -5
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +12 -12
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/GlobalConfigAPI.js +12 -0
- package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +2 -2
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/NotificationAPI.js +1 -1
- package/build/dist/Server/API/NotificationAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallCalendarAPI.js +1 -4
- package/build/dist/Server/API/OnCallCalendarAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallDutyPolicyAPI.js +6 -0
- package/build/dist/Server/API/OnCallDutyPolicyAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallReadinessAPI.js +4 -1
- package/build/dist/Server/API/OnCallReadinessAPI.js.map +1 -1
- package/build/dist/Server/API/OnCallScheduleTimelineAPI.js +494 -0
- package/build/dist/Server/API/OnCallScheduleTimelineAPI.js.map +1 -0
- package/build/dist/Server/API/ProjectAPI.js +1 -1
- package/build/dist/Server/API/ProjectAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +125 -33
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/TeamMemberAPI.js +3 -3
- package/build/dist/Server/API/TeamMemberAPI.js.map +1 -1
- package/build/dist/Server/API/UserCallAPI.js +2 -2
- package/build/dist/Server/API/UserCallAPI.js.map +1 -1
- package/build/dist/Server/API/UserEmailAPI.js +2 -2
- package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
- package/build/dist/Server/API/UserIncomingCallNumberAPI.js +2 -2
- package/build/dist/Server/API/UserIncomingCallNumberAPI.js.map +1 -1
- package/build/dist/Server/API/UserMicrosoftTeamsAPI.js +1 -1
- package/build/dist/Server/API/UserMicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/UserSlackAPI.js +1 -1
- package/build/dist/Server/API/UserSlackAPI.js.map +1 -1
- package/build/dist/Server/API/UserSmsAPI.js +2 -2
- package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
- package/build/dist/Server/API/UserTotpAuthAPI.js +1 -1
- package/build/dist/Server/API/UserTotpAuthAPI.js.map +1 -1
- package/build/dist/Server/API/UserWebAuthnAPI.js +2 -2
- package/build/dist/Server/API/UserWebAuthnAPI.js.map +1 -1
- package/build/dist/Server/API/UserWebhookAPI.js +1 -1
- package/build/dist/Server/API/UserWebhookAPI.js.map +1 -1
- package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
- package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js +11 -2
- package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +64 -4
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/ApiKeyPermissionService.js +80 -4
- package/build/dist/Server/Services/ApiKeyPermissionService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +171 -0
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DetectionRuleService.js +4 -4
- package/build/dist/Server/Services/DetectionRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyChildService.js +170 -0
- package/build/dist/Server/Services/OnCallDutyPolicyChildService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +2 -2
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/PayAsYouGoBillingService.js +20 -27
- package/build/dist/Server/Services/PayAsYouGoBillingService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +17 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/RumSessionPinService.js +180 -16
- package/build/dist/Server/Services/RumSessionPinService.js.map +1 -1
- package/build/dist/Server/Services/TeamPermissionService.js +89 -27
- package/build/dist/Server/Services/TeamPermissionService.js.map +1 -1
- package/build/dist/Server/Services/ThreatIntelFeedService.js +5 -4
- package/build/dist/Server/Services/ThreatIntelFeedService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js +9 -6
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/Index.js +60 -6
- package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TablePermission.js +14 -13
- package/build/dist/Server/Types/Database/Permissions/TablePermission.js.map +1 -1
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js +7 -0
- package/build/dist/Server/Utils/AI/AIChatPrivacyFilter.js.map +1 -1
- package/build/dist/Server/Utils/AI/AIRunPrivacyFilter.js +7 -0
- package/build/dist/Server/Utils/AI/AIRunPrivacyFilter.js.map +1 -1
- package/build/dist/Server/Utils/MasterAdminPageAccess.js +39 -0
- package/build/dist/Server/Utils/MasterAdminPageAccess.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +3 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Realtime.js +126 -37
- package/build/dist/Server/Utils/Realtime.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js +7 -25
- package/build/dist/Server/Utils/SecurityEvent/DetectionRuleEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.js +127 -0
- package/build/dist/Server/Utils/SecurityEvent/GoogleSecOpsSeverityRepair.js.map +1 -0
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js +1 -1
- package/build/dist/Server/Utils/SecurityEvent/Sigma/SigmaClickhouseCompiler.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js +3 -2
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelFeedPoller.js.map +1 -1
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js +4 -8
- package/build/dist/Server/Utils/SecurityEvent/ThreatIntel/ThreatIntelMatcher.js.map +1 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +31 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimeline.js +321 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimeline.js.map +1 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimelineLayout.js +372 -0
- package/build/dist/Types/OnCallDutyPolicy/ScheduleTimelineLayout.js.map +1 -0
- package/build/dist/Types/Realtime/EventName.js +10 -0
- package/build/dist/Types/Realtime/EventName.js.map +1 -1
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js +11 -0
- package/build/dist/Types/SecurityEvent/DetectionFindingConstants.js.map +1 -1
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js +30 -25
- package/build/dist/Types/SecurityEvent/OcsfSeverity.js.map +1 -1
- package/build/dist/Types/SecurityEvent/SigmaRule.js +47 -0
- package/build/dist/Types/SecurityEvent/SigmaRule.js.map +1 -1
- package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js +14 -0
- package/build/dist/Types/SecurityEvent/ThreatIntelConstants.js.map +1 -1
- package/build/dist/UI/Components/AttachmentList/EventAttachmentList.js +9 -4
- package/build/dist/UI/Components/AttachmentList/EventAttachmentList.js.map +1 -1
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js +10 -2
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +5 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js +11 -0
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
- package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +70 -64
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/CollapsibleFormSection.js +27 -0
- package/build/dist/UI/Components/Forms/CollapsibleFormSection.js.map +1 -0
- package/build/dist/UI/Components/Forms/Fields/FormField.js +10 -7
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/FormSummary.js +7 -0
- package/build/dist/UI/Components/Forms/FormSummary.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +2 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/SessionAwareImage.js +84 -0
- package/build/dist/UI/Components/Markdown.tsx/SessionAwareImage.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +14 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js +1 -1
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js +2 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
- package/build/dist/UI/Utils/API/API.js +143 -19
- package/build/dist/UI/Utils/API/API.js.map +1 -1
- package/build/dist/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.js +21 -7
- package/build/dist/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js +26 -9
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +8 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/OpenAuthenticatedUrl.js +92 -0
- package/build/dist/UI/Utils/OpenAuthenticatedUrl.js.map +1 -0
- package/build/dist/UI/Utils/Realtime.js +120 -15
- package/build/dist/UI/Utils/Realtime.js.map +1 -1
- package/build/dist/Utils/API.js +13 -5
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js +123 -6
- package/build/dist/Utils/SecurityEvent/GoogleSecOpsAlertNormalizer.js.map +1 -1
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js +4 -18
- package/build/dist/Utils/SecurityEvent/Sigma/SigmaRuleParser.js.map +1 -1
- package/build/dist/Utils/Slo/SloBurnRateTemplate.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import Monitor from "../../../../../Models/DatabaseModels/Monitor";
|
|
2
|
+
import MonitorStatusTimeline from "../../../../../Models/DatabaseModels/MonitorStatusTimeline";
|
|
3
|
+
import ScheduledMaintenance from "../../../../../Models/DatabaseModels/ScheduledMaintenance";
|
|
4
|
+
import TelemetryException from "../../../../../Models/DatabaseModels/TelemetryException";
|
|
5
|
+
import MonitorStatusTimelineService from "../../../../../Server/Services/MonitorStatusTimelineService";
|
|
6
|
+
import ScheduledMaintenanceService from "../../../../../Server/Services/ScheduledMaintenanceService";
|
|
7
|
+
import TelemetryExceptionService from "../../../../../Server/Services/TelemetryExceptionService";
|
|
8
|
+
import logger from "../../../../../Server/Utils/Logger";
|
|
9
|
+
import AIToolbox, {
|
|
10
|
+
ToolCallOutcome,
|
|
11
|
+
} from "../../../../../Server/Utils/AI/Toolbox/Index";
|
|
12
|
+
import { RecentChangesTool } from "../../../../../Server/Utils/AI/Toolbox/RecentChangesTools";
|
|
13
|
+
import {
|
|
14
|
+
ToolContext,
|
|
15
|
+
ToolExecutionResult,
|
|
16
|
+
} from "../../../../../Server/Utils/AI/Toolbox/ToolTypes";
|
|
17
|
+
import DatabaseCommonInteractionProps from "../../../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
18
|
+
import SortOrder from "../../../../../Types/BaseDatabase/SortOrder";
|
|
19
|
+
import OneUptimeDate from "../../../../../Types/Date";
|
|
20
|
+
import BadDataException from "../../../../../Types/Exception/BadDataException";
|
|
21
|
+
import { JSONObject } from "../../../../../Types/JSON";
|
|
22
|
+
import ObjectID from "../../../../../Types/ObjectID";
|
|
23
|
+
import Permission from "../../../../../Types/Permission";
|
|
24
|
+
import { afterEach, beforeEach, describe, expect, test } from "@jest/globals";
|
|
25
|
+
|
|
26
|
+
const projectId: ObjectID = new ObjectID(
|
|
27
|
+
"11111111-1111-1111-1111-111111111111",
|
|
28
|
+
);
|
|
29
|
+
const otherProjectId: ObjectID = new ObjectID(
|
|
30
|
+
"99999999-9999-9999-9999-999999999999",
|
|
31
|
+
);
|
|
32
|
+
const NOW: Date = new Date("2026-09-17T12:00:00.000Z");
|
|
33
|
+
const HOUR_MS: number = 60 * 60 * 1000;
|
|
34
|
+
|
|
35
|
+
interface RawOperator {
|
|
36
|
+
objectLiteralParameters: Record<string, unknown>;
|
|
37
|
+
getSql: (alias: string) => string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface SourceSpies {
|
|
41
|
+
exceptions: jest.SpyInstance;
|
|
42
|
+
statusChanges: jest.SpyInstance;
|
|
43
|
+
maintenance: jest.SpyInstance;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function context(
|
|
47
|
+
allowed: Array<Permission> = [Permission.ProjectMember],
|
|
48
|
+
blocked: Array<Permission> = [],
|
|
49
|
+
): ToolContext {
|
|
50
|
+
const toUserPermission: (
|
|
51
|
+
isBlock: boolean,
|
|
52
|
+
) => (permission: Permission) => JSONObject = (
|
|
53
|
+
isBlock: boolean,
|
|
54
|
+
): ((permission: Permission) => JSONObject) => {
|
|
55
|
+
return (permission: Permission): JSONObject => {
|
|
56
|
+
return {
|
|
57
|
+
permission: permission,
|
|
58
|
+
labelIds: [],
|
|
59
|
+
isBlockPermission: isBlock,
|
|
60
|
+
_type: "UserPermission",
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
projectId: projectId,
|
|
66
|
+
props: {
|
|
67
|
+
tenantId: projectId,
|
|
68
|
+
userId: ObjectID.generate(),
|
|
69
|
+
userGlobalAccessPermission: {
|
|
70
|
+
globalPermissions: [Permission.Public],
|
|
71
|
+
projectIds: [projectId],
|
|
72
|
+
_type: "UserGlobalAccessPermission",
|
|
73
|
+
},
|
|
74
|
+
userTenantAccessPermission: {
|
|
75
|
+
[projectId.toString()]: {
|
|
76
|
+
projectId: projectId,
|
|
77
|
+
permissions: [
|
|
78
|
+
...allowed.map(toUserPermission(false)),
|
|
79
|
+
...blocked.map(toUserPermission(true)),
|
|
80
|
+
],
|
|
81
|
+
_type: "UserTenantAccessPermission",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
} as unknown as DatabaseCommonInteractionProps,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function mockSources(data?: {
|
|
89
|
+
exceptions?: Array<JSONObject> | Error;
|
|
90
|
+
statusChanges?: Array<JSONObject> | Error;
|
|
91
|
+
maintenance?: Array<JSONObject> | Error;
|
|
92
|
+
}): SourceSpies {
|
|
93
|
+
const mock: (
|
|
94
|
+
spy: jest.SpyInstance,
|
|
95
|
+
value: Array<JSONObject> | Error | undefined,
|
|
96
|
+
) => jest.SpyInstance = (
|
|
97
|
+
spy: jest.SpyInstance,
|
|
98
|
+
value: Array<JSONObject> | Error | undefined,
|
|
99
|
+
): jest.SpyInstance => {
|
|
100
|
+
if (value instanceof Error) {
|
|
101
|
+
return spy.mockRejectedValue(value);
|
|
102
|
+
}
|
|
103
|
+
return spy.mockResolvedValue(value || []);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
exceptions: mock(
|
|
108
|
+
jest.spyOn(TelemetryExceptionService, "findBy"),
|
|
109
|
+
data?.exceptions,
|
|
110
|
+
),
|
|
111
|
+
statusChanges: mock(
|
|
112
|
+
jest.spyOn(MonitorStatusTimelineService, "findBy"),
|
|
113
|
+
data?.statusChanges,
|
|
114
|
+
),
|
|
115
|
+
maintenance: mock(
|
|
116
|
+
jest.spyOn(ScheduledMaintenanceService, "findBy"),
|
|
117
|
+
data?.maintenance,
|
|
118
|
+
),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function callArg(spy: jest.SpyInstance): JSONObject {
|
|
123
|
+
return spy.mock.calls[0]![0] as JSONObject;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function boundValues(operator: unknown): Array<unknown> {
|
|
127
|
+
return Object.values((operator as RawOperator).objectLiteralParameters);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function asException(data: JSONObject): JSONObject {
|
|
131
|
+
return data as unknown as TelemetryException as unknown as JSONObject;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function asStatusChange(data: JSONObject): JSONObject {
|
|
135
|
+
return data as unknown as MonitorStatusTimeline as unknown as JSONObject;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function asMaintenance(data: JSONObject): JSONObject {
|
|
139
|
+
return data as unknown as ScheduledMaintenance as unknown as JSONObject;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
beforeEach(() => {
|
|
143
|
+
jest.spyOn(OneUptimeDate, "getCurrentDate").mockReturnValue(NOW);
|
|
144
|
+
jest.spyOn(logger, "debug").mockImplementation(() => {
|
|
145
|
+
return undefined;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
afterEach(() => {
|
|
150
|
+
jest.restoreAllMocks();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe("recent_changes queries", () => {
|
|
154
|
+
test("queries every source under the caller's props with the default 24h window and 15-per-source limit", async () => {
|
|
155
|
+
const ctx: ToolContext = context();
|
|
156
|
+
const spies: SourceSpies = mockSources();
|
|
157
|
+
|
|
158
|
+
await RecentChangesTool.execute({}, ctx);
|
|
159
|
+
|
|
160
|
+
const start: Date = new Date(NOW.getTime() - 24 * HOUR_MS);
|
|
161
|
+
for (const spy of [
|
|
162
|
+
spies.exceptions,
|
|
163
|
+
spies.statusChanges,
|
|
164
|
+
spies.maintenance,
|
|
165
|
+
]) {
|
|
166
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
167
|
+
const call: JSONObject = callArg(spy);
|
|
168
|
+
expect(call["props"]).toBe(ctx.props);
|
|
169
|
+
expect(call["limit"]).toBe(15);
|
|
170
|
+
expect(call["skip"]).toBe(0);
|
|
171
|
+
const query: JSONObject = call["query"] as JSONObject;
|
|
172
|
+
expect(query["projectId"]).toBeUndefined();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// New exceptions: firstSeenAt inside [start, end].
|
|
176
|
+
const exceptionCall: JSONObject = callArg(spies.exceptions);
|
|
177
|
+
expect(exceptionCall["sort"]).toEqual({
|
|
178
|
+
firstSeenAt: SortOrder.Descending,
|
|
179
|
+
});
|
|
180
|
+
const exceptionQuery: JSONObject = exceptionCall["query"] as JSONObject;
|
|
181
|
+
expect(Object.keys(exceptionQuery)).toEqual(["firstSeenAt"]);
|
|
182
|
+
expect(boundValues(exceptionQuery["firstSeenAt"])).toEqual([start, NOW]);
|
|
183
|
+
|
|
184
|
+
// Monitor status changes: createdAt inside [start, end].
|
|
185
|
+
const statusCall: JSONObject = callArg(spies.statusChanges);
|
|
186
|
+
expect(statusCall["sort"]).toEqual({ createdAt: SortOrder.Descending });
|
|
187
|
+
expect(statusCall["select"]).toEqual({
|
|
188
|
+
createdAt: true,
|
|
189
|
+
monitor: { name: true },
|
|
190
|
+
monitorStatus: { name: true },
|
|
191
|
+
});
|
|
192
|
+
const statusQuery: JSONObject = statusCall["query"] as JSONObject;
|
|
193
|
+
expect(Object.keys(statusQuery)).toEqual(["createdAt"]);
|
|
194
|
+
expect(boundValues(statusQuery["createdAt"])).toEqual([start, NOW]);
|
|
195
|
+
|
|
196
|
+
// Maintenance overlapping the window: startsAt <= end AND endsAt >= start.
|
|
197
|
+
const maintenanceCall: JSONObject = callArg(spies.maintenance);
|
|
198
|
+
expect(maintenanceCall["sort"]).toEqual({
|
|
199
|
+
startsAt: SortOrder.Descending,
|
|
200
|
+
});
|
|
201
|
+
const maintenanceQuery: JSONObject = maintenanceCall["query"] as JSONObject;
|
|
202
|
+
expect(Object.keys(maintenanceQuery).sort()).toEqual([
|
|
203
|
+
"endsAt",
|
|
204
|
+
"startsAt",
|
|
205
|
+
]);
|
|
206
|
+
expect(boundValues(maintenanceQuery["startsAt"])).toEqual([NOW]);
|
|
207
|
+
expect(
|
|
208
|
+
(maintenanceQuery["startsAt"] as unknown as RawOperator).getSql("s"),
|
|
209
|
+
).toContain("<=");
|
|
210
|
+
expect(boundValues(maintenanceQuery["endsAt"])).toEqual([start]);
|
|
211
|
+
expect(
|
|
212
|
+
(maintenanceQuery["endsAt"] as unknown as RawOperator).getSql("e"),
|
|
213
|
+
).toContain(">=");
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("ignores project ids passed as arguments", async () => {
|
|
217
|
+
const ctx: ToolContext = context();
|
|
218
|
+
const spies: SourceSpies = mockSources();
|
|
219
|
+
|
|
220
|
+
await RecentChangesTool.execute(
|
|
221
|
+
{ projectId: otherProjectId.toString() },
|
|
222
|
+
ctx,
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
for (const spy of [
|
|
226
|
+
spies.exceptions,
|
|
227
|
+
spies.statusChanges,
|
|
228
|
+
spies.maintenance,
|
|
229
|
+
]) {
|
|
230
|
+
const call: JSONObject = callArg(spy);
|
|
231
|
+
expect(call["props"]).toBe(ctx.props);
|
|
232
|
+
expect((call["query"] as JSONObject)["projectId"]).toBeUndefined();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("uses an explicit window", async () => {
|
|
237
|
+
const spies: SourceSpies = mockSources();
|
|
238
|
+
const start: Date = new Date("2026-09-15T10:00:00.000Z");
|
|
239
|
+
const end: Date = new Date("2026-09-15T11:00:00.000Z");
|
|
240
|
+
|
|
241
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
242
|
+
{ startTime: start.toISOString(), endTime: end.toISOString() },
|
|
243
|
+
context(),
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
const query: JSONObject = callArg(spies.exceptions)["query"] as JSONObject;
|
|
247
|
+
expect(boundValues(query["firstSeenAt"])).toEqual([start, end]);
|
|
248
|
+
expect(result.citationLabel).toBe(
|
|
249
|
+
`Changes ${start.toISOString()} → ${end.toISOString()} (0 events)`,
|
|
250
|
+
);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test.each([
|
|
254
|
+
[100, 30],
|
|
255
|
+
[30, 30],
|
|
256
|
+
[0, 1],
|
|
257
|
+
[-1, 1],
|
|
258
|
+
["7", 7],
|
|
259
|
+
["many", 15],
|
|
260
|
+
])(
|
|
261
|
+
"clamps limitPerSource %p to %p for every source",
|
|
262
|
+
async (input: unknown, expected: number) => {
|
|
263
|
+
const spies: SourceSpies = mockSources();
|
|
264
|
+
|
|
265
|
+
await RecentChangesTool.execute(
|
|
266
|
+
{ limitPerSource: input } as unknown as JSONObject,
|
|
267
|
+
context(),
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
expect(callArg(spies.exceptions)["limit"]).toBe(expected);
|
|
271
|
+
expect(callArg(spies.statusChanges)["limit"]).toBe(expected);
|
|
272
|
+
expect(callArg(spies.maintenance)["limit"]).toBe(expected);
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
test("rejects an invalid window before touching any source", async () => {
|
|
277
|
+
const spies: SourceSpies = mockSources();
|
|
278
|
+
|
|
279
|
+
await expect(
|
|
280
|
+
RecentChangesTool.execute({ startTime: "an hour ago" }, context()),
|
|
281
|
+
).rejects.toThrow(BadDataException);
|
|
282
|
+
await expect(
|
|
283
|
+
RecentChangesTool.execute(
|
|
284
|
+
{
|
|
285
|
+
startTime: "2026-09-15T11:00:00.000Z",
|
|
286
|
+
endTime: "2026-09-15T10:00:00.000Z",
|
|
287
|
+
},
|
|
288
|
+
context(),
|
|
289
|
+
),
|
|
290
|
+
).rejects.toThrow("startTime must be before endTime.");
|
|
291
|
+
|
|
292
|
+
expect(spies.exceptions).not.toHaveBeenCalled();
|
|
293
|
+
expect(spies.statusChanges).not.toHaveBeenCalled();
|
|
294
|
+
expect(spies.maintenance).not.toHaveBeenCalled();
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
describe("recent_changes output", () => {
|
|
299
|
+
test("merges all sources into one feed, most recent first", async () => {
|
|
300
|
+
mockSources({
|
|
301
|
+
exceptions: [
|
|
302
|
+
asException({
|
|
303
|
+
exceptionType: "TypeError",
|
|
304
|
+
message: "x is undefined",
|
|
305
|
+
firstSeenAt: new Date("2026-09-17T10:00:00.000Z"),
|
|
306
|
+
occuranceCount: 12,
|
|
307
|
+
}),
|
|
308
|
+
],
|
|
309
|
+
statusChanges: [
|
|
310
|
+
asStatusChange({
|
|
311
|
+
createdAt: new Date("2026-09-17T11:00:00.000Z"),
|
|
312
|
+
monitor: { name: "Checkout API" },
|
|
313
|
+
monitorStatus: { name: "Offline" },
|
|
314
|
+
}),
|
|
315
|
+
asStatusChange({
|
|
316
|
+
createdAt: new Date("2026-09-17T09:00:00.000Z"),
|
|
317
|
+
monitor: { name: "Checkout API" },
|
|
318
|
+
monitorStatus: { name: "Operational" },
|
|
319
|
+
}),
|
|
320
|
+
],
|
|
321
|
+
maintenance: [
|
|
322
|
+
asMaintenance({
|
|
323
|
+
title: "DB upgrade",
|
|
324
|
+
startsAt: new Date("2026-09-17T09:30:00.000Z"),
|
|
325
|
+
endsAt: new Date("2026-09-17T13:00:00.000Z"),
|
|
326
|
+
currentScheduledMaintenanceState: { name: "Ongoing" },
|
|
327
|
+
}),
|
|
328
|
+
],
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
332
|
+
{},
|
|
333
|
+
context(),
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
expect(result.rowCount).toBe(4);
|
|
337
|
+
expect(result.dataForLlm.split("\n")).toEqual([
|
|
338
|
+
"- at=2026-09-17T11:00:00.000Z | change=monitor_status_change | detail=Checkout API → Offline",
|
|
339
|
+
"- at=2026-09-17T10:00:00.000Z | change=new_exception | detail=TypeError: x is undefined (x12)",
|
|
340
|
+
"- at=2026-09-17T09:30:00.000Z | change=scheduled_maintenance | detail=DB upgrade (Ongoing)",
|
|
341
|
+
"- at=2026-09-17T09:00:00.000Z | change=monitor_status_change | detail=Checkout API → Operational",
|
|
342
|
+
]);
|
|
343
|
+
expect(result.citationLabel).toBe(
|
|
344
|
+
`Changes ${new Date(NOW.getTime() - 24 * HOUR_MS).toISOString()} → ${NOW.toISOString()} (4 events)`,
|
|
345
|
+
);
|
|
346
|
+
expect(result.isTruncated).toBe(false);
|
|
347
|
+
// recent_changes deliberately has no single deep link.
|
|
348
|
+
expect(result.citationTarget).toBeUndefined();
|
|
349
|
+
expect(result.widget).toBeUndefined();
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test("maintenance that started before the window is still included (overlap semantics)", async () => {
|
|
353
|
+
mockSources({
|
|
354
|
+
maintenance: [
|
|
355
|
+
asMaintenance({
|
|
356
|
+
title: "Long migration",
|
|
357
|
+
startsAt: new Date("2026-09-01T00:00:00.000Z"),
|
|
358
|
+
endsAt: new Date("2026-09-30T00:00:00.000Z"),
|
|
359
|
+
}),
|
|
360
|
+
],
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
364
|
+
{},
|
|
365
|
+
context(),
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
expect(result.rowCount).toBe(1);
|
|
369
|
+
expect(result.dataForLlm).toBe(
|
|
370
|
+
"- at=2026-09-01T00:00:00.000Z | change=scheduled_maintenance | detail=Long migration (scheduled)",
|
|
371
|
+
);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
test("falls back to generic labels when optional fields are missing", async () => {
|
|
375
|
+
mockSources({
|
|
376
|
+
exceptions: [
|
|
377
|
+
asException({ firstSeenAt: new Date("2026-09-17T11:00:00.000Z") }),
|
|
378
|
+
],
|
|
379
|
+
statusChanges: [
|
|
380
|
+
asStatusChange({ createdAt: new Date("2026-09-17T10:00:00.000Z") }),
|
|
381
|
+
],
|
|
382
|
+
maintenance: [
|
|
383
|
+
asMaintenance({ startsAt: new Date("2026-09-17T09:00:00.000Z") }),
|
|
384
|
+
],
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
388
|
+
{},
|
|
389
|
+
context(),
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
expect(result.dataForLlm.split("\n")).toEqual([
|
|
393
|
+
"- at=2026-09-17T11:00:00.000Z | change=new_exception | detail=Exception: (x0)",
|
|
394
|
+
"- at=2026-09-17T10:00:00.000Z | change=monitor_status_change | detail=Monitor → unknown",
|
|
395
|
+
"- at=2026-09-17T09:00:00.000Z | change=scheduled_maintenance | detail=Maintenance (scheduled)",
|
|
396
|
+
]);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
test("skips entries without a timestamp instead of inventing one", async () => {
|
|
400
|
+
mockSources({
|
|
401
|
+
exceptions: [asException({ message: "no first seen" })],
|
|
402
|
+
statusChanges: [asStatusChange({ monitor: { name: "M" } })],
|
|
403
|
+
maintenance: [asMaintenance({ title: "unscheduled" })],
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
407
|
+
{},
|
|
408
|
+
context(),
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
expect(result.rowCount).toBe(0);
|
|
412
|
+
expect(result.dataForLlm).toBe("(no rows found)");
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
test("a failing source is skipped and logged; the others still return", async () => {
|
|
416
|
+
const spies: SourceSpies = mockSources({
|
|
417
|
+
exceptions: new Error("exceptions table unavailable"),
|
|
418
|
+
statusChanges: [
|
|
419
|
+
asStatusChange({
|
|
420
|
+
createdAt: new Date("2026-09-17T11:00:00.000Z"),
|
|
421
|
+
monitor: { name: "API" },
|
|
422
|
+
monitorStatus: { name: "Degraded" },
|
|
423
|
+
}),
|
|
424
|
+
],
|
|
425
|
+
maintenance: new Error("permission denied"),
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
429
|
+
{},
|
|
430
|
+
context(),
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
expect(spies.statusChanges).toHaveBeenCalledTimes(1);
|
|
434
|
+
expect(spies.maintenance).toHaveBeenCalledTimes(1);
|
|
435
|
+
expect(result.rowCount).toBe(1);
|
|
436
|
+
expect(result.dataForLlm).toContain("API → Degraded");
|
|
437
|
+
expect(logger.debug).toHaveBeenCalledWith(
|
|
438
|
+
expect.stringContaining("exceptions source skipped"),
|
|
439
|
+
);
|
|
440
|
+
expect(logger.debug).toHaveBeenCalledWith(
|
|
441
|
+
expect.stringContaining("maintenance source skipped"),
|
|
442
|
+
);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
test("all sources failing yields an empty feed rather than an error", async () => {
|
|
446
|
+
mockSources({
|
|
447
|
+
exceptions: new Error("a"),
|
|
448
|
+
statusChanges: new Error("b"),
|
|
449
|
+
maintenance: new Error("c"),
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
453
|
+
{},
|
|
454
|
+
context(),
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
expect(result.rowCount).toBe(0);
|
|
458
|
+
expect(result.dataForLlm).toBe("(no rows found)");
|
|
459
|
+
expect(logger.debug).toHaveBeenCalledTimes(3);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
test("redacts secrets surfacing in exception messages", async () => {
|
|
463
|
+
mockSources({
|
|
464
|
+
exceptions: [
|
|
465
|
+
asException({
|
|
466
|
+
exceptionType: "AuthError",
|
|
467
|
+
message: "token rejected for admin@example.com",
|
|
468
|
+
firstSeenAt: new Date("2026-09-17T11:00:00.000Z"),
|
|
469
|
+
occuranceCount: 1,
|
|
470
|
+
}),
|
|
471
|
+
],
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
475
|
+
{},
|
|
476
|
+
context(),
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
expect(result.dataForLlm).not.toContain("admin@example.com");
|
|
480
|
+
expect(result.dataForLlm).toContain("[redacted-email]");
|
|
481
|
+
expect(result.redactionCount).toBe(1);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
test("a full 3x30 feed is capped at the serializer's 50 rows and flagged as truncated", async () => {
|
|
485
|
+
const at: (minute: number) => Date = (minute: number): Date => {
|
|
486
|
+
return new Date(NOW.getTime() - minute * 60 * 1000);
|
|
487
|
+
};
|
|
488
|
+
const exceptions: Array<JSONObject> = [];
|
|
489
|
+
const statusChanges: Array<JSONObject> = [];
|
|
490
|
+
const maintenance: Array<JSONObject> = [];
|
|
491
|
+
for (let i: number = 0; i < 30; i++) {
|
|
492
|
+
exceptions.push(
|
|
493
|
+
asException({ message: `e${i}`, firstSeenAt: at(i * 3) }),
|
|
494
|
+
);
|
|
495
|
+
statusChanges.push(asStatusChange({ createdAt: at(i * 3 + 1) }));
|
|
496
|
+
maintenance.push(
|
|
497
|
+
asMaintenance({ title: `m${i}`, startsAt: at(i * 3 + 2) }),
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
mockSources({
|
|
501
|
+
exceptions: exceptions,
|
|
502
|
+
statusChanges: statusChanges,
|
|
503
|
+
maintenance: maintenance,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const result: ToolExecutionResult = await RecentChangesTool.execute(
|
|
507
|
+
{ limitPerSource: 30 },
|
|
508
|
+
context(),
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
expect(result.rowCount).toBe(90);
|
|
512
|
+
expect(result.isTruncated).toBe(true);
|
|
513
|
+
expect(result.dataForLlm).toContain("showing the first 50 of 90 rows");
|
|
514
|
+
// The most recent events are the ones kept.
|
|
515
|
+
expect(result.dataForLlm.split("\n")[0]).toContain(
|
|
516
|
+
`at=${NOW.toISOString()}`,
|
|
517
|
+
);
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
describe("recent_changes permission gate", () => {
|
|
522
|
+
test("requiredPermissions mirror the Monitor read ACL and are cached", () => {
|
|
523
|
+
const expected: Array<Permission> = new Monitor().getReadPermissions();
|
|
524
|
+
const first: Array<Permission> = RecentChangesTool.requiredPermissions;
|
|
525
|
+
expect(first).toEqual(expected);
|
|
526
|
+
expect(first.length).toBeGreaterThan(0);
|
|
527
|
+
expect(RecentChangesTool.requiredPermissions).toBe(first);
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
test("is registered in the toolbox as a read-only tool", () => {
|
|
531
|
+
expect(AIToolbox.getToolByName("recent_changes")).toBe(RecentChangesTool);
|
|
532
|
+
expect(AIToolbox.isMutationTool("recent_changes")).toBe(false);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
test("denies users without monitor read access or with it blocked", () => {
|
|
536
|
+
expect(AIToolbox.hasPermissionForTool(RecentChangesTool, context([]))).toBe(
|
|
537
|
+
false,
|
|
538
|
+
);
|
|
539
|
+
expect(
|
|
540
|
+
AIToolbox.hasPermissionForTool(
|
|
541
|
+
RecentChangesTool,
|
|
542
|
+
context([Permission.ProjectMember], [Permission.ProjectMember]),
|
|
543
|
+
),
|
|
544
|
+
).toBe(false);
|
|
545
|
+
expect(
|
|
546
|
+
AIToolbox.hasPermissionForTool(
|
|
547
|
+
RecentChangesTool,
|
|
548
|
+
context([Permission.ProjectOwner]),
|
|
549
|
+
),
|
|
550
|
+
).toBe(true);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
test("refuses cross-project and multi-tenant contexts without querying", async () => {
|
|
554
|
+
const spies: SourceSpies = mockSources();
|
|
555
|
+
const ctx: ToolContext = context();
|
|
556
|
+
|
|
557
|
+
const crossProject: ToolCallOutcome = await AIToolbox.executeTool({
|
|
558
|
+
name: "recent_changes",
|
|
559
|
+
args: {},
|
|
560
|
+
ctx: { ...ctx, projectId: otherProjectId },
|
|
561
|
+
});
|
|
562
|
+
const multiTenant: ToolCallOutcome = await AIToolbox.executeTool({
|
|
563
|
+
name: "recent_changes",
|
|
564
|
+
args: {},
|
|
565
|
+
ctx: { ...ctx, props: { ...ctx.props, isMultiTenantRequest: true } },
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
expect(crossProject.success).toBe(false);
|
|
569
|
+
expect(multiTenant.success).toBe(false);
|
|
570
|
+
expect(spies.exceptions).not.toHaveBeenCalled();
|
|
571
|
+
expect(spies.statusChanges).not.toHaveBeenCalled();
|
|
572
|
+
expect(spies.maintenance).not.toHaveBeenCalled();
|
|
573
|
+
});
|
|
574
|
+
});
|