@oneuptime/common 11.5.8 → 11.5.10
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/AnalyticsModels/Index.ts +13 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByContainer.ts +178 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.ts +179 -0
- package/Models/AnalyticsModels/MetricItemAggMV1mByService.ts +179 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +397 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +15 -6
- package/Models/DatabaseModels/AIRun.ts +37 -0
- package/Models/DatabaseModels/AIRunEvent.ts +34 -1
- package/Models/DatabaseModels/EnterpriseLicenseInstance.ts +18 -0
- package/Models/DatabaseModels/GlobalConfig.ts +36 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/MarketingConversion.ts +198 -0
- package/Models/DatabaseModels/MetricSavedView.ts +34 -0
- package/Models/DatabaseModels/MetricType.ts +74 -0
- package/Models/DatabaseModels/NetworkDevice.ts +332 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +328 -0
- package/Models/DatabaseModels/NetworkInterface.ts +58 -0
- package/Models/DatabaseModels/Project.ts +62 -0
- package/Models/DatabaseModels/StatusPage.ts +42 -0
- package/Models/DatabaseModels/User.ts +37 -0
- package/Server/API/AIAgentTaskAPI.ts +38 -12
- package/Server/API/AIAgentTaskLogAPI.ts +49 -0
- package/Server/API/AIChatAPI.ts +16 -0
- package/Server/API/AIReadinessAPI.ts +84 -0
- package/Server/API/BaseAnalyticsAPI.ts +23 -0
- package/Server/API/CodeFixRunAPI.ts +182 -0
- package/Server/API/EnterpriseLicenseAPI.ts +14 -0
- package/Server/API/TelemetryExceptionAPI.ts +6 -1
- package/Server/EnvironmentConfig.ts +84 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.ts +95 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.ts +38 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.ts +108 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +20 -0
- package/Server/Services/AIRunEventService.ts +15 -1
- package/Server/Services/AIRunService.ts +38 -1
- package/Server/Services/AnalyticsDatabaseService.ts +70 -1
- package/Server/Services/IncidentService.ts +13 -0
- package/Server/Services/Index.ts +10 -0
- package/Server/Services/LlmProviderService.ts +2 -0
- package/Server/Services/MarketingConversionService.ts +10 -0
- package/Server/Services/MetricItemAggMV1mByContainerService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByK8sClusterService.ts +31 -0
- package/Server/Services/MetricItemAggMV1mByServiceService.ts +31 -0
- package/Server/Services/MetricService.ts +970 -122
- package/Server/Services/MonitorService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +42 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +106 -0
- package/Server/Services/NetworkFlowService.ts +11 -0
- package/Server/Services/OnCallDutyPolicyService.ts +11 -1
- package/Server/Services/ProjectService.ts +178 -0
- package/Server/Services/SpanService.ts +13 -9
- package/Server/Services/StatusPageService.ts +97 -0
- package/Server/Services/TeamMemberService.ts +11 -0
- package/Server/Services/TelemetryExceptionService.ts +19 -90
- package/Server/Services/UserService.ts +59 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +37 -7
- package/Server/Types/Markdown.ts +9 -9
- package/Server/Types/MarkdownSlugify.ts +47 -0
- package/Server/Utils/AI/AIRunTranscript.ts +240 -0
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +9 -0
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +119 -5
- package/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.ts +75 -0
- package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +235 -0
- package/Server/Utils/AI/SRE/Insights/FixRouting.ts +2 -3
- package/Server/Utils/AI/Toolbox/CodeTools.ts +883 -0
- package/Server/Utils/AI/Toolbox/CodeWriteTools.ts +519 -0
- package/Server/Utils/AI/Toolbox/Index.ts +27 -0
- package/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.ts +279 -0
- package/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.ts +19 -1
- package/Server/Utils/Attribution.ts +99 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +600 -0
- package/Server/Utils/CodeRepository/StackTraceRepoResolver.ts +7 -2
- package/Server/Utils/LLM/LLMService.ts +397 -18
- package/Server/Utils/Marketing/ConversionUploadProvider.ts +103 -0
- package/Server/Utils/Marketing/ConversionUploadProviders.ts +22 -0
- package/Server/Utils/Marketing/Providers/GoogleAds.ts +270 -0
- package/Server/Utils/Marketing/Providers/LinkedIn.ts +147 -0
- package/Server/Utils/Marketing/Providers/Meta.ts +148 -0
- package/Server/Utils/Marketing/Providers/MicrosoftAds.ts +196 -0
- package/Server/Utils/Marketing/Providers/Reddit.ts +178 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +71 -7
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +31 -19
- package/Server/Utils/Monitor/MonitorIncident.ts +71 -7
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +57 -0
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +94 -0
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +19 -11
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +125 -14
- package/Server/Utils/ProductAnalytics.ts +133 -0
- package/Server/Utils/Telemetry/Telemetry.ts +39 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +21 -0
- package/Tests/Models/StatusPageEnableMcpServer.test.ts +125 -0
- package/Tests/Server/API/BaseAnalyticsAPI.test.ts +72 -0
- package/Tests/Server/Infrastructure/SemaphorePermit.test.ts +9 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +21 -2
- package/Tests/Server/Services/MetricEntityMVKeyParity.test.ts +173 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +1391 -0
- package/Tests/Server/Services/NetworkDeviceOwnerServices.test.ts +260 -0
- package/Tests/Server/Services/StatusPageServiceMcp.test.ts +223 -0
- package/Tests/Server/Services/TelemetryExceptionAIFixReadiness.test.ts +26 -3
- package/Tests/Server/Services/TelemetryExceptionCodeFixRun.test.ts +12 -0
- package/Tests/Server/Types/Markdown.test.ts +106 -0
- package/Tests/Server/Utils/AI/AIRunTranscript.test.ts +182 -0
- package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +411 -0
- package/Tests/Server/Utils/AI/CodeTools.test.ts +596 -0
- package/Tests/Server/Utils/AI/CodeWriteTools.test.ts +475 -0
- package/Tests/Server/Utils/AI/LLMServiceModelCompatibility.test.ts +548 -0
- package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +142 -0
- package/Tests/Server/Utils/AI/ScheduledMaintenanceTools.test.ts +176 -0
- package/Tests/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.test.ts +63 -0
- package/Tests/Server/Utils/GitHubGetFileContent.test.ts +197 -0
- package/Tests/Server/Utils/Monitor/MonitorTemplateUtilNetworkDevice.test.ts +389 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +502 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +764 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +7 -6
- package/Tests/Types/AI/AIChatPageContext.test.ts +0 -0
- package/Tests/Types/AI/AIRunStatus.test.ts +42 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +111 -2
- package/Tests/Types/Database/EndsWith.test.ts +64 -0
- package/Tests/Types/Database/GreaterThan.test.ts +62 -0
- package/Tests/Types/Database/GreaterThanOrEqual.test.ts +65 -0
- package/Tests/Types/Database/GreaterThanOrNull.test.ts +63 -0
- package/Tests/Types/Database/Includes.test.ts +65 -0
- package/Tests/Types/Database/IncludesAll.test.ts +65 -0
- package/Tests/Types/Database/IncludesNone.test.ts +65 -0
- package/Tests/Types/Database/IsNull.test.ts +44 -0
- package/Tests/Types/Database/LessThan.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrEqual.test.ts +62 -0
- package/Tests/Types/Database/LessThanOrNull.test.ts +62 -0
- package/Tests/Types/Database/MultiSearch.test.ts +81 -0
- package/Tests/Types/Database/NotContains.test.ts +64 -0
- package/Tests/Types/Database/NotNull.test.ts +44 -0
- package/Tests/Types/Database/StartsWith.test.ts +64 -0
- package/Tests/Types/Log/LogSeverity.test.ts +78 -0
- package/Tests/Types/Monitor/MonitorStepSqlMonitor.test.ts +83 -1
- package/Tests/Types/Monitor/SnmpV3EnumParsing.test.ts +247 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +263 -0
- package/Tests/UI/Components/BasicFormDropdownNormalization.test.tsx +167 -0
- package/Tests/UI/Components/Charts/AxisTickColor.test.tsx +66 -0
- package/Tests/UI/Components/XAxis.test.ts +5 -3
- package/Tests/UI/Utils/AIChatExport/ChatWidgetData.test.ts +319 -0
- package/Tests/UI/Utils/AIChatExport/ChatWidgetMarkdown.test.ts +188 -0
- package/Tests/Utils/EnterpriseLicenseUsage.test.ts +76 -0
- package/Tests/Utils/Metrics/MetricExplorerUrl.test.ts +622 -0
- package/Tests/Utils/Metrics/MetricFormulaEvaluator.test.ts +474 -0
- package/Tests/Utils/Telemetry/HeartbeatAvailability.test.ts +52 -4
- package/Types/AI/AIAgentTaskStatus.ts +13 -0
- package/Types/AI/AIChatPageContext.ts +137 -0
- package/Types/AI/AIChatTypes.ts +44 -0
- package/Types/AI/AIFixReadiness.ts +46 -0
- package/Types/AI/AIRunStatus.ts +11 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +11 -0
- package/Types/BaseDatabase/AggregateBy.ts +31 -2
- package/Types/BaseDatabase/AggregatedResult.ts +22 -0
- package/Types/BaseDatabase/AggregationInterval.ts +11 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.ts +30 -5
- package/Types/Dashboard/DashboardComponents/DashboardTraceChartComponent.ts +16 -0
- package/Types/Email/EmailTemplateType.ts +3 -0
- package/Types/Log/LogSeverity.ts +61 -0
- package/Types/Marketing/MarketingConversion.ts +11 -0
- package/Types/Metrics/MetricQueryConfigData.ts +21 -0
- package/Types/Metrics/MetricQueryData.ts +8 -0
- package/Types/Metrics/MetricViewData.ts +8 -0
- package/Types/Monitor/MonitorMetricType.ts +8 -0
- package/Types/Monitor/MonitorStep.ts +9 -0
- package/Types/Monitor/MonitorStepSqlMonitor.ts +12 -0
- package/Types/Monitor/MonitorType.ts +2 -1
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.ts +17 -12
- package/Types/Monitor/SnmpMonitor/CdpNeighbor.ts +13 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +37 -3
- package/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.ts +46 -0
- package/Types/Monitor/SnmpMonitor/SnmpEntityInfo.ts +15 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +8 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +17 -8
- package/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.ts +53 -0
- package/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.ts +43 -0
- package/Types/Monitor/SnmpMonitor/SnmpSystemInfo.ts +16 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +119 -3
- package/Types/Monitor/SnmpMonitor/SnmpVersion.ts +40 -0
- package/Types/NetFlow/NetworkFlowRecord.ts +25 -0
- package/Types/Syslog/SyslogMessage.ts +18 -0
- package/Types/Telemetry/TelemetrySavedViewState.ts +9 -0
- package/Types/Telemetry/TelemetrySavedViewType.ts +12 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +51 -0
- package/UI/Components/Charts/Bar/BarChart.tsx +51 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +97 -26
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +118 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +336 -3
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +7 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.ts +15 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.ts +13 -0
- package/UI/Components/Charts/Line/LineChart.tsx +51 -0
- package/UI/Components/Charts/Types/ReferenceRegionProps.ts +12 -0
- package/UI/Components/Charts/Types/TimeReferenceLineProps.ts +12 -0
- package/UI/Components/Charts/Types/XAxis/XAxisPrecision.ts +1 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +0 -0
- package/UI/Components/Charts/Utils/TimeAnnotation.ts +169 -0
- package/UI/Components/Charts/Utils/XAxis.ts +28 -4
- package/UI/Components/Forms/BasicForm.tsx +26 -8
- package/UI/Components/Icon/Icon.tsx +33 -13
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +9 -0
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +67 -0
- package/UI/Components/Page/ModelPage.tsx +6 -1
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +33 -4
- package/UI/Styles/Theme.css +1324 -0
- package/UI/Utils/AIChatExport/ChatWidgetData.ts +316 -0
- package/UI/Utils/AIChatExport/ChatWidgetMarkdown.ts +349 -0
- package/UI/Utils/AIChatExport/ConversationMarkdown.ts +177 -0
- package/UI/Utils/AIChatExport/MarkdownBlocks.ts +327 -0
- package/UI/Utils/AIChatExport/MarkdownSafety.ts +215 -0
- package/UI/Utils/DownloadFile.ts +54 -0
- package/UI/Utils/User.ts +41 -2
- package/Utils/Analytics.ts +8 -6
- package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +74 -0
- package/Utils/Metrics/MetricExplorerUrl.ts +771 -0
- package/Utils/Metrics/MetricFormulaEvaluator.ts +410 -46
- package/Utils/Monitor/NetworkTopologyUtil.ts +261 -49
- package/Utils/ValueFormatter.ts +22 -1
- package/build/dist/Models/AnalyticsModels/Index.js +13 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js +159 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByContainer.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js +158 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByK8sCluster.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js +160 -0
- package/build/dist/Models/AnalyticsModels/MetricItemAggMV1mByService.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +351 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +15 -7
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRun.js +38 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIRunEvent.js +31 -0
- package/build/dist/Models/DatabaseModels/AIRunEvent.js.map +1 -1
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js +19 -0
- package/build/dist/Models/DatabaseModels/EnterpriseLicenseInstance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +38 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MarketingConversion.js +219 -0
- package/build/dist/Models/DatabaseModels/MarketingConversion.js.map +1 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js +35 -0
- package/build/dist/Models/DatabaseModels/MetricSavedView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MetricType.js +76 -0
- package/build/dist/Models/DatabaseModels/MetricType.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +341 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +60 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +65 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +43 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/User.js +38 -0
- package/build/dist/Models/DatabaseModels/User.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +37 -11
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskLogAPI.js +32 -7
- package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -1
- package/build/dist/Server/API/AIChatAPI.js +9 -0
- package/build/dist/Server/API/AIChatAPI.js.map +1 -1
- package/build/dist/Server/API/AIReadinessAPI.js +57 -0
- package/build/dist/Server/API/AIReadinessAPI.js.map +1 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js +19 -0
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +142 -0
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -1
- package/build/dist/Server/API/EnterpriseLicenseAPI.js +8 -0
- package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +4 -0
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +51 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js +80 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784124919694-AddAITaskNumberAndRunTranscript.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js +37 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784135099754-AllowNullAiAgentOnPullRequest.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784137457184-AddEnableMcpServerToStatusPage.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js +27 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414522-AddCounterSemanticsToMetricType.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784191414600-AddViewTypeToMetricSavedView.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784200000000-AddSnmpV3ColumnsToNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js +47 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784211212164-AddNetworkDeviceInventoryAndDiscoverySchedule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784218257664-AddEnterpriseLicenseNotificationColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784293516000-AddAttributionColumnsToUserAndProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784298000000-AddMarketingConversionTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIRunEventService.js +8 -0
- package/build/dist/Server/Services/AIRunEventService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +29 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +58 -4
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +12 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +10 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +2 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/MarketingConversionService.js +9 -0
- package/build/dist/Server/Services/MarketingConversionService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByContainerService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByK8sClusterService.js.map +1 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js +29 -0
- package/build/dist/Server/Services/MetricItemAggMV1mByServiceService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +761 -125
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +18 -5
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +44 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +88 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -1
- package/build/dist/Server/Services/NetworkFlowService.js +9 -0
- package/build/dist/Server/Services/NetworkFlowService.js.map +1 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +15 -6
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +146 -6
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/SpanService.js +8 -6
- package/build/dist/Server/Services/SpanService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +91 -0
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +11 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +14 -61
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +52 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +33 -7
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +8 -8
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Types/MarkdownSlugify.js +47 -0
- package/build/dist/Server/Types/MarkdownSlugify.js.map +1 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js +180 -0
- package/build/dist/Server/Utils/AI/AIRunTranscript.js.map +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +1 -0
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +103 -5
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js +55 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +211 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js +654 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js +389 -0
- package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +19 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js +239 -0
- package/build/dist/Server/Utils/AI/Toolbox/ScheduledMaintenanceTools.js.map +1 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js +19 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js.map +1 -1
- package/build/dist/Server/Utils/Attribution.js +74 -0
- package/build/dist/Server/Utils/Attribution.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +439 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js +1 -1
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +275 -19
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js +40 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js +20 -0
- package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js +177 -0
- package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js +113 -0
- package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js +109 -0
- package/build/dist/Server/Utils/Marketing/Providers/Meta.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js +130 -0
- package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js.map +1 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js +126 -0
- package/build/dist/Server/Utils/Marketing/Providers/Reddit.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +53 -9
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +21 -10
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +54 -11
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +43 -3
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +68 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +17 -11
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +100 -15
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/ProductAnalytics.js +111 -0
- package/build/dist/Server/Utils/ProductAnalytics.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +32 -5
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +17 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Types/AI/AIAgentTaskStatus.js +12 -0
- package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -1
- package/build/dist/Types/AI/AIChatPageContext.js +101 -0
- package/build/dist/Types/AI/AIChatPageContext.js.map +1 -0
- package/build/dist/Types/AI/AIChatTypes.js +2 -0
- package/build/dist/Types/AI/AIChatTypes.js.map +1 -1
- package/build/dist/Types/AI/AIFixReadiness.js +9 -0
- package/build/dist/Types/AI/AIFixReadiness.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +11 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +11 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationInterval.js +11 -0
- package/build/dist/Types/BaseDatabase/AggregationInterval.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js +33 -5
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.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/Log/LogSeverity.js +56 -0
- package/build/dist/Types/Log/LogSeverity.js.map +1 -1
- package/build/dist/Types/Marketing/MarketingConversion.js +13 -0
- package/build/dist/Types/Marketing/MarketingConversion.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js +7 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +6 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +2 -1
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/CdpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js +41 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpEntityInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js +48 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSystemInfo.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +96 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js +38 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js.map +1 -1
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js +2 -0
- package/build/dist/Types/NetFlow/NetworkFlowRecord.js.map +1 -0
- package/build/dist/Types/Syslog/SyslogMessage.js +2 -0
- package/build/dist/Types/Syslog/SyslogMessage.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js +0 -7
- package/build/dist/Types/Telemetry/TelemetrySavedViewState.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js +13 -0
- package/build/dist/Types/Telemetry/TelemetrySavedViewType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +25 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +26 -2
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +36 -12
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +55 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +217 -8
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +6 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedReferenceRegion.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedTimeReferenceLine.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +25 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ReferenceRegionProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/TimeReferenceLineProps.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +0 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +121 -0
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +27 -4
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +24 -6
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +15 -8
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +58 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Page/ModelPage.js +7 -1
- package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +10 -4
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js +217 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetData.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js +234 -0
- package/build/dist/UI/Utils/AIChatExport/ChatWidgetMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js +111 -0
- package/build/dist/UI/Utils/AIChatExport/ConversationMarkdown.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js +233 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownBlocks.js.map +1 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js +134 -0
- package/build/dist/UI/Utils/AIChatExport/MarkdownSafety.js.map +1 -0
- package/build/dist/UI/Utils/DownloadFile.js +41 -0
- package/build/dist/UI/Utils/DownloadFile.js.map +1 -0
- package/build/dist/UI/Utils/User.js +35 -2
- package/build/dist/UI/Utils/User.js.map +1 -1
- package/build/dist/Utils/Analytics.js +8 -5
- package/build/dist/Utils/Analytics.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +57 -0
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js +418 -0
- package/build/dist/Utils/Metrics/MetricExplorerUrl.js.map +1 -0
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js +296 -37
- package/build/dist/Utils/Metrics/MetricFormulaEvaluator.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +176 -40
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +20 -1
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AreaChart } from "../../../../UI/Components/Charts/ChartLibrary/AreaChart/AreaChart";
|
|
2
|
+
import { BarChart } from "../../../../UI/Components/Charts/ChartLibrary/BarChart/BarChart";
|
|
3
|
+
import { LineChart } from "../../../../UI/Components/Charts/ChartLibrary/LineChart/LineChart";
|
|
4
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
5
|
+
import { render } from "@testing-library/react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { describe, expect, test } from "@jest/globals";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* ResponsiveContainer measures its parent, which is always 0x0 in jsdom, so the
|
|
11
|
+
* chart renders nothing without a fixed size.
|
|
12
|
+
*/
|
|
13
|
+
jest.mock("recharts", () => {
|
|
14
|
+
const actual: Record<string, any> = jest.requireActual("recharts");
|
|
15
|
+
return {
|
|
16
|
+
...actual,
|
|
17
|
+
ResponsiveContainer: ({ children }: { children: React.ReactElement }) => {
|
|
18
|
+
return React.cloneElement(children, { width: 600, height: 300 });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
type ChartData = Record<string, any>;
|
|
24
|
+
|
|
25
|
+
const data: ChartData[] = [
|
|
26
|
+
{ time: "10:00", Requests: 1200 },
|
|
27
|
+
{ time: "10:05", Requests: 2400 },
|
|
28
|
+
{ time: "10:10", Requests: 1800 },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const CHARTS: Array<[string, React.ReactElement]> = [
|
|
32
|
+
[
|
|
33
|
+
"LineChart",
|
|
34
|
+
<LineChart data={data} index="time" categories={["Requests"]} />,
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"AreaChart",
|
|
38
|
+
<AreaChart data={data} index="time" categories={["Requests"]} />,
|
|
39
|
+
],
|
|
40
|
+
["BarChart", <BarChart data={data} index="time" categories={["Requests"]} />],
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
describe("Chart axis tick colour", () => {
|
|
44
|
+
/*
|
|
45
|
+
* Recharts >= 3.4 portals tick labels into a separate z-index layer, outside the
|
|
46
|
+
* axis <g>. Anything that relies on the axis's class or on fill inheritance to
|
|
47
|
+
* colour them silently paints black, which is invisible in dark mode. The tick
|
|
48
|
+
* must therefore carry its own fill.
|
|
49
|
+
*/
|
|
50
|
+
test.each(CHARTS)(
|
|
51
|
+
"%s gives axis ticks an explicit themeable fill",
|
|
52
|
+
(_name: string, element: React.ReactElement) => {
|
|
53
|
+
const { container } = render(element);
|
|
54
|
+
|
|
55
|
+
const ticks: Array<Element> = Array.from(
|
|
56
|
+
container.querySelectorAll(".recharts-cartesian-axis-tick-value"),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
expect(ticks.length).toBeGreaterThan(0);
|
|
60
|
+
|
|
61
|
+
for (const tick of ticks) {
|
|
62
|
+
expect(tick.getAttribute("fill")).toBe("var(--ou-chart-tick)");
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
});
|
|
@@ -9,9 +9,11 @@ describe("XAxisUtil", () => {
|
|
|
9
9
|
xAxisMax: new Date("2026-04-07T14:00:00.000Z"),
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/*
|
|
13
|
+
* A 24h window now uses the fifteen-minute precision tier, whose labels
|
|
14
|
+
* are local wall-clock times: 07:30 UTC is 08:30 in BST.
|
|
15
|
+
*/
|
|
16
|
+
expect(formatter(new Date("2026-04-07T07:30:00.000Z"))).toBe("08:30");
|
|
15
17
|
});
|
|
16
18
|
|
|
17
19
|
test("does not mutate the original date while rounding local labels", () => {
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { describe, expect, test } from "@jest/globals";
|
|
2
|
+
import {
|
|
3
|
+
AIChatWidget,
|
|
4
|
+
AIChatWidgetSpan,
|
|
5
|
+
AIChatWidgetType,
|
|
6
|
+
} from "../../../../Types/AI/AIChatTypes";
|
|
7
|
+
import {
|
|
8
|
+
ExportChartSeries,
|
|
9
|
+
SpanBarMetrics,
|
|
10
|
+
buildParentBySpanId,
|
|
11
|
+
chartHasData,
|
|
12
|
+
chartIsTimeBased,
|
|
13
|
+
computeSpanBar,
|
|
14
|
+
computeSpanDepth,
|
|
15
|
+
formatChartValue,
|
|
16
|
+
formatStatValue,
|
|
17
|
+
formatTableCell,
|
|
18
|
+
formatToolArguments,
|
|
19
|
+
toEntityListEntry,
|
|
20
|
+
toExportChartSeries,
|
|
21
|
+
totalTraceDuration,
|
|
22
|
+
} from "../../../../UI/Utils/AIChatExport/ChatWidgetData";
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* These helpers exist to keep the exports in step with what the chat renders,
|
|
26
|
+
* so the tests pin the behaviors that are easy to "tidy up" by accident — the
|
|
27
|
+
* dash for empty cells, 0 not being empty, and a numeric string deliberately
|
|
28
|
+
* not getting the grouping a real number gets.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function chartWidget(data: AIChatWidget["data"]): AIChatWidget {
|
|
32
|
+
return {
|
|
33
|
+
id: "W1",
|
|
34
|
+
type: AIChatWidgetType.TimeSeriesChart,
|
|
35
|
+
title: "Chart",
|
|
36
|
+
data: data,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe("ChatWidgetData", () => {
|
|
41
|
+
describe("formatTableCell", () => {
|
|
42
|
+
test("renders an em dash for null, undefined and empty string only", () => {
|
|
43
|
+
const column: { key: string; title: string } = { key: "a", title: "A" };
|
|
44
|
+
|
|
45
|
+
expect(formatTableCell(null, column)).toBe("—");
|
|
46
|
+
expect(formatTableCell(undefined, column)).toBe("—");
|
|
47
|
+
expect(formatTableCell("", column)).toBe("—");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("keeps falsy-but-real values, which are not empty", () => {
|
|
51
|
+
const column: { key: string; title: string } = { key: "a", title: "A" };
|
|
52
|
+
|
|
53
|
+
expect(formatTableCell(0, column)).toBe("0");
|
|
54
|
+
expect(formatTableCell(false, column)).toBe("false");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("groups a number column, but only when the value is really a number", () => {
|
|
58
|
+
const numeric: { key: string; title: string; type: "number" } = {
|
|
59
|
+
key: "n",
|
|
60
|
+
title: "N",
|
|
61
|
+
type: "number",
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
expect(formatTableCell(1234567, numeric)).toBe(
|
|
65
|
+
(1234567).toLocaleString(),
|
|
66
|
+
);
|
|
67
|
+
// A numeric string falls through to String() and keeps no separators.
|
|
68
|
+
expect(formatTableCell("1234567", numeric)).toBe("1234567");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("stringifies anything else", () => {
|
|
72
|
+
const column: { key: string; title: string } = { key: "a", title: "A" };
|
|
73
|
+
expect(formatTableCell(["a", "b"], column)).toBe("a,b");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe("formatStatValue", () => {
|
|
78
|
+
test("groups numbers and passes strings through verbatim", () => {
|
|
79
|
+
expect(formatStatValue({ label: "x", value: 1284322 })).toBe(
|
|
80
|
+
(1284322).toLocaleString(),
|
|
81
|
+
);
|
|
82
|
+
expect(formatStatValue({ label: "x", value: "1284322" })).toBe("1284322");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("appends the unit when there is one", () => {
|
|
86
|
+
expect(formatStatValue({ label: "x", value: 12, unit: "ms" })).toBe(
|
|
87
|
+
"12 ms",
|
|
88
|
+
);
|
|
89
|
+
expect(formatStatValue({ label: "x", value: 12, unit: "" })).toBe("12");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("formatChartValue", () => {
|
|
94
|
+
test("rounds to a whole number at or above 100, and to 2dp below", () => {
|
|
95
|
+
expect(formatChartValue(1234.56)).toBe((1235).toLocaleString());
|
|
96
|
+
expect(formatChartValue(12.345)).toBe((12.35).toLocaleString());
|
|
97
|
+
expect(formatChartValue(-1234.56)).toBe((-1235).toLocaleString());
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("appends the unit after a single space", () => {
|
|
101
|
+
expect(formatChartValue(12.5, "ms")).toBe("12.5 ms");
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe("formatToolArguments", () => {
|
|
106
|
+
test("skips empty values but keeps 0 and false", () => {
|
|
107
|
+
expect(
|
|
108
|
+
formatToolArguments({ a: null, b: undefined, c: "", d: 0, e: false }),
|
|
109
|
+
).toBe("d: 0 · e: false");
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("json-encodes objects and arrays", () => {
|
|
113
|
+
expect(formatToolArguments({ tags: ["a", "b"] })).toBe('tags: ["a","b"]');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("truncates a long value with an ellipsis, never the key", () => {
|
|
117
|
+
const long: string = "x".repeat(200);
|
|
118
|
+
const result: string = formatToolArguments({ key: long });
|
|
119
|
+
|
|
120
|
+
expect(result.startsWith("key: ")).toBe(true);
|
|
121
|
+
expect(result.endsWith("…")).toBe(true);
|
|
122
|
+
expect(result).toBe(`key: ${"x".repeat(80)}…`);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe("span helpers", () => {
|
|
127
|
+
const spans: Array<AIChatWidgetSpan> = [
|
|
128
|
+
{
|
|
129
|
+
spanId: "a",
|
|
130
|
+
name: "root",
|
|
131
|
+
startOffsetMs: 0,
|
|
132
|
+
durationMs: 100,
|
|
133
|
+
isError: false,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
spanId: "b",
|
|
137
|
+
parentSpanId: "a",
|
|
138
|
+
name: "child",
|
|
139
|
+
startOffsetMs: 10,
|
|
140
|
+
durationMs: 50,
|
|
141
|
+
isError: false,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
spanId: "c",
|
|
145
|
+
parentSpanId: "b",
|
|
146
|
+
name: "grandchild",
|
|
147
|
+
startOffsetMs: 20,
|
|
148
|
+
durationMs: 10,
|
|
149
|
+
isError: true,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
test("depth counts the parent chain", () => {
|
|
154
|
+
const parents: Map<string, string | undefined> =
|
|
155
|
+
buildParentBySpanId(spans);
|
|
156
|
+
|
|
157
|
+
expect(computeSpanDepth(spans[0] as AIChatWidgetSpan, parents)).toBe(0);
|
|
158
|
+
expect(computeSpanDepth(spans[1] as AIChatWidgetSpan, parents)).toBe(1);
|
|
159
|
+
expect(computeSpanDepth(spans[2] as AIChatWidgetSpan, parents)).toBe(2);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("a parent cycle terminates instead of hanging", () => {
|
|
163
|
+
const cyclic: Array<AIChatWidgetSpan> = [
|
|
164
|
+
{
|
|
165
|
+
spanId: "x",
|
|
166
|
+
parentSpanId: "y",
|
|
167
|
+
name: "x",
|
|
168
|
+
startOffsetMs: 0,
|
|
169
|
+
durationMs: 1,
|
|
170
|
+
isError: false,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
spanId: "y",
|
|
174
|
+
parentSpanId: "x",
|
|
175
|
+
name: "y",
|
|
176
|
+
startOffsetMs: 0,
|
|
177
|
+
durationMs: 1,
|
|
178
|
+
isError: false,
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
const parents: Map<string, string | undefined> =
|
|
182
|
+
buildParentBySpanId(cyclic);
|
|
183
|
+
|
|
184
|
+
expect(
|
|
185
|
+
computeSpanDepth(cyclic[0] as AIChatWidgetSpan, parents),
|
|
186
|
+
).toBeLessThanOrEqual(13);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test("the bar keeps a visible minimum width and stays inside the track", () => {
|
|
190
|
+
// A zero-duration span still gets the 1.5% floor.
|
|
191
|
+
const zero: SpanBarMetrics = computeSpanBar(
|
|
192
|
+
{
|
|
193
|
+
spanId: "z",
|
|
194
|
+
name: "z",
|
|
195
|
+
startOffsetMs: 0,
|
|
196
|
+
durationMs: 0,
|
|
197
|
+
isError: false,
|
|
198
|
+
},
|
|
199
|
+
1000,
|
|
200
|
+
);
|
|
201
|
+
expect(zero.widthPercent).toBe(1.5);
|
|
202
|
+
|
|
203
|
+
// A span running past the end is clipped to the right edge.
|
|
204
|
+
const overflowing: SpanBarMetrics = computeSpanBar(
|
|
205
|
+
{
|
|
206
|
+
spanId: "o",
|
|
207
|
+
name: "o",
|
|
208
|
+
startOffsetMs: 900,
|
|
209
|
+
durationMs: 5000,
|
|
210
|
+
isError: false,
|
|
211
|
+
},
|
|
212
|
+
1000,
|
|
213
|
+
);
|
|
214
|
+
expect(overflowing.leftPercent).toBe(90);
|
|
215
|
+
expect(overflowing.widthPercent).toBe(10);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("the denominator never reaches zero", () => {
|
|
219
|
+
expect(
|
|
220
|
+
totalTraceDuration({
|
|
221
|
+
id: "W",
|
|
222
|
+
type: AIChatWidgetType.TraceWaterfall,
|
|
223
|
+
title: "t",
|
|
224
|
+
data: { totalDurationMs: 0 },
|
|
225
|
+
}),
|
|
226
|
+
).toBe(1);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
describe("toEntityListEntry", () => {
|
|
231
|
+
test("reads the exception fields, and 0 occurrences still shows a count", () => {
|
|
232
|
+
const entry: { heading: string; badges: Array<string> } =
|
|
233
|
+
toEntityListEntry(
|
|
234
|
+
{ type: "TimeoutError", message: "boom", occurrences: 0 },
|
|
235
|
+
AIChatWidgetType.ExceptionList,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
expect(entry.heading).toBe("TimeoutError");
|
|
239
|
+
expect(entry.badges).toContain("0×");
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test("falls back to a generic exception heading", () => {
|
|
243
|
+
const entry: { heading: string } = toEntityListEntry(
|
|
244
|
+
{ message: "boom" },
|
|
245
|
+
AIChatWidgetType.ExceptionList,
|
|
246
|
+
);
|
|
247
|
+
expect(entry.heading).toBe("Exception");
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test("prefixes an incident with its number", () => {
|
|
251
|
+
const entry: { heading: string; badges: Array<string> } =
|
|
252
|
+
toEntityListEntry(
|
|
253
|
+
{
|
|
254
|
+
incidentNumber: 412,
|
|
255
|
+
title: "Down",
|
|
256
|
+
state: "Resolved",
|
|
257
|
+
severity: "Major",
|
|
258
|
+
},
|
|
259
|
+
AIChatWidgetType.IncidentList,
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
expect(entry.heading).toBe("#412 · Down");
|
|
263
|
+
expect(entry.badges).toEqual(["Resolved", "Major"]);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test("an alert reads its own number field", () => {
|
|
267
|
+
const entry: { heading: string } = toEntityListEntry(
|
|
268
|
+
{ alertNumber: 9, incidentNumber: 1, title: "Alert" },
|
|
269
|
+
AIChatWidgetType.AlertList,
|
|
270
|
+
);
|
|
271
|
+
expect(entry.heading).toBe("#9 · Alert");
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe("toExportChartSeries", () => {
|
|
276
|
+
test("drops null and undefined y values", () => {
|
|
277
|
+
const series: Array<ExportChartSeries> = toExportChartSeries(
|
|
278
|
+
chartWidget({
|
|
279
|
+
series: [
|
|
280
|
+
{
|
|
281
|
+
name: "s",
|
|
282
|
+
points: [
|
|
283
|
+
{ x: "2026-07-15T10:00:00Z", y: 1 },
|
|
284
|
+
{ x: "2026-07-15T11:00:00Z", y: null },
|
|
285
|
+
],
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
}),
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
expect(series[0]?.points).toHaveLength(1);
|
|
292
|
+
expect(series[0]?.points[0]?.y).toBe(1);
|
|
293
|
+
expect(series[0]?.points[0]?.date).toBeInstanceOf(Date);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("reports no data when every series is empty", () => {
|
|
297
|
+
expect(chartHasData(toExportChartSeries(chartWidget({})))).toBe(false);
|
|
298
|
+
expect(
|
|
299
|
+
chartHasData(
|
|
300
|
+
toExportChartSeries(
|
|
301
|
+
chartWidget({ series: [{ name: "s", points: [] }] }),
|
|
302
|
+
),
|
|
303
|
+
),
|
|
304
|
+
).toBe(false);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
test("a category x value is kept but not treated as a time", () => {
|
|
308
|
+
const series: Array<ExportChartSeries> = toExportChartSeries(
|
|
309
|
+
chartWidget({
|
|
310
|
+
series: [{ name: "s", points: [{ x: "ERROR", y: 2 }] }],
|
|
311
|
+
}),
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
expect(series[0]?.points[0]?.x).toBe("ERROR");
|
|
315
|
+
expect(series[0]?.points[0]?.date).toBeUndefined();
|
|
316
|
+
expect(chartIsTimeBased(series)).toBe(false);
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
});
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { describe, expect, test } from "@jest/globals";
|
|
2
|
+
import {
|
|
3
|
+
AIChatToolActionStatus,
|
|
4
|
+
AIChatWidget,
|
|
5
|
+
AIChatWidgetType,
|
|
6
|
+
} from "../../../../Types/AI/AIChatTypes";
|
|
7
|
+
import { JSONObject } from "../../../../Types/JSON";
|
|
8
|
+
import {
|
|
9
|
+
citationsToMarkdown,
|
|
10
|
+
toolActionsToMarkdown,
|
|
11
|
+
widgetToMarkdown,
|
|
12
|
+
} from "../../../../UI/Utils/AIChatExport/ChatWidgetMarkdown";
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The chat caps how much of a widget it shows, and says so. An export that
|
|
16
|
+
* quietly dropped the overflow — or quietly included it — would misrepresent
|
|
17
|
+
* the answer either way, so the caps and their captions are pinned here.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function rows(count: number): Array<JSONObject> {
|
|
21
|
+
return Array.from({ length: count }, (_unused: unknown, index: number) => {
|
|
22
|
+
return { name: `row-${index}` };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe("ChatWidgetMarkdown", () => {
|
|
27
|
+
describe("widgetToMarkdown", () => {
|
|
28
|
+
test("renders the title and description", () => {
|
|
29
|
+
const markdown: string = widgetToMarkdown({
|
|
30
|
+
id: "W1",
|
|
31
|
+
type: AIChatWidgetType.StatCards,
|
|
32
|
+
title: "Summary",
|
|
33
|
+
description: "Last hour",
|
|
34
|
+
data: { stats: [{ label: "Errors", value: 3 }] },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
expect(markdown).toContain("#### Summary");
|
|
38
|
+
expect(markdown).toContain("_Last hour_");
|
|
39
|
+
expect(markdown).toContain("| Errors | 3 |");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("caps table rows at 25 and says how many were shown", () => {
|
|
43
|
+
const widget: AIChatWidget = {
|
|
44
|
+
id: "W1",
|
|
45
|
+
type: AIChatWidgetType.Table,
|
|
46
|
+
title: "Rows",
|
|
47
|
+
data: {
|
|
48
|
+
columns: [{ key: "name", title: "Name" }],
|
|
49
|
+
rows: rows(40),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const markdown: string = widgetToMarkdown(widget);
|
|
54
|
+
|
|
55
|
+
expect(markdown).toContain("row-24");
|
|
56
|
+
expect(markdown).not.toContain("row-25");
|
|
57
|
+
expect(markdown).toContain("_Showing 25 of 40 rows._");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("caps entity lists at 12", () => {
|
|
61
|
+
const widget: AIChatWidget = {
|
|
62
|
+
id: "W1",
|
|
63
|
+
type: AIChatWidgetType.IncidentList,
|
|
64
|
+
title: "Incidents",
|
|
65
|
+
data: {
|
|
66
|
+
items: Array.from({ length: 20 }, (_u: unknown, i: number) => {
|
|
67
|
+
return { title: `incident-${i}` };
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const markdown: string = widgetToMarkdown(widget);
|
|
73
|
+
|
|
74
|
+
expect(markdown).toContain("incident-11");
|
|
75
|
+
expect(markdown).not.toContain("incident-12");
|
|
76
|
+
expect(markdown).toContain("_Showing 12 of 20._");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("escapes a pipe so it cannot break the table", () => {
|
|
80
|
+
const markdown: string = widgetToMarkdown({
|
|
81
|
+
id: "W1",
|
|
82
|
+
type: AIChatWidgetType.Table,
|
|
83
|
+
title: "Rows",
|
|
84
|
+
data: {
|
|
85
|
+
columns: [{ key: "name", title: "Name" }],
|
|
86
|
+
rows: [{ name: "a|b" }],
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
expect(markdown).toContain("a\\|b");
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("empty widgets say so rather than rendering an empty table", () => {
|
|
94
|
+
expect(
|
|
95
|
+
widgetToMarkdown({
|
|
96
|
+
id: "W1",
|
|
97
|
+
type: AIChatWidgetType.Table,
|
|
98
|
+
title: "Rows",
|
|
99
|
+
data: { columns: [], rows: [] },
|
|
100
|
+
}),
|
|
101
|
+
).toContain("_No rows._");
|
|
102
|
+
|
|
103
|
+
expect(
|
|
104
|
+
widgetToMarkdown({
|
|
105
|
+
id: "W2",
|
|
106
|
+
type: AIChatWidgetType.TimeSeriesChart,
|
|
107
|
+
title: "Chart",
|
|
108
|
+
data: { series: [] },
|
|
109
|
+
}),
|
|
110
|
+
).toContain("_No data points in this range._");
|
|
111
|
+
|
|
112
|
+
expect(
|
|
113
|
+
widgetToMarkdown({
|
|
114
|
+
id: "W3",
|
|
115
|
+
type: AIChatWidgetType.IncidentList,
|
|
116
|
+
title: "Incidents",
|
|
117
|
+
data: { items: [] },
|
|
118
|
+
}),
|
|
119
|
+
).toContain("_Nothing here._");
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("toolActionsToMarkdown", () => {
|
|
124
|
+
test("leads with the status so a denied action cannot read as a done one", () => {
|
|
125
|
+
const markdown: string = toolActionsToMarkdown([
|
|
126
|
+
{
|
|
127
|
+
id: "t1",
|
|
128
|
+
toolName: "restart",
|
|
129
|
+
title: "Restart payment-svc",
|
|
130
|
+
arguments: { service: "payment-svc" },
|
|
131
|
+
isMutation: true,
|
|
132
|
+
requiresApproval: true,
|
|
133
|
+
status: AIChatToolActionStatus.Denied,
|
|
134
|
+
},
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
expect(markdown).toContain("- **Denied** — Restart payment-svc");
|
|
138
|
+
expect(markdown).toContain("service: payment-svc");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("is empty when there are no actions", () => {
|
|
142
|
+
expect(toolActionsToMarkdown([])).toBe("");
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe("citationsToMarkdown", () => {
|
|
147
|
+
test("spells out a zero row count as evidence of absence", () => {
|
|
148
|
+
const markdown: string = citationsToMarkdown([
|
|
149
|
+
{
|
|
150
|
+
id: "C1",
|
|
151
|
+
toolName: "logs.query",
|
|
152
|
+
label: "Logs for payment-svc",
|
|
153
|
+
queryArguments: { service: "payment-svc" },
|
|
154
|
+
rowCount: 0,
|
|
155
|
+
},
|
|
156
|
+
]);
|
|
157
|
+
|
|
158
|
+
expect(markdown).toContain("checked, found nothing");
|
|
159
|
+
expect(markdown).toContain('{"service":"payment-svc"}');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("pluralizes a real row count", () => {
|
|
163
|
+
expect(
|
|
164
|
+
citationsToMarkdown([
|
|
165
|
+
{
|
|
166
|
+
id: "C1",
|
|
167
|
+
toolName: "t",
|
|
168
|
+
label: "l",
|
|
169
|
+
queryArguments: {},
|
|
170
|
+
rowCount: 1,
|
|
171
|
+
},
|
|
172
|
+
]),
|
|
173
|
+
).toContain("1 row");
|
|
174
|
+
|
|
175
|
+
expect(
|
|
176
|
+
citationsToMarkdown([
|
|
177
|
+
{
|
|
178
|
+
id: "C2",
|
|
179
|
+
toolName: "t",
|
|
180
|
+
label: "l",
|
|
181
|
+
queryArguments: {},
|
|
182
|
+
rowCount: 5,
|
|
183
|
+
},
|
|
184
|
+
]),
|
|
185
|
+
).toContain("5 rows");
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
});
|
|
@@ -163,3 +163,79 @@ describe("EnterpriseLicenseUsageUtil.getUniqueUserCount", () => {
|
|
|
163
163
|
expect(EnterpriseLicenseUsageUtil.getUniqueUserCount([], now)).toBe(0);
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
|
+
|
|
167
|
+
describe("EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails", () => {
|
|
168
|
+
it("returns empty array for non-array input", () => {
|
|
169
|
+
expect(EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails(null)).toEqual(
|
|
170
|
+
[],
|
|
171
|
+
);
|
|
172
|
+
expect(
|
|
173
|
+
EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails("admin@acme.com"),
|
|
174
|
+
).toEqual([]);
|
|
175
|
+
expect(EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails({})).toEqual(
|
|
176
|
+
[],
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("keeps only email-shaped strings, normalizes case and trims", () => {
|
|
181
|
+
const result: Array<string> =
|
|
182
|
+
EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails([
|
|
183
|
+
" Admin@Acme.COM ",
|
|
184
|
+
"not-an-email",
|
|
185
|
+
"missing@tld",
|
|
186
|
+
"spaces in@acme.com",
|
|
187
|
+
12345,
|
|
188
|
+
null,
|
|
189
|
+
"second.admin@acme.com",
|
|
190
|
+
]);
|
|
191
|
+
|
|
192
|
+
expect(result).toEqual(["admin@acme.com", "second.admin@acme.com"]);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("removes duplicates", () => {
|
|
196
|
+
const result: Array<string> =
|
|
197
|
+
EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails([
|
|
198
|
+
"admin@acme.com",
|
|
199
|
+
"ADMIN@ACME.COM",
|
|
200
|
+
"admin@acme.com",
|
|
201
|
+
]);
|
|
202
|
+
|
|
203
|
+
expect(result).toEqual(["admin@acme.com"]);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it("caps the list size", () => {
|
|
207
|
+
const tooMany: Array<string> = [];
|
|
208
|
+
|
|
209
|
+
for (
|
|
210
|
+
let i: number = 0;
|
|
211
|
+
i < EnterpriseLicenseUsageUtil.maxMasterAdminEmailsPerInstance + 10;
|
|
212
|
+
i++
|
|
213
|
+
) {
|
|
214
|
+
tooMany.push(`admin${i}@acme.com`);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const result: Array<string> =
|
|
218
|
+
EnterpriseLicenseUsageUtil.sanitizeMasterAdminEmails(tooMany);
|
|
219
|
+
|
|
220
|
+
expect(result.length).toBe(
|
|
221
|
+
EnterpriseLicenseUsageUtil.maxMasterAdminEmailsPerInstance,
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe("EnterpriseLicenseUsageUtil.maskLicenseKey", () => {
|
|
227
|
+
it("fully masks short keys", () => {
|
|
228
|
+
expect(EnterpriseLicenseUsageUtil.maskLicenseKey("")).toBe("••••••••");
|
|
229
|
+
expect(EnterpriseLicenseUsageUtil.maskLicenseKey("abcd1234")).toBe(
|
|
230
|
+
"••••••••",
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it("keeps only the first and last four characters of longer keys", () => {
|
|
235
|
+
expect(
|
|
236
|
+
EnterpriseLicenseUsageUtil.maskLicenseKey(
|
|
237
|
+
"abcd-1234-efgh-5678-ijkl-9012",
|
|
238
|
+
),
|
|
239
|
+
).toBe("abcd••••9012");
|
|
240
|
+
});
|
|
241
|
+
});
|