@oneuptime/common 11.4.0 → 11.5.0
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/AIRun.ts +50 -0
- package/Models/DatabaseModels/AlertSeverity.ts +6 -0
- package/Models/DatabaseModels/IncidentSeverity.ts +6 -0
- package/Models/DatabaseModels/Index.ts +16 -0
- package/Models/DatabaseModels/IoTDeviceCredential.ts +471 -0
- package/Models/DatabaseModels/LlmLog.ts +56 -0
- package/Models/DatabaseModels/LlmProvider.ts +33 -0
- package/Models/DatabaseModels/NetworkDevice.ts +1385 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +717 -0
- package/Models/DatabaseModels/NetworkDeviceLabelRule.ts +514 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerRule.ts +596 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerTeam.ts +487 -0
- package/Models/DatabaseModels/NetworkDeviceOwnerUser.ts +486 -0
- package/Models/DatabaseModels/NetworkInterface.ts +563 -0
- package/Models/DatabaseModels/Project.ts +145 -0
- package/Models/DatabaseModels/TelemetryEntityRelationship.ts +54 -0
- package/Server/API/AIAgentTaskAPI.ts +10 -24
- package/Server/API/AIInvestigationAPI.ts +131 -63
- package/Server/API/AlertAPI.ts +5 -0
- package/Server/API/IncidentAPI.ts +10 -0
- package/Server/API/IncidentEpisodeAPI.ts +5 -0
- package/Server/API/LlmProviderAPI.ts +4 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +5 -0
- package/Server/API/TelemetryAPI.ts +4 -3
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.ts +105 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.ts +15 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.ts +192 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.ts +49 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +24 -0
- package/Server/Services/AIAgentTaskService.ts +62 -0
- package/Server/Services/AIRunService.ts +58 -0
- package/Server/Services/AIService.ts +101 -0
- package/Server/Services/AnalyticsDatabaseService.ts +27 -0
- package/Server/Services/IncidentService.ts +14 -41
- package/Server/Services/Index.ts +14 -0
- package/Server/Services/IoTDeviceCredentialService.ts +351 -0
- package/Server/Services/IoTDeviceService.ts +64 -21
- package/Server/Services/LlmLogService.ts +26 -0
- package/Server/Services/LlmProviderService.ts +3 -0
- package/Server/Services/LogAggregationService.ts +29 -11
- package/Server/Services/MetricService.ts +603 -13
- package/Server/Services/MonitorService.ts +4 -1
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +10 -0
- package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +204 -0
- package/Server/Services/NetworkDeviceLabelRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerRuleEngineService.ts +222 -0
- package/Server/Services/NetworkDeviceOwnerRuleService.ts +14 -0
- package/Server/Services/NetworkDeviceOwnerTeamService.ts +10 -0
- package/Server/Services/NetworkDeviceOwnerUserService.ts +10 -0
- package/Server/Services/NetworkDeviceService.ts +50 -0
- package/Server/Services/NetworkInterfaceService.ts +10 -0
- package/Server/Services/TelemetryEntityRelationshipService.ts +23 -0
- package/Server/Services/TelemetryEntityService.ts +72 -2
- package/Server/Utils/AI/Sentinel/AlertInvestigationRunner.ts +244 -12
- package/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.ts +92 -19
- package/Server/Utils/AI/Sentinel/InvestigationQueue.ts +493 -0
- package/Server/Utils/AI/Sentinel/README.md +10 -0
- package/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.ts +88 -68
- package/Server/Utils/AI/Toolbox/Index.ts +2 -1
- package/Server/Utils/AI/Toolbox/MetricTools.ts +391 -0
- package/Server/Utils/LLM/LLMService.ts +21 -0
- package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +44 -0
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +170 -2
- package/Server/Utils/Monitor/IoTDeviceAbsenceSeries.ts +101 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +1 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +19 -3
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +195 -2
- package/Server/Utils/Monitor/MonitorResource.ts +77 -21
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +1 -1
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +201 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +215 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +169 -0
- package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +146 -0
- package/Tests/Server/Services/AIServiceDailyBudget.test.ts +173 -0
- package/Tests/Server/Services/IncidentInternalNoteAnnouncement.test.ts +97 -0
- package/Tests/Server/Services/IoTDeviceService.test.ts +54 -0
- package/Tests/Server/Services/LogAggregationService.test.ts +22 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +194 -0
- package/Tests/Server/Utils/AI/BaselineAnomalyTool.test.ts +253 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +44 -0
- package/Tests/Server/Utils/AI/SentinelAlertGating.test.ts +360 -0
- package/Tests/Server/Utils/AI/SentinelInvestigationQueue.test.ts +295 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +59 -0
- package/Tests/Server/Utils/Monitor/IoTDeviceAbsenceSeries.test.ts +113 -0
- package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +198 -0
- package/Tests/Types/AI/AIAgentTaskStatus.test.ts +86 -0
- package/Tests/Types/BaseDatabase/AggregationIntervalUtil.test.ts +127 -0
- package/Tests/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.test.ts +152 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +1 -1
- package/Tests/Types/Trace/TraceRecordingRuleDefinition.test.ts +308 -0
- package/Tests/UI/Components/Dropdown.test.tsx +17 -0
- package/Tests/UI/Components/EntityDropdown.test.tsx +130 -0
- package/Tests/UI/Components/Modal.test.tsx +144 -2
- package/Tests/UI/Components/TelemetrySearchBar.test.tsx +90 -0
- package/Tests/UI/Utils/Theme.test.ts +161 -0
- package/Tests/Utils/Monitor/LatencyMatrixUtil.test.ts +111 -0
- package/Types/AI/AIRunStatus.ts +9 -0
- package/Types/BaseDatabase/AggregateBy.ts +12 -0
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.ts +24 -0
- package/Types/Dashboard/DashboardTemplates.ts +9 -1
- package/Types/LlmLogStatus.ts +1 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/HttpPhaseTimings.ts +16 -0
- package/Types/Monitor/IotAlertTemplates.ts +22 -3
- package/Types/Monitor/LatencyMatrix.ts +27 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +2 -2
- package/Types/Monitor/MonitorMetricType.ts +27 -0
- package/Types/Monitor/MonitorStep.ts +36 -11
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +55 -0
- package/Types/Monitor/MonitorStepSnmpMonitor.ts +8 -0
- package/Types/Monitor/MonitorType.ts +14 -9
- package/Types/Monitor/PingMonitor/PingMonitorResponse.ts +20 -0
- package/Types/Monitor/SnmpMonitor/LldpNeighbor.ts +12 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +116 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +29 -0
- package/Types/Monitor/SnmpMonitor/SnmpInterface.ts +31 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +24 -0
- package/Types/Monitor/SnmpMonitor/SnmpTrap.ts +20 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +173 -0
- package/Types/Permission.ts +314 -0
- package/Types/Probe/ProbeMonitorResponse.ts +22 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +8 -5
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +4 -1
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +6 -3
- package/UI/Components/CodeBlock/CodeBlock.tsx +2 -1
- package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
- package/UI/Components/Divider/Divider.tsx +1 -1
- package/UI/Components/Dropdown/Dropdown.tsx +13 -4
- package/UI/Components/EntityDropdown/EntityDropdown.tsx +110 -2
- package/UI/Components/ErrorBoundary.tsx +2 -1
- package/UI/Components/EventItem/EventItem.tsx +2 -2
- package/UI/Components/GanttChart/Bar/Index.tsx +1 -1
- package/UI/Components/Graphs/UptimeBarTooltip.tsx +30 -23
- package/UI/Components/Header/Header.tsx +7 -0
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +2 -0
- package/UI/Components/Icon/Icon.tsx +8 -6
- package/UI/Components/Label/Label.tsx +2 -2
- package/UI/Components/LogsViewer/components/LogsAnalyticsView.tsx +22 -10
- package/UI/Components/LogsViewer/components/LogsHistogram.tsx +9 -3
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +8 -8
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +44 -20
- package/UI/Components/Modal/ConfirmModal.tsx +1 -1
- package/UI/Components/Modal/Modal.tsx +213 -121
- package/UI/Components/Modal/ModalFooter.tsx +33 -22
- package/UI/Components/ModelTable/TableView.tsx +1 -1
- package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +20 -12
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +2 -2
- package/UI/Components/Pill/Pill.tsx +21 -13
- package/UI/Components/StatusBubble/StatusBubble.tsx +3 -3
- package/UI/Components/Tabs/Tabs.tsx +10 -1
- package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +7 -1
- package/UI/Components/TelemetryViewer/components/TelemetryHistogram.tsx +9 -3
- package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +62 -4
- package/UI/Components/Workflow/Component.tsx +53 -33
- package/UI/Components/Workflow/ComponentPortViewer.tsx +6 -6
- package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +8 -8
- package/UI/Components/Workflow/ComponentsModal.tsx +16 -9
- package/UI/Components/Workflow/Workflow.tsx +13 -11
- package/UI/Utils/Navigation.ts +10 -1
- package/UI/Utils/Theme.ts +140 -0
- package/Utils/Dashboard/Components/DashboardLogChartComponent.ts +99 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/Monitor/LatencyMatrixUtil.ts +162 -0
- package/Utils/Monitor/MonitorMetricType.ts +141 -3
- package/Utils/Monitor/NetworkTopologyUtil.ts +159 -0
- package/Utils/Telemetry/EntityRelationship.ts +11 -0
- package/build/dist/Models/DatabaseModels/AIRun.js +52 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js +6 -0
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js +493 -0
- package/build/dist/Models/DatabaseModels/IoTDeviceCredential.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js +58 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LlmProvider.js +33 -0
- package/build/dist/Models/DatabaseModels/LlmProvider.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +1426 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +738 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js +503 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js +502 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js +589 -0
- package/build/dist/Models/DatabaseModels/NetworkInterface.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Project.js +147 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +57 -0
- package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +8 -23
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +95 -55
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +5 -0
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +10 -0
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +5 -0
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +5 -7
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +5 -0
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783650000000-AddAdditionalParamsToLlmProvider.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783695782697-AddCacheTokenColumnsToLlmLog.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783701585317-AddAlertInvestigationGating.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783702431535-AddAiDailyAutonomousTokenLimitToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js +51 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783720000000-AddNetworkDeviceTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js +101 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783730000000-AddNetworkDeviceOwnersAndRules.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783740000000-AddNetworkDeviceDiscoveryScan.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783750000000-AddLldpNeighborsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783760576655-AddInvestigationTuningToProject.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783762505482-AddTelemetryEntityRelationshipMetrics.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783790000000-AddSnmpV3AuthColumnsToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIAgentTaskService.js +59 -0
- package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +33 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +82 -9
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +19 -0
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +14 -25
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +14 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/IoTDeviceCredentialService.js +321 -0
- package/build/dist/Server/Services/IoTDeviceCredentialService.js.map +1 -0
- package/build/dist/Server/Services/IoTDeviceService.js +49 -15
- package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
- package/build/dist/Server/Services/LlmLogService.js +29 -0
- package/build/dist/Server/Services/LlmLogService.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +3 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/LogAggregationService.js +21 -7
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +449 -7
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +2 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +166 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js +186 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js +9 -0
- package/build/dist/Server/Services/NetworkDeviceOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceService.js +52 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js +9 -0
- package/build/dist/Server/Services/NetworkInterfaceService.js.map +1 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +22 -0
- package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryEntityService.js +64 -2
- package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js +189 -9
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js +84 -17
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js +428 -0
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js.map +1 -0
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js +63 -47
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +2 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +300 -0
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +16 -0
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +29 -0
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +130 -2
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js +81 -0
- package/build/dist/Server/Utils/Monitor/IoTDeviceAbsenceSeries.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +18 -7
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -10
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +155 -5
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +76 -30
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +147 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +167 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +93 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -0
- package/build/dist/Types/AI/AIRunStatus.js +9 -0
- package/build/dist/Types/AI/AIRunStatus.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogChartComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +9 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/LlmLogStatus.js +1 -0
- package/build/dist/Types/LlmLogStatus.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +9 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/HttpPhaseTimings.js +2 -0
- package/build/dist/Types/Monitor/HttpPhaseTimings.js.map +1 -0
- package/build/dist/Types/Monitor/IotAlertTemplates.js +7 -7
- package/build/dist/Types/Monitor/IotAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/LatencyMatrix.js +2 -0
- package/build/dist/Types/Monitor/LatencyMatrix.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +2 -2
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorMetricType.js +24 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +22 -9
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +36 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +3 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +14 -9
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/PingMonitor/PingMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/LldpNeighbor.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +89 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkTopology.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpInterface.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpTrap.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +137 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -0
- package/build/dist/Types/Permission.js +280 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +7 -4
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +4 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js +1 -1
- package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +3 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/Divider/Divider.js +1 -1
- package/build/dist/UI/Components/Divider/Divider.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +10 -4
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js +76 -3
- package/build/dist/UI/Components/EntityDropdown/EntityDropdown.js.map +1 -1
- package/build/dist/UI/Components/ErrorBoundary.js +2 -1
- package/build/dist/UI/Components/ErrorBoundary.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/GanttChart/Bar/Index.js +1 -1
- package/build/dist/UI/Components/GanttChart/Bar/Index.js.map +1 -1
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +29 -23
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
- package/build/dist/UI/Components/Header/Header.js +1 -0
- package/build/dist/UI/Components/Header/Header.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +8 -6
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Label/Label.js +2 -2
- package/build/dist/UI/Components/Label/Label.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js +20 -8
- package/build/dist/UI/Components/LogsViewer/components/LogsAnalyticsView.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js +8 -2
- package/build/dist/UI/Components/LogsViewer/components/LogsHistogram.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +8 -8
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +40 -20
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js +1 -1
- package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +109 -51
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +13 -10
- package/build/dist/UI/Components/Modal/ModalFooter.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/MonitorGraphs/UptimeBarDayModal.js +17 -12
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +2 -2
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/Pill/Pill.js +12 -13
- package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js +3 -3
- package/build/dist/UI/Components/StatusBubble/StatusBubble.js.map +1 -1
- package/build/dist/UI/Components/Tabs/Tabs.js +3 -1
- package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js +8 -2
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryHistogram.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +36 -6
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Component.js +43 -33
- package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +6 -6
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +8 -8
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +15 -9
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +13 -11
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +11 -1
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/Theme.js +106 -0
- package/build/dist/UI/Utils/Theme.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js +89 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogChartComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/Monitor/LatencyMatrixUtil.js +89 -0
- package/build/dist/Utils/Monitor/LatencyMatrixUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js +138 -4
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +112 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityRelationship.js.map +1 -1
- package/package.json +1 -1
package/Server/Infrastructure/Postgres/SchemaMigrations/1783721121260-AddAttemptCountToAIRun.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddAttemptCountToAIRun1783721121260 implements MigrationInterface {
|
|
4
|
+
public name = "AddAttemptCountToAIRun1783721121260";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "AIRun" ADD "attemptCount" integer NOT NULL DEFAULT '0'`,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "AIRun" DROP COLUMN "attemptCount"`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddNetworkDeviceOwnersAndRules1783730000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddNetworkDeviceOwnersAndRules1783730000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
// --- NetworkDeviceOwnerTeam ---
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE TABLE "NetworkDeviceOwnerTeam" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "teamId" uuid NOT NULL, "networkDeviceId" uuid NOT NULL, "isOwnerNotified" boolean NOT NULL DEFAULT false, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_owner_team_id" PRIMARY KEY ("_id"))`,
|
|
12
|
+
);
|
|
13
|
+
for (const column of [
|
|
14
|
+
"projectId",
|
|
15
|
+
"teamId",
|
|
16
|
+
"networkDeviceId",
|
|
17
|
+
"isOwnerNotified",
|
|
18
|
+
]) {
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`CREATE INDEX "IDX_network_device_owner_team_${column}" ON "NetworkDeviceOwnerTeam" ("${column}")`,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
await queryRunner.query(
|
|
24
|
+
`ALTER TABLE "NetworkDeviceOwnerTeam" ADD CONSTRAINT "FK_nd_owner_team_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
25
|
+
);
|
|
26
|
+
await queryRunner.query(
|
|
27
|
+
`ALTER TABLE "NetworkDeviceOwnerTeam" ADD CONSTRAINT "FK_nd_owner_team_teamId" FOREIGN KEY ("teamId") REFERENCES "Team"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
28
|
+
);
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`ALTER TABLE "NetworkDeviceOwnerTeam" ADD CONSTRAINT "FK_nd_owner_team_networkDeviceId" FOREIGN KEY ("networkDeviceId") REFERENCES "NetworkDevice"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
31
|
+
);
|
|
32
|
+
await queryRunner.query(
|
|
33
|
+
`ALTER TABLE "NetworkDeviceOwnerTeam" ADD CONSTRAINT "FK_nd_owner_team_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
34
|
+
);
|
|
35
|
+
await queryRunner.query(
|
|
36
|
+
`ALTER TABLE "NetworkDeviceOwnerTeam" ADD CONSTRAINT "FK_nd_owner_team_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// --- NetworkDeviceOwnerUser ---
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`CREATE TABLE "NetworkDeviceOwnerUser" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "userId" uuid NOT NULL, "networkDeviceId" uuid NOT NULL, "isOwnerNotified" boolean NOT NULL DEFAULT false, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_owner_user_id" PRIMARY KEY ("_id"))`,
|
|
42
|
+
);
|
|
43
|
+
for (const column of [
|
|
44
|
+
"projectId",
|
|
45
|
+
"userId",
|
|
46
|
+
"networkDeviceId",
|
|
47
|
+
"isOwnerNotified",
|
|
48
|
+
]) {
|
|
49
|
+
await queryRunner.query(
|
|
50
|
+
`CREATE INDEX "IDX_network_device_owner_user_${column}" ON "NetworkDeviceOwnerUser" ("${column}")`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
await queryRunner.query(
|
|
54
|
+
`ALTER TABLE "NetworkDeviceOwnerUser" ADD CONSTRAINT "FK_nd_owner_user_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
55
|
+
);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`ALTER TABLE "NetworkDeviceOwnerUser" ADD CONSTRAINT "FK_nd_owner_user_userId" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
58
|
+
);
|
|
59
|
+
await queryRunner.query(
|
|
60
|
+
`ALTER TABLE "NetworkDeviceOwnerUser" ADD CONSTRAINT "FK_nd_owner_user_networkDeviceId" FOREIGN KEY ("networkDeviceId") REFERENCES "NetworkDevice"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
61
|
+
);
|
|
62
|
+
await queryRunner.query(
|
|
63
|
+
`ALTER TABLE "NetworkDeviceOwnerUser" ADD CONSTRAINT "FK_nd_owner_user_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
64
|
+
);
|
|
65
|
+
await queryRunner.query(
|
|
66
|
+
`ALTER TABLE "NetworkDeviceOwnerUser" ADD CONSTRAINT "FK_nd_owner_user_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// --- NetworkDeviceOwnerRule ---
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`CREATE TABLE "NetworkDeviceOwnerRule" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(100) NOT NULL, "description" character varying(500), "isEnabled" boolean NOT NULL DEFAULT true, "notifyOwners" boolean NOT NULL DEFAULT true, "networkDeviceNamePattern" character varying(500), "networkDeviceDescriptionPattern" character varying(500), "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_owner_rule_id" PRIMARY KEY ("_id"))`,
|
|
72
|
+
);
|
|
73
|
+
for (const column of ["projectId", "name", "isEnabled"]) {
|
|
74
|
+
await queryRunner.query(
|
|
75
|
+
`CREATE INDEX "IDX_network_device_owner_rule_${column}" ON "NetworkDeviceOwnerRule" ("${column}")`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
await queryRunner.query(
|
|
79
|
+
`ALTER TABLE "NetworkDeviceOwnerRule" ADD CONSTRAINT "FK_nd_owner_rule_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
80
|
+
);
|
|
81
|
+
await queryRunner.query(
|
|
82
|
+
`ALTER TABLE "NetworkDeviceOwnerRule" ADD CONSTRAINT "FK_nd_owner_rule_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
83
|
+
);
|
|
84
|
+
await queryRunner.query(
|
|
85
|
+
`ALTER TABLE "NetworkDeviceOwnerRule" ADD CONSTRAINT "FK_nd_owner_rule_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// OwnerRule join tables
|
|
89
|
+
const ownerRuleJoins: Array<{
|
|
90
|
+
table: string;
|
|
91
|
+
column: string;
|
|
92
|
+
refTable: string;
|
|
93
|
+
}> = [
|
|
94
|
+
{
|
|
95
|
+
table: "NetworkDeviceOwnerRuleNetworkDeviceLabel",
|
|
96
|
+
column: "labelId",
|
|
97
|
+
refTable: "Label",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
table: "NetworkDeviceOwnerRuleOwnerUser",
|
|
101
|
+
column: "userId",
|
|
102
|
+
refTable: "User",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
table: "NetworkDeviceOwnerRuleOwnerTeam",
|
|
106
|
+
column: "teamId",
|
|
107
|
+
refTable: "Team",
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
for (const join of ownerRuleJoins) {
|
|
112
|
+
await queryRunner.query(
|
|
113
|
+
`CREATE TABLE "${join.table}" ("networkDeviceOwnerRuleId" uuid NOT NULL, "${join.column}" uuid NOT NULL, CONSTRAINT "PK_${join.table}" PRIMARY KEY ("networkDeviceOwnerRuleId", "${join.column}"))`,
|
|
114
|
+
);
|
|
115
|
+
await queryRunner.query(
|
|
116
|
+
`CREATE INDEX "IDX_${join.table}_ruleId" ON "${join.table}" ("networkDeviceOwnerRuleId")`,
|
|
117
|
+
);
|
|
118
|
+
await queryRunner.query(
|
|
119
|
+
`CREATE INDEX "IDX_${join.table}_${join.column}" ON "${join.table}" ("${join.column}")`,
|
|
120
|
+
);
|
|
121
|
+
await queryRunner.query(
|
|
122
|
+
`ALTER TABLE "${join.table}" ADD CONSTRAINT "FK_${join.table}_ruleId" FOREIGN KEY ("networkDeviceOwnerRuleId") REFERENCES "NetworkDeviceOwnerRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
123
|
+
);
|
|
124
|
+
await queryRunner.query(
|
|
125
|
+
`ALTER TABLE "${join.table}" ADD CONSTRAINT "FK_${join.table}_${join.column}" FOREIGN KEY ("${join.column}") REFERENCES "${join.refTable}"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// --- NetworkDeviceLabelRule ---
|
|
130
|
+
await queryRunner.query(
|
|
131
|
+
`CREATE TABLE "NetworkDeviceLabelRule" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(100) NOT NULL, "description" character varying(500), "isEnabled" boolean NOT NULL DEFAULT true, "networkDeviceNamePattern" character varying(500), "networkDeviceDescriptionPattern" character varying(500), "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_label_rule_id" PRIMARY KEY ("_id"))`,
|
|
132
|
+
);
|
|
133
|
+
for (const column of ["projectId", "name", "isEnabled"]) {
|
|
134
|
+
await queryRunner.query(
|
|
135
|
+
`CREATE INDEX "IDX_network_device_label_rule_${column}" ON "NetworkDeviceLabelRule" ("${column}")`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
await queryRunner.query(
|
|
139
|
+
`ALTER TABLE "NetworkDeviceLabelRule" ADD CONSTRAINT "FK_nd_label_rule_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
140
|
+
);
|
|
141
|
+
await queryRunner.query(
|
|
142
|
+
`ALTER TABLE "NetworkDeviceLabelRule" ADD CONSTRAINT "FK_nd_label_rule_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
143
|
+
);
|
|
144
|
+
await queryRunner.query(
|
|
145
|
+
`ALTER TABLE "NetworkDeviceLabelRule" ADD CONSTRAINT "FK_nd_label_rule_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// LabelRule join tables
|
|
149
|
+
for (const table of [
|
|
150
|
+
"NetworkDeviceLabelRuleNetworkDeviceLabel",
|
|
151
|
+
"NetworkDeviceLabelRuleLabelToAdd",
|
|
152
|
+
]) {
|
|
153
|
+
await queryRunner.query(
|
|
154
|
+
`CREATE TABLE "${table}" ("networkDeviceLabelRuleId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_${table}" PRIMARY KEY ("networkDeviceLabelRuleId", "labelId"))`,
|
|
155
|
+
);
|
|
156
|
+
await queryRunner.query(
|
|
157
|
+
`CREATE INDEX "IDX_${table}_ruleId" ON "${table}" ("networkDeviceLabelRuleId")`,
|
|
158
|
+
);
|
|
159
|
+
await queryRunner.query(
|
|
160
|
+
`CREATE INDEX "IDX_${table}_labelId" ON "${table}" ("labelId")`,
|
|
161
|
+
);
|
|
162
|
+
await queryRunner.query(
|
|
163
|
+
`ALTER TABLE "${table}" ADD CONSTRAINT "FK_${table}_ruleId" FOREIGN KEY ("networkDeviceLabelRuleId") REFERENCES "NetworkDeviceLabelRule"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
164
|
+
);
|
|
165
|
+
await queryRunner.query(
|
|
166
|
+
`ALTER TABLE "${table}" ADD CONSTRAINT "FK_${table}_labelId" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
172
|
+
await queryRunner.query(
|
|
173
|
+
`DROP TABLE IF EXISTS "NetworkDeviceLabelRuleLabelToAdd"`,
|
|
174
|
+
);
|
|
175
|
+
await queryRunner.query(
|
|
176
|
+
`DROP TABLE IF EXISTS "NetworkDeviceLabelRuleNetworkDeviceLabel"`,
|
|
177
|
+
);
|
|
178
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDeviceLabelRule"`);
|
|
179
|
+
await queryRunner.query(
|
|
180
|
+
`DROP TABLE IF EXISTS "NetworkDeviceOwnerRuleOwnerTeam"`,
|
|
181
|
+
);
|
|
182
|
+
await queryRunner.query(
|
|
183
|
+
`DROP TABLE IF EXISTS "NetworkDeviceOwnerRuleOwnerUser"`,
|
|
184
|
+
);
|
|
185
|
+
await queryRunner.query(
|
|
186
|
+
`DROP TABLE IF EXISTS "NetworkDeviceOwnerRuleNetworkDeviceLabel"`,
|
|
187
|
+
);
|
|
188
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDeviceOwnerRule"`);
|
|
189
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDeviceOwnerUser"`);
|
|
190
|
+
await queryRunner.query(`DROP TABLE IF EXISTS "NetworkDeviceOwnerTeam"`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddNetworkDeviceDiscoveryScan1783740000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddNetworkDeviceDiscoveryScan1783740000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`CREATE TABLE "NetworkDeviceDiscoveryScan" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "probeId" uuid NOT NULL, "cidr" character varying(100) NOT NULL, "snmpVersion" character varying(100) DEFAULT '2c', "snmpCommunityString" character varying(100), "snmpPort" integer DEFAULT '161', "status" character varying(100) NOT NULL DEFAULT 'Pending', "statusMessage" character varying(500), "discoveredDevices" jsonb, "scannedHostCount" integer, "respondedHostCount" integer, "startedAt" TIMESTAMP WITH TIME ZONE, "completedAt" TIMESTAMP WITH TIME ZONE, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_network_device_discovery_scan_id" PRIMARY KEY ("_id"))`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`CREATE INDEX "IDX_network_device_discovery_scan_projectId" ON "NetworkDeviceDiscoveryScan" ("projectId")`,
|
|
14
|
+
);
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`CREATE INDEX "IDX_network_device_discovery_scan_probeId_status" ON "NetworkDeviceDiscoveryScan" ("probeId", "status")`,
|
|
17
|
+
);
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "NetworkDeviceDiscoveryScan" ADD CONSTRAINT "FK_nd_discovery_scan_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "NetworkDeviceDiscoveryScan" ADD CONSTRAINT "FK_nd_discovery_scan_probeId" FOREIGN KEY ("probeId") REFERENCES "Probe"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
23
|
+
);
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`ALTER TABLE "NetworkDeviceDiscoveryScan" ADD CONSTRAINT "FK_nd_discovery_scan_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
26
|
+
);
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`ALTER TABLE "NetworkDeviceDiscoveryScan" ADD CONSTRAINT "FK_nd_discovery_scan_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
33
|
+
await queryRunner.query(
|
|
34
|
+
`DROP TABLE IF EXISTS "NetworkDeviceDiscoveryScan"`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddLldpNeighborsToNetworkDevice1783750000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddLldpNeighborsToNetworkDevice1783750000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "NetworkDevice" ADD "lldpNeighbors" jsonb`,
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "lldpNeighbors"`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddInvestigationTuningToProject1783760576655
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddInvestigationTuningToProject1783760576655";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "Project" ADD "alertInvestigationDedupeWindowMinutes" integer`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "Project" ADD "aiMaxConcurrentInvestigations" integer`,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "Project" DROP COLUMN "aiMaxConcurrentInvestigations"`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "Project" DROP COLUMN "alertInvestigationDedupeWindowMinutes"`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddTelemetryEntityRelationshipMetrics1783762505482
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddTelemetryEntityRelationshipMetrics1783762505482";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "TelemetryEntityRelationship" ADD "callCount" integer`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "TelemetryEntityRelationship" ADD "errorCount" integer`,
|
|
14
|
+
);
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`ALTER TABLE "TelemetryEntityRelationship" ADD "avgDurationMs" integer`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "TelemetryEntityRelationship" DROP COLUMN "avgDurationMs"`,
|
|
23
|
+
);
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`ALTER TABLE "TelemetryEntityRelationship" DROP COLUMN "errorCount"`,
|
|
26
|
+
);
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`ALTER TABLE "TelemetryEntityRelationship" DROP COLUMN "callCount"`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/Server/Infrastructure/Postgres/SchemaMigrations/1783780000000-AddIoTDeviceCredentialTable.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* IoT device registry + per-device MQTT credentials. Registered
|
|
5
|
+
* devices get individual authentication (credential id as MQTT
|
|
6
|
+
* username, secretKey as password), topic isolation, revocation, and
|
|
7
|
+
* silent-death offline detection (registered devices survive the
|
|
8
|
+
* stale-inventory cleanup and get absent-series injection in IoT
|
|
9
|
+
* Device monitors).
|
|
10
|
+
*/
|
|
11
|
+
export class AddIoTDeviceCredentialTable1783780000000
|
|
12
|
+
implements MigrationInterface
|
|
13
|
+
{
|
|
14
|
+
public name = "AddIoTDeviceCredentialTable1783780000000";
|
|
15
|
+
|
|
16
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
17
|
+
await queryRunner.query(
|
|
18
|
+
`CREATE TABLE "IoTDeviceCredential" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "iotFleetId" uuid NOT NULL, "externalId" character varying(100) NOT NULL, "name" character varying(100), "isEnabled" boolean NOT NULL DEFAULT true, "lastConnectedAt" TIMESTAMP WITH TIME ZONE, "createdByUserId" uuid, "deletedByUserId" uuid, "secretKey" uuid NOT NULL, CONSTRAINT "PK_iot_device_credential_id" PRIMARY KEY ("_id"))`,
|
|
19
|
+
);
|
|
20
|
+
await queryRunner.query(
|
|
21
|
+
`CREATE INDEX "IDX_iot_device_credential_projectId" ON "IoTDeviceCredential" ("projectId")`,
|
|
22
|
+
);
|
|
23
|
+
await queryRunner.query(
|
|
24
|
+
`CREATE INDEX "IDX_iot_device_credential_iotFleetId" ON "IoTDeviceCredential" ("iotFleetId")`,
|
|
25
|
+
);
|
|
26
|
+
await queryRunner.query(
|
|
27
|
+
`CREATE INDEX "IDX_iot_device_credential_externalId" ON "IoTDeviceCredential" ("externalId")`,
|
|
28
|
+
);
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`CREATE INDEX "IDX_iot_device_credential_secretKey" ON "IoTDeviceCredential" ("secretKey")`,
|
|
31
|
+
);
|
|
32
|
+
await queryRunner.query(
|
|
33
|
+
`CREATE UNIQUE INDEX "IDX_iot_device_credential_fleet_externalId" ON "IoTDeviceCredential" ("projectId", "iotFleetId", "externalId")`,
|
|
34
|
+
);
|
|
35
|
+
await queryRunner.query(
|
|
36
|
+
`ALTER TABLE "IoTDeviceCredential" ADD CONSTRAINT "FK_iot_device_credential_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
37
|
+
);
|
|
38
|
+
await queryRunner.query(
|
|
39
|
+
`ALTER TABLE "IoTDeviceCredential" ADD CONSTRAINT "FK_iot_device_credential_iotFleetId" FOREIGN KEY ("iotFleetId") REFERENCES "IoTFleet"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
40
|
+
);
|
|
41
|
+
await queryRunner.query(
|
|
42
|
+
`ALTER TABLE "IoTDeviceCredential" ADD CONSTRAINT "FK_iot_device_credential_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
43
|
+
);
|
|
44
|
+
await queryRunner.query(
|
|
45
|
+
`ALTER TABLE "IoTDeviceCredential" ADD CONSTRAINT "FK_iot_device_credential_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
50
|
+
await queryRunner.query(
|
|
51
|
+
`ALTER TABLE "IoTDeviceCredential" DROP CONSTRAINT "FK_iot_device_credential_deletedByUserId"`,
|
|
52
|
+
);
|
|
53
|
+
await queryRunner.query(
|
|
54
|
+
`ALTER TABLE "IoTDeviceCredential" DROP CONSTRAINT "FK_iot_device_credential_createdByUserId"`,
|
|
55
|
+
);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`ALTER TABLE "IoTDeviceCredential" DROP CONSTRAINT "FK_iot_device_credential_iotFleetId"`,
|
|
58
|
+
);
|
|
59
|
+
await queryRunner.query(
|
|
60
|
+
`ALTER TABLE "IoTDeviceCredential" DROP CONSTRAINT "FK_iot_device_credential_projectId"`,
|
|
61
|
+
);
|
|
62
|
+
await queryRunner.query(
|
|
63
|
+
`DROP INDEX "public"."IDX_iot_device_credential_fleet_externalId"`,
|
|
64
|
+
);
|
|
65
|
+
await queryRunner.query(
|
|
66
|
+
`DROP INDEX "public"."IDX_iot_device_credential_secretKey"`,
|
|
67
|
+
);
|
|
68
|
+
await queryRunner.query(
|
|
69
|
+
`DROP INDEX "public"."IDX_iot_device_credential_externalId"`,
|
|
70
|
+
);
|
|
71
|
+
await queryRunner.query(
|
|
72
|
+
`DROP INDEX "public"."IDX_iot_device_credential_iotFleetId"`,
|
|
73
|
+
);
|
|
74
|
+
await queryRunner.query(
|
|
75
|
+
`DROP INDEX "public"."IDX_iot_device_credential_projectId"`,
|
|
76
|
+
);
|
|
77
|
+
await queryRunner.query(`DROP TABLE "IoTDeviceCredential"`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddSnmpV3AuthColumnsToNetworkDevice1783790000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddSnmpV3AuthColumnsToNetworkDevice1783790000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3SecurityLevel" character varying(100)`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3Username" character varying(100)`,
|
|
14
|
+
);
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3AuthProtocol" character varying(100)`,
|
|
17
|
+
);
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3AuthKey" text`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3PrivProtocol" character varying(100)`,
|
|
23
|
+
);
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`ALTER TABLE "NetworkDevice" ADD "snmpV3PrivKey" text`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
30
|
+
await queryRunner.query(
|
|
31
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3PrivKey"`,
|
|
32
|
+
);
|
|
33
|
+
await queryRunner.query(
|
|
34
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3PrivProtocol"`,
|
|
35
|
+
);
|
|
36
|
+
await queryRunner.query(
|
|
37
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3AuthKey"`,
|
|
38
|
+
);
|
|
39
|
+
await queryRunner.query(
|
|
40
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3AuthProtocol"`,
|
|
41
|
+
);
|
|
42
|
+
await queryRunner.query(
|
|
43
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3Username"`,
|
|
44
|
+
);
|
|
45
|
+
await queryRunner.query(
|
|
46
|
+
`ALTER TABLE "NetworkDevice" DROP COLUMN "snmpV3SecurityLevel"`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -420,6 +420,18 @@ import { AddMigrationFailureTable1783523076215 } from "./1783523076215-AddMigrat
|
|
|
420
420
|
import { AddEnableAutomaticIncidentInvestigationToProject1783598145111 } from "./1783598145111-AddEnableAutomaticIncidentInvestigationToProject";
|
|
421
421
|
import { AddInvestigationSubjectToAIRun1783615884106 } from "./1783615884106-AddInvestigationSubjectToAIRun";
|
|
422
422
|
import { AddEnableAutomaticAlertInvestigationToProject1783632447975 } from "./1783632447975-AddEnableAutomaticAlertInvestigationToProject";
|
|
423
|
+
import { AddCacheTokenColumnsToLlmLog1783695782697 } from "./1783695782697-AddCacheTokenColumnsToLlmLog";
|
|
424
|
+
import { AddAlertInvestigationGating1783701585317 } from "./1783701585317-AddAlertInvestigationGating";
|
|
425
|
+
import { AddAiDailyAutonomousTokenLimitToProject1783702431535 } from "./1783702431535-AddAiDailyAutonomousTokenLimitToProject";
|
|
426
|
+
import { AddNetworkDeviceTables1783720000000 } from "./1783720000000-AddNetworkDeviceTables";
|
|
427
|
+
import { AddNetworkDeviceOwnersAndRules1783730000000 } from "./1783730000000-AddNetworkDeviceOwnersAndRules";
|
|
428
|
+
import { AddNetworkDeviceDiscoveryScan1783740000000 } from "./1783740000000-AddNetworkDeviceDiscoveryScan";
|
|
429
|
+
import { AddLldpNeighborsToNetworkDevice1783750000000 } from "./1783750000000-AddLldpNeighborsToNetworkDevice";
|
|
430
|
+
import { AddAttemptCountToAIRun1783721121260 } from "./1783721121260-AddAttemptCountToAIRun";
|
|
431
|
+
import { AddInvestigationTuningToProject1783760576655 } from "./1783760576655-AddInvestigationTuningToProject";
|
|
432
|
+
import { AddTelemetryEntityRelationshipMetrics1783762505482 } from "./1783762505482-AddTelemetryEntityRelationshipMetrics";
|
|
433
|
+
import { AddIoTDeviceCredentialTable1783780000000 } from "./1783780000000-AddIoTDeviceCredentialTable";
|
|
434
|
+
import { AddSnmpV3AuthColumnsToNetworkDevice1783790000000 } from "./1783790000000-AddSnmpV3AuthColumnsToNetworkDevice";
|
|
423
435
|
|
|
424
436
|
export default [
|
|
425
437
|
InitialMigration,
|
|
@@ -844,4 +856,16 @@ export default [
|
|
|
844
856
|
AddEnableAutomaticIncidentInvestigationToProject1783598145111,
|
|
845
857
|
AddInvestigationSubjectToAIRun1783615884106,
|
|
846
858
|
AddEnableAutomaticAlertInvestigationToProject1783632447975,
|
|
859
|
+
AddCacheTokenColumnsToLlmLog1783695782697,
|
|
860
|
+
AddAlertInvestigationGating1783701585317,
|
|
861
|
+
AddAiDailyAutonomousTokenLimitToProject1783702431535,
|
|
862
|
+
AddNetworkDeviceTables1783720000000,
|
|
863
|
+
AddAttemptCountToAIRun1783721121260,
|
|
864
|
+
AddNetworkDeviceOwnersAndRules1783730000000,
|
|
865
|
+
AddNetworkDeviceDiscoveryScan1783740000000,
|
|
866
|
+
AddLldpNeighborsToNetworkDevice1783750000000,
|
|
867
|
+
AddInvestigationTuningToProject1783760576655,
|
|
868
|
+
AddTelemetryEntityRelationshipMetrics1783762505482,
|
|
869
|
+
AddIoTDeviceCredentialTable1783780000000,
|
|
870
|
+
AddSnmpV3AuthColumnsToNetworkDevice1783790000000,
|
|
847
871
|
];
|
|
@@ -11,6 +11,7 @@ import Semaphore, { SemaphoreMutex } from "../Infrastructure/Semaphore";
|
|
|
11
11
|
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
12
12
|
import logger from "../Utils/Logger";
|
|
13
13
|
import OneUptimeDate from "../../Types/Date";
|
|
14
|
+
import AIAgentTaskStatus from "../../Types/AI/AIAgentTaskStatus";
|
|
14
15
|
|
|
15
16
|
export class Service extends DatabaseService<Model> {
|
|
16
17
|
public constructor() {
|
|
@@ -80,6 +81,67 @@ export class Service extends DatabaseService<Model> {
|
|
|
80
81
|
return { createBy, carryForward: null };
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
/*
|
|
85
|
+
* Atomically claim the oldest Scheduled task for a worker: the
|
|
86
|
+
* Scheduled -> InProgress transition is guarded on status, so when
|
|
87
|
+
* multiple workers poll concurrently only one claim succeeds
|
|
88
|
+
* (updateOneBy returns the number of rows changed — zero means another
|
|
89
|
+
* worker won the race, so we retry with the next candidate). The
|
|
90
|
+
* returned task is already InProgress and owned by the given agent.
|
|
91
|
+
*/
|
|
92
|
+
@CaptureSpan()
|
|
93
|
+
public async claimNextScheduledTask(data: {
|
|
94
|
+
aiAgentId: ObjectID;
|
|
95
|
+
}): Promise<Model | null> {
|
|
96
|
+
const maxClaimAttempts: number = 5;
|
|
97
|
+
|
|
98
|
+
for (let attempt: number = 0; attempt < maxClaimAttempts; attempt++) {
|
|
99
|
+
const task: Model | null = await this.findOneBy({
|
|
100
|
+
query: {
|
|
101
|
+
status: AIAgentTaskStatus.Scheduled,
|
|
102
|
+
},
|
|
103
|
+
sort: {
|
|
104
|
+
createdAt: SortOrder.Ascending,
|
|
105
|
+
},
|
|
106
|
+
select: {
|
|
107
|
+
_id: true,
|
|
108
|
+
projectId: true,
|
|
109
|
+
taskType: true,
|
|
110
|
+
metadata: true,
|
|
111
|
+
createdAt: true,
|
|
112
|
+
},
|
|
113
|
+
props: {
|
|
114
|
+
isRoot: true,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (!task || !task.id) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const claimedCount: number = await this.updateOneBy({
|
|
123
|
+
query: {
|
|
124
|
+
_id: task.id.toString(),
|
|
125
|
+
status: AIAgentTaskStatus.Scheduled,
|
|
126
|
+
},
|
|
127
|
+
data: {
|
|
128
|
+
status: AIAgentTaskStatus.InProgress,
|
|
129
|
+
aiAgentId: data.aiAgentId,
|
|
130
|
+
startedAt: OneUptimeDate.getCurrentDate(),
|
|
131
|
+
},
|
|
132
|
+
props: {
|
|
133
|
+
isRoot: true,
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (claimedCount > 0) {
|
|
138
|
+
return task;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
83
145
|
@CaptureSpan()
|
|
84
146
|
public async getExistingTaskNumberForProject(data: {
|
|
85
147
|
projectId: ObjectID;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import PositiveNumber from "../../Types/PositiveNumber";
|
|
2
|
+
import ObjectID from "../../Types/ObjectID";
|
|
3
|
+
import AIRunStatus from "../../Types/AI/AIRunStatus";
|
|
2
4
|
import CountBy from "../Types/Database/CountBy";
|
|
3
5
|
import FindBy from "../Types/Database/FindBy";
|
|
4
6
|
import { OnFind } from "../Types/Database/Hooks";
|
|
@@ -6,12 +8,68 @@ import DatabaseService from "./DatabaseService";
|
|
|
6
8
|
import Model from "../../Models/DatabaseModels/AIRun";
|
|
7
9
|
import { pinQueryToRequestingUser } from "../Utils/AI/AIChatPrivacyFilter";
|
|
8
10
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
11
|
+
import { UpdateQueryBuilder, UpdateResult } from "typeorm";
|
|
12
|
+
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The fields a status transition may set. Primitives only — the query-builder
|
|
16
|
+
* update below bypasses column transformers, so ObjectID fields must not be
|
|
17
|
+
* set through this path.
|
|
18
|
+
*/
|
|
19
|
+
export interface AIRunTransitionSet {
|
|
20
|
+
status: AIRunStatus;
|
|
21
|
+
attemptCount?: number | undefined;
|
|
22
|
+
startedAt?: Date | undefined;
|
|
23
|
+
lastHeartbeatAt?: Date | undefined;
|
|
24
|
+
completedAt?: Date | undefined;
|
|
25
|
+
errorMessage?: string | undefined;
|
|
26
|
+
llmCallCount?: number | undefined;
|
|
27
|
+
toolCallCount?: number | undefined;
|
|
28
|
+
totalTokens?: number | undefined;
|
|
29
|
+
}
|
|
9
30
|
|
|
10
31
|
export class Service extends DatabaseService<Model> {
|
|
11
32
|
public constructor() {
|
|
12
33
|
super(Model);
|
|
13
34
|
}
|
|
14
35
|
|
|
36
|
+
/*
|
|
37
|
+
* A genuinely atomic status transition: one conditional UPDATE whose WHERE
|
|
38
|
+
* carries the expected current status (and optionally the expected
|
|
39
|
+
* attemptCount). Returns the number of rows changed — 0 means another
|
|
40
|
+
* actor won the race.
|
|
41
|
+
*
|
|
42
|
+
* This exists because updateOneBy is SELECT-then-save: two concurrent
|
|
43
|
+
* callers can both observe the precondition and both write, so it cannot
|
|
44
|
+
* implement a claim. The durable investigation queue's exactly-once
|
|
45
|
+
* guarantee rests on this method.
|
|
46
|
+
*/
|
|
47
|
+
@CaptureSpan()
|
|
48
|
+
public async attemptStatusTransition(data: {
|
|
49
|
+
aiRunId: ObjectID;
|
|
50
|
+
fromStatus: AIRunStatus;
|
|
51
|
+
expectedAttemptCount?: number | undefined;
|
|
52
|
+
set: AIRunTransitionSet;
|
|
53
|
+
}): Promise<number> {
|
|
54
|
+
const queryBuilder: UpdateQueryBuilder<Model> = this.getRepository()
|
|
55
|
+
.createQueryBuilder()
|
|
56
|
+
.update(Model)
|
|
57
|
+
.set(data.set as QueryDeepPartialEntity<Model>)
|
|
58
|
+
.where('"_id" = :id', { id: data.aiRunId.toString() })
|
|
59
|
+
.andWhere('"status" = :fromStatus', { fromStatus: data.fromStatus })
|
|
60
|
+
.andWhere('"deletedAt" IS NULL');
|
|
61
|
+
|
|
62
|
+
if (data.expectedAttemptCount !== undefined) {
|
|
63
|
+
queryBuilder.andWhere('"attemptCount" = :expectedAttemptCount', {
|
|
64
|
+
expectedAttemptCount: data.expectedAttemptCount,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const result: UpdateResult = await queryBuilder.execute();
|
|
69
|
+
|
|
70
|
+
return result.affected || 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
15
73
|
protected override async onBeforeFind(
|
|
16
74
|
findBy: FindBy<Model>,
|
|
17
75
|
): Promise<OnFind<Model>> {
|