@oneuptime/common 14.0.9 → 14.0.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/DatabaseModels/AutoRemediationSuggestion.ts +60 -0
- package/Models/DatabaseModels/CephCluster.ts +213 -0
- package/Models/DatabaseModels/DatabaseServer.ts +213 -0
- package/Models/DatabaseModels/DockerHost.ts +213 -0
- package/Models/DatabaseModels/DockerSwarmCluster.ts +213 -0
- package/Models/DatabaseModels/GlobalConfig.ts +1 -1
- package/Models/DatabaseModels/Host.ts +213 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/PodmanHost.ts +213 -0
- package/Models/DatabaseModels/ProxmoxCluster.ts +213 -0
- package/Models/DatabaseModels/ResourceAiAgent.ts +419 -0
- package/Models/DatabaseModels/RunnerJob.ts +144 -0
- package/Models/DatabaseModels/VMwareVCenter.ts +213 -0
- package/Server/API/AutoRemediationAPI.ts +392 -1
- package/Server/API/ResourceAiAccessAPI.ts +1669 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.ts +423 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Infrastructure/Semaphore.ts +22 -0
- package/Server/Middleware/TelemetryIngest.ts +15 -5
- package/Server/Services/AnalyticsDatabaseService.ts +45 -1
- package/Server/Services/AutoRemediationRuleEngineService.ts +940 -112
- package/Server/Services/CephClusterService.ts +109 -1
- package/Server/Services/DatabaseServerService.ts +116 -1
- package/Server/Services/DockerHostService.ts +109 -1
- package/Server/Services/DockerSwarmClusterService.ts +113 -1
- package/Server/Services/HostService.ts +126 -4
- package/Server/Services/MetricRecordingRuleService.ts +47 -0
- package/Server/Services/PodmanHostService.ts +109 -1
- package/Server/Services/ProxmoxClusterService.ts +110 -1
- package/Server/Services/ResourceAiAccessService.ts +1439 -0
- package/Server/Services/ResourceAiAgentJobService.ts +202 -0
- package/Server/Services/ResourceAiAgentService.ts +2432 -0
- package/Server/Services/RunnerJobService.ts +611 -4
- package/Server/Services/TelemetryUsageBillingService.ts +28 -0
- package/Server/Services/TraceRecordingRuleService.ts +33 -0
- package/Server/Services/VMwareVCenterService.ts +110 -1
- package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +1434 -32
- package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +935 -21
- package/Server/Utils/AI/Remediation/RemediationPlanRunner.ts +25 -1
- package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +577 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessContext.ts +271 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.ts +45 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.ts +964 -0
- package/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.ts +333 -0
- package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +873 -0
- package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +72 -2
- package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +72 -5
- package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +72 -5
- package/Server/Utils/AutoRemediation/CommandPlanExecutor.ts +396 -13
- package/Server/Utils/AutoRemediation/RemediationVerifier.ts +35 -2
- package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +9 -1
- package/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.ts +920 -0
- package/Server/Utils/SessionReplay/SessionReplayUsage.ts +84 -6
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +33 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +21 -1
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +298 -224
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +35 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +389 -175
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +366 -143
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.ts +163 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.ts +396 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.ts +418 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.ts +152 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.ts +251 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.ts +214 -0
- package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +93 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +18 -6
- package/Tests/App/Dashboard/InvestigationInfrastructureTools.test.tsx +506 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardDescription.test.tsx +209 -0
- package/Tests/App/Dashboard/RemediationSuggestionCardResource.test.tsx +317 -0
- package/Tests/App/Dashboard/ResourceAiAccessSettingsUtil.test.ts +921 -0
- package/Tests/App/Dashboard/ResourceAiAgentInstall.test.ts +860 -0
- package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +1721 -0
- package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +1002 -0
- package/Tests/App/Dashboard/ResourceAiInsightsPage.test.tsx +931 -0
- package/Tests/App/Dashboard/ResourceAiNavigation.test.tsx +575 -0
- package/Tests/App/Dashboard/RunbookStepTypeMaps.test.ts +38 -7
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +33 -1
- package/Tests/Models/DatabaseModels/ResourceAiAccessColumns.test.ts +738 -0
- package/Tests/Models/DatabaseModels/ResourceAiAgentModel.test.ts +842 -0
- package/Tests/Server/API/AutoRemediationApproveResourceRound.test.ts +835 -0
- package/Tests/Server/API/ResourceAiAccessAPI.test.ts +2730 -0
- package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +60 -0
- package/Tests/Server/Infrastructure/Postgres/AddResourceAiAgentsMigration.test.ts +659 -0
- package/Tests/Server/Infrastructure/SemaphoreMutex.test.ts +31 -0
- package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +63 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerPinnedKey.test.ts +103 -5
- package/Tests/Server/Middleware/TelemetryIngestKubernetesAgentRunnerRateLimit.test.ts +19 -1
- package/Tests/Server/Services/AutoRemediationResourceRuleEngine.test.ts +1279 -0
- package/Tests/Server/Services/DatabaseServerService.test.ts +55 -0
- package/Tests/Server/Services/GroupTelemetryUsageExcludeNames.test.ts +299 -0
- package/Tests/Server/Services/HostServiceFindOrCreateMemo.test.ts +44 -0
- package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +45 -6
- package/Tests/Server/Services/RecordingRuleReservedMetricName.test.ts +171 -0
- package/Tests/Server/Services/ResourceAiAccessChangeAuthorization.test.ts +256 -0
- package/Tests/Server/Services/ResourceAiAccessService.test.ts +1373 -0
- package/Tests/Server/Services/ResourceAiAgentJobService.test.ts +375 -0
- package/Tests/Server/Services/ResourceAiAgentServiceHelpers.test.ts +1114 -0
- package/Tests/Server/Services/ResourceAiAgentServiceLifecycle.test.ts +1050 -0
- package/Tests/Server/Services/ResourceAiAgentServiceRegister.test.ts +2251 -0
- package/Tests/Server/Services/ResourceAiSettingsCreate.test.ts +373 -0
- package/Tests/Server/Services/ResourceAiSettingsPermission.test.ts +1042 -0
- package/Tests/Server/Services/ResourceServiceDeleteCleansUpAi.test.ts +319 -0
- package/Tests/Server/Services/RunnerJobEnqueueKubectl.test.ts +105 -0
- package/Tests/Server/Services/RunnerJobEnqueueResourceCommand.test.ts +986 -0
- package/Tests/Server/Services/RunnerJobResourceCommandLane.test.ts +211 -0
- package/Tests/Server/Services/RunnerJobResourceCommandTimeoutAndRedaction.test.ts +352 -0
- package/Tests/Server/Services/TelemetryUsageBillingSloExclusion.test.ts +218 -0
- package/Tests/Server/TestingUtils/Services/FakeRunnerJobCount.ts +145 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +453 -0
- package/Tests/Server/Utils/AI/InvestigationInfrastructureReport.test.ts +721 -0
- package/Tests/Server/Utils/AI/RemediationCommandTools.test.ts +94 -1
- package/Tests/Server/Utils/AI/RemediationCommandToolsResource.test.ts +1530 -0
- package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +1249 -0
- package/Tests/Server/Utils/AI/RemediationPlanRunner.test.ts +117 -0
- package/Tests/Server/Utils/AI/RemediationResourceCopyParity.test.ts +463 -0
- package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +722 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAccessContext.test.ts +266 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.test.ts +1220 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.test.ts +569 -0
- package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +830 -0
- package/Tests/Server/Utils/AutoRemediation/CommandPlanExecutorResource.test.ts +717 -0
- package/Tests/Server/Utils/AutoRemediation/RemediationVerifierResourceFollowUp.test.ts +338 -0
- package/Tests/Server/Utils/Monitor/Criteria/SessionReplayBudgetTemplateCriteria.test.ts +422 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.test.ts +1647 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayUsage.test.ts +143 -1
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +33 -3
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsAccountNotLinked.test.ts +1093 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.test.ts +1049 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.test.ts +1676 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCards.test.ts +2884 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.test.ts +2490 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmit.test.ts +2293 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateSubmitServerTimezone.test.ts +386 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.test.ts +1477 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.test.ts +1967 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsStripHtmlTags.test.ts +92 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsSubmittedFormRemoval.test.ts +1819 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.test.ts +1033 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezoneServerZone.test.ts +610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsBotMessageHandling.test.ts +2610 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsCreateCommandsEndToEnd.test.ts +4672 -0
- package/Tests/Server/Utils/Workspace/WorkspaceCreateProjectReferences.test.ts +190 -65
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlan.test.ts +10 -4
- package/Tests/Types/AutoRemediation/AiRemediationCommandPlanResourceCommand.test.ts +305 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +277 -13
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +113 -0
- package/Tests/Types/Monitor/RumAlertTemplates.test.ts +773 -2
- package/Tests/Types/ResourceAiAgent/AiResourceType.test.ts +419 -0
- package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +517 -0
- package/Tests/Types/Runbook/RunbookStepType.test.ts +147 -8
- package/Tests/UI/Rum/RecordingHealthDashboard.test.tsx +769 -1
- package/Tests/Utils/AiRemediation/Resource/CephCommandPolicy.test.ts +1653 -0
- package/Tests/Utils/AiRemediation/Resource/CephOutputRedaction.test.ts +204 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseCommandPolicy.test.ts +1077 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.test.ts +558 -0
- package/Tests/Utils/AiRemediation/Resource/DatabaseQueryRedactor.test.ts +834 -0
- package/Tests/Utils/AiRemediation/Resource/DockerCliGrammar.test.ts +747 -0
- package/Tests/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.test.ts +1259 -0
- package/Tests/Utils/AiRemediation/Resource/DockerOutputRedaction.test.ts +386 -0
- package/Tests/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.test.ts +782 -0
- package/Tests/Utils/AiRemediation/Resource/GovcCommandPolicy.test.ts +2259 -0
- package/Tests/Utils/AiRemediation/Resource/HostCommandPolicy.test.ts +2019 -0
- package/Tests/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.test.ts +2497 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicy.test.ts +1305 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.test.ts +585 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactor.test.ts +334 -0
- package/Tests/Utils/AiRemediation/Resource/ResourceOutputRedactorCopyParity.test.ts +98 -0
- package/Tests/Utils/AiRemediation/Resource/ResourcePolicyImportClosure.test.ts +391 -0
- package/Tests/Utils/AiRemediation/ResourceAiAgentPolicyCopyParity.test.ts +497 -0
- package/Tests/Utils/SessionReplay/SessionReplayBudgetMetricType.test.ts +383 -0
- package/Types/AI/ResourceAiAccessApi.ts +140 -0
- package/Types/AI/ResourceAiAccessPermissions.ts +126 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.ts +183 -2
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +55 -22
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +35 -3
- package/Types/Monitor/RumAlertTemplates.ts +351 -4
- package/Types/ResourceAiAgent/AiResourceType.ts +310 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.ts +574 -0
- package/Types/Rum/SessionReplayBudgetMetricType.ts +47 -0
- package/Types/Runbook/RunbookStepType.ts +29 -0
- package/Types/Telemetry/TelemetryIngestSurface.ts +14 -2
- package/Utils/AI/InvestigationReport.ts +121 -15
- package/Utils/AiRemediation/Resource/CephCommandPolicy.ts +1936 -0
- package/Utils/AiRemediation/Resource/DatabaseCommandPolicy.ts +166 -0
- package/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.ts +1532 -0
- package/Utils/AiRemediation/Resource/DatabaseQueryRedactor.ts +1394 -0
- package/Utils/AiRemediation/Resource/DockerCliGrammar.ts +1839 -0
- package/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.ts +490 -0
- package/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.ts +687 -0
- package/Utils/AiRemediation/Resource/GovcCommandPolicy.ts +2096 -0
- package/Utils/AiRemediation/Resource/HostCommandPolicy.ts +2982 -0
- package/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.ts +1679 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.ts +851 -0
- package/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.ts +593 -0
- package/Utils/AiRemediation/Resource/ResourceOutputRedactor.ts +2812 -0
- package/Utils/SessionReplay/SessionReplayBudgetMetricType.ts +184 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/build/dist/Models/DatabaseModels/AutoRemediationSuggestion.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CephCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +219 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Host.js +219 -0
- package/build/dist/Models/DatabaseModels/Host.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/PodmanHost.js +219 -0
- package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +219 -0
- package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js +439 -0
- package/build/dist/Models/DatabaseModels/ResourceAiAgent.js.map +1 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js +145 -0
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js +219 -0
- package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
- package/build/dist/Server/API/AutoRemediationAPI.js +231 -1
- package/build/dist/Server/API/AutoRemediationAPI.js.map +1 -1
- package/build/dist/Server/API/ResourceAiAccessAPI.js +1119 -0
- package/build/dist/Server/API/ResourceAiAccessAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js +168 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796300000000-AddResourceAiAgents.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Semaphore.js +6 -0
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +12 -5
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +26 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js +601 -3
- package/build/dist/Server/Services/AutoRemediationRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/CephClusterService.js +104 -0
- package/build/dist/Server/Services/CephClusterService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseServerService.js +99 -0
- package/build/dist/Server/Services/DatabaseServerService.js.map +1 -1
- package/build/dist/Server/Services/DockerHostService.js +104 -0
- package/build/dist/Server/Services/DockerHostService.js.map +1 -1
- package/build/dist/Server/Services/DockerSwarmClusterService.js +104 -0
- package/build/dist/Server/Services/DockerSwarmClusterService.js.map +1 -1
- package/build/dist/Server/Services/HostService.js +114 -2
- package/build/dist/Server/Services/HostService.js.map +1 -1
- package/build/dist/Server/Services/MetricRecordingRuleService.js +46 -0
- package/build/dist/Server/Services/MetricRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/PodmanHostService.js +104 -0
- package/build/dist/Server/Services/PodmanHostService.js.map +1 -1
- package/build/dist/Server/Services/ProxmoxClusterService.js +104 -0
- package/build/dist/Server/Services/ProxmoxClusterService.js.map +1 -1
- package/build/dist/Server/Services/ResourceAiAccessService.js +1028 -0
- package/build/dist/Server/Services/ResourceAiAccessService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js +173 -0
- package/build/dist/Server/Services/ResourceAiAgentJobService.js.map +1 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js +1687 -0
- package/build/dist/Server/Services/ResourceAiAgentService.js.map +1 -0
- package/build/dist/Server/Services/RunnerJobService.js +344 -5
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +26 -0
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/TraceRecordingRuleService.js +37 -0
- package/build/dist/Server/Services/TraceRecordingRuleService.js.map +1 -1
- package/build/dist/Server/Services/VMwareVCenterService.js +104 -0
- package/build/dist/Server/Services/VMwareVCenterService.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +1029 -30
- package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +633 -28
- package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js +21 -1
- package/build/dist/Server/Utils/AI/Remediation/RemediationPlanRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +330 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js +160 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessContext.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js +33 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAccessToolNames.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js +640 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiAccessSettings.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js +226 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceAiDeleteCleanup.js.map +1 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +600 -0
- package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +50 -4
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +55 -4
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js +290 -13
- package/build/dist/Server/Utils/AutoRemediation/CommandPlanExecutor.js.map +1 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js +29 -1
- package/build/dist/Server/Utils/AutoRemediation/RemediationVerifier.js.map +1 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +9 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js +627 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayBudgetMetrics.js.map +1 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js +60 -5
- package/build/dist/Server/Utils/SessionReplay/SessionReplayUsage.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +17 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +183 -209
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +19 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +233 -167
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +263 -110
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js +129 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsActivityDeduplicator.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js +266 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCardChoices.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js +258 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsCreateCommands.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js +104 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsMessageSize.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js +183 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsReplies.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js +123 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeamsTimezone.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js +30 -0
- package/build/dist/Types/AI/ResourceAiAccessApi.js.map +1 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js +98 -0
- package/build/dist/Types/AI/ResourceAiAccessPermissions.js.map +1 -0
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js +116 -29
- package/build/dist/Types/AutoRemediation/AiRemediationCommandPlan.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +47 -21
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +5 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
- package/build/dist/Types/Monitor/RumAlertTemplates.js +199 -3
- package/build/dist/Types/Monitor/RumAlertTemplates.js.map +1 -1
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js +242 -0
- package/build/dist/Types/ResourceAiAgent/AiResourceType.js.map +1 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +275 -0
- package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js +45 -0
- package/build/dist/Types/Rum/SessionReplayBudgetMetricType.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js +27 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +13 -2
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -1
- package/build/dist/Utils/AI/InvestigationReport.js +71 -11
- package/build/dist/Utils/AI/InvestigationReport.js.map +1 -1
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js +1462 -0
- package/build/dist/Utils/AiRemediation/Resource/CephCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js +122 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js +1139 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js +1060 -0
- package/build/dist/Utils/AiRemediation/Resource/DatabaseQueryRedactor.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js +1301 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerCliGrammar.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js +370 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerEngineCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js +498 -0
- package/build/dist/Utils/AiRemediation/Resource/DockerSwarmCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js +1565 -0
- package/build/dist/Utils/AiRemediation/Resource/GovcCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js +2206 -0
- package/build/dist/Utils/AiRemediation/Resource/HostCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js +1129 -0
- package/build/dist/Utils/AiRemediation/Resource/ProxmoxCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +565 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicy.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js +408 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceCommandPolicyCore.js.map +1 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js +1910 -0
- package/build/dist/Utils/AiRemediation/Resource/ResourceOutputRedactor.js.map +1 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js +160 -0
- package/build/dist/Utils/SessionReplay/SessionReplayBudgetMetricType.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ALL_DATABASE_ENGINES,
|
|
3
|
+
DATABASE_DEFAULT_ROW_LIMIT,
|
|
4
|
+
DATABASE_DIAGNOSTIC_OPERATIONS,
|
|
5
|
+
DATABASE_ENGINE_DISPLAY_NAMES,
|
|
6
|
+
DATABASE_MAX_ROW_LIMIT,
|
|
7
|
+
DATABASE_OPERATION_NAMES,
|
|
8
|
+
DATABASE_PROGRAM,
|
|
9
|
+
DatabaseCommandParse,
|
|
10
|
+
DatabaseEngine,
|
|
11
|
+
DatabaseOperationSpec,
|
|
12
|
+
DatabaseParamKind,
|
|
13
|
+
DatabaseParamSpec,
|
|
14
|
+
MONGODB_SERVER_STATUS_SECTIONS,
|
|
15
|
+
ParsedDatabaseCommand,
|
|
16
|
+
REDIS_INFO_SECTIONS,
|
|
17
|
+
describeDatabaseOperationUsage,
|
|
18
|
+
getDatabaseEngineRefusal,
|
|
19
|
+
getDatabaseOperation,
|
|
20
|
+
getDatabaseOperationsForEngine,
|
|
21
|
+
getDatabaseReadCommandGuide,
|
|
22
|
+
getDatabaseWriteCommandGuide,
|
|
23
|
+
isDatabaseCredentialSettingName,
|
|
24
|
+
parseDatabaseCommand,
|
|
25
|
+
parseDatabaseEngine,
|
|
26
|
+
} from "../../../../Utils/AiRemediation/Resource/DatabaseDiagnosticCatalog";
|
|
27
|
+
import { tokenizeResourceCommand } from "../../../../Utils/AiRemediation/Resource/ResourceCommandPolicyCore";
|
|
28
|
+
import { ResourceCommandTier } from "../../../../Types/ResourceAiAgent/ResourceAiAccess";
|
|
29
|
+
import { describe, expect, test } from "@jest/globals";
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* Contract under test — DatabaseDiagnosticCatalog, the closed set of `db`
|
|
33
|
+
* operations the Database AI agent's executor imports.
|
|
34
|
+
*
|
|
35
|
+
* - The catalog is well formed: unique lowercase-dash names, every
|
|
36
|
+
* operation on at least one engine with an implementation for each, only
|
|
37
|
+
* cancel-query (SafeWrite) and terminate-session (RiskyWrite) change
|
|
38
|
+
* anything, and both take a required session id.
|
|
39
|
+
* - parseDatabaseCommand hands the executor typed values (numbers for
|
|
40
|
+
* limits and ids) and a canonical argv that re-parses to itself.
|
|
41
|
+
* - Engine support: parseDatabaseEngine reads DATABASE_SYSTEM spellings,
|
|
42
|
+
* getDatabaseEngineRefusal refuses what an engine lacks, and the guides
|
|
43
|
+
* can be written for one engine.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
function parse(command: string): DatabaseCommandParse {
|
|
47
|
+
return parseDatabaseCommand(tokenizeResourceCommand(command).argv);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function parsed(command: string): ParsedDatabaseCommand {
|
|
51
|
+
const result: DatabaseCommandParse = parse(command);
|
|
52
|
+
|
|
53
|
+
if (!result.ok) {
|
|
54
|
+
throw new Error(`${command} did not parse: ${result.errorMessage}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return result.command;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe("the catalog is well formed", () => {
|
|
61
|
+
test("operation names and aliases are unique lowercase words joined by dashes", () => {
|
|
62
|
+
const seen: Array<string> = [];
|
|
63
|
+
|
|
64
|
+
for (const operation of DATABASE_DIAGNOSTIC_OPERATIONS) {
|
|
65
|
+
for (const name of [operation.name, ...operation.aliases]) {
|
|
66
|
+
expect(name).toMatch(/^[a-z]+(?:-[a-z]+)*$/);
|
|
67
|
+
expect(seen).not.toContain(name);
|
|
68
|
+
seen.push(name);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
expect(DATABASE_OPERATION_NAMES).toEqual(
|
|
73
|
+
DATABASE_DIAGNOSTIC_OPERATIONS.map((operation: DatabaseOperationSpec) => {
|
|
74
|
+
return operation.name;
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("pins the operations and their tiers", () => {
|
|
80
|
+
const tiers: Record<string, ResourceCommandTier> = {};
|
|
81
|
+
|
|
82
|
+
for (const operation of DATABASE_DIAGNOSTIC_OPERATIONS) {
|
|
83
|
+
tiers[operation.name] = operation.tier;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
expect(tiers).toEqual({
|
|
87
|
+
ping: ResourceCommandTier.Read,
|
|
88
|
+
version: ResourceCommandTier.Read,
|
|
89
|
+
sessions: ResourceCommandTier.Read,
|
|
90
|
+
"long-queries": ResourceCommandTier.Read,
|
|
91
|
+
blocking: ResourceCommandTier.Read,
|
|
92
|
+
locks: ResourceCommandTier.Read,
|
|
93
|
+
replication: ResourceCommandTier.Read,
|
|
94
|
+
connections: ResourceCommandTier.Read,
|
|
95
|
+
"database-sizes": ResourceCommandTier.Read,
|
|
96
|
+
"table-sizes": ResourceCommandTier.Read,
|
|
97
|
+
"top-statements": ResourceCommandTier.Read,
|
|
98
|
+
settings: ResourceCommandTier.Read,
|
|
99
|
+
slowlog: ResourceCommandTier.Read,
|
|
100
|
+
info: ResourceCommandTier.Read,
|
|
101
|
+
"innodb-status": ResourceCommandTier.Read,
|
|
102
|
+
memory: ResourceCommandTier.Read,
|
|
103
|
+
keyspace: ResourceCommandTier.Read,
|
|
104
|
+
"cancel-query": ResourceCommandTier.SafeWrite,
|
|
105
|
+
"terminate-session": ResourceCommandTier.RiskyWrite,
|
|
106
|
+
});
|
|
107
|
+
expect(getDatabaseOperation("current-ops")!.name).toBe("sessions");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test.each(
|
|
111
|
+
DATABASE_DIAGNOSTIC_OPERATIONS.map(
|
|
112
|
+
(operation: DatabaseOperationSpec): [string, DatabaseOperationSpec] => {
|
|
113
|
+
return [operation.name, operation];
|
|
114
|
+
},
|
|
115
|
+
),
|
|
116
|
+
)("%s", (_name: string, operation: DatabaseOperationSpec) => {
|
|
117
|
+
expect(operation.engines.length).toBeGreaterThan(0);
|
|
118
|
+
expect(Object.keys(operation.implementation).sort()).toEqual(
|
|
119
|
+
[...operation.engines].sort(),
|
|
120
|
+
);
|
|
121
|
+
expect(operation.summary.length).toBeGreaterThan(10);
|
|
122
|
+
expect(operation.summary.endsWith(".")).toBe(false);
|
|
123
|
+
|
|
124
|
+
const flagNames: Array<string> = operation.flags.map(
|
|
125
|
+
(flag: DatabaseParamSpec): string => {
|
|
126
|
+
return flag.name;
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
expect(new Set(flagNames).size).toBe(flagNames.length);
|
|
131
|
+
|
|
132
|
+
for (const flag of operation.flags) {
|
|
133
|
+
expect(flag.name).toMatch(/^[a-z]+(?:-[a-z]+)*$/);
|
|
134
|
+
|
|
135
|
+
for (const engine of flag.engines || []) {
|
|
136
|
+
expect(operation.engines).toContain(engine);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (flag.kind === DatabaseParamKind.Integer) {
|
|
140
|
+
expect(flag.minimum).toBeLessThanOrEqual(flag.defaultValue!);
|
|
141
|
+
expect(flag.defaultValue).toBeLessThanOrEqual(flag.maximum!);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (operation.tier === ResourceCommandTier.Read) {
|
|
146
|
+
expect(operation.argument === null || !operation.argument.required).toBe(
|
|
147
|
+
true,
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
expect(operation.argument).not.toBeNull();
|
|
151
|
+
expect(operation.argument!.required).toBe(true);
|
|
152
|
+
expect(operation.argument!.kind).toBe(DatabaseParamKind.SessionId);
|
|
153
|
+
expect(operation.flags).toEqual([]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (operation.argument && operation.argument.choicesByEngine) {
|
|
157
|
+
for (const engine of Object.keys(operation.argument.choicesByEngine)) {
|
|
158
|
+
expect(operation.engines).toContain(engine);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("the program is db", () => {
|
|
164
|
+
expect(DATABASE_PROGRAM).toBe("db");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("row limits are bounded", () => {
|
|
168
|
+
expect(DATABASE_MAX_ROW_LIMIT).toBe(200);
|
|
169
|
+
expect(DATABASE_DEFAULT_ROW_LIMIT).toBeLessThanOrEqual(
|
|
170
|
+
DATABASE_MAX_ROW_LIMIT,
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("the info sections hold no catch-all", () => {
|
|
175
|
+
for (const all of ["all", "everything", "default"]) {
|
|
176
|
+
expect(REDIS_INFO_SECTIONS).not.toContain(all);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
expect(MONGODB_SERVER_STATUS_SECTIONS).not.toContain("security");
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe("getDatabaseOperation", () => {
|
|
184
|
+
test.each([
|
|
185
|
+
["sessions", "sessions"],
|
|
186
|
+
["current-ops", "sessions"],
|
|
187
|
+
["cancel-query", "cancel-query"],
|
|
188
|
+
["Sessions", null],
|
|
189
|
+
["cancel_query", null],
|
|
190
|
+
["", null],
|
|
191
|
+
["constructor", null],
|
|
192
|
+
["__proto__", null],
|
|
193
|
+
])("%p", (word: string, expected: string | null) => {
|
|
194
|
+
const operation: DatabaseOperationSpec | null = getDatabaseOperation(word);
|
|
195
|
+
|
|
196
|
+
expect(operation ? operation.name : null).toBe(expected);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("a non-string is no operation", () => {
|
|
200
|
+
expect(getDatabaseOperation(null)).toBeNull();
|
|
201
|
+
expect(getDatabaseOperation(42)).toBeNull();
|
|
202
|
+
expect(getDatabaseOperation(["sessions"])).toBeNull();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe("parseDatabaseCommand hands the executor typed values", () => {
|
|
207
|
+
test("numbers are numbers, names are strings, the canonical argv is ordered", () => {
|
|
208
|
+
const command: ParsedDatabaseCommand = parsed(
|
|
209
|
+
"db sessions --user=bob --state idle --limit 7",
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
expect(command.operation.name).toBe("sessions");
|
|
213
|
+
expect(command.argument).toBeNull();
|
|
214
|
+
expect(command.flags).toEqual({ limit: 7, state: "idle", user: "bob" });
|
|
215
|
+
expect(command.canonicalArgs).toEqual([
|
|
216
|
+
"sessions",
|
|
217
|
+
"--limit",
|
|
218
|
+
"7",
|
|
219
|
+
"--state",
|
|
220
|
+
"idle",
|
|
221
|
+
"--user",
|
|
222
|
+
"bob",
|
|
223
|
+
]);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test("a session id is a number", () => {
|
|
227
|
+
const command: ParsedDatabaseCommand = parsed("db cancel-query 123");
|
|
228
|
+
|
|
229
|
+
expect(command.argument).toBe(123);
|
|
230
|
+
expect(command.flags).toEqual({});
|
|
231
|
+
expect(command.canonicalArgs).toEqual(["cancel-query", "123"]);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test("the largest id is exact as a number", () => {
|
|
235
|
+
expect(parsed("db terminate-session 999999999999999").argument).toBe(
|
|
236
|
+
999999999999999,
|
|
237
|
+
);
|
|
238
|
+
expect(Number.isSafeInteger(999999999999999)).toBe(true);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test("a choice argument is a string", () => {
|
|
242
|
+
expect(parsed("db info globalLock").argument).toBe("globalLock");
|
|
243
|
+
expect(parsed("db settings work_mem").argument).toBe("work_mem");
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test("an alias parses to its operation", () => {
|
|
247
|
+
expect(parsed("db current-ops --limit 3").operation.name).toBe("sessions");
|
|
248
|
+
expect(parsed("db current-ops --limit 3").canonicalArgs).toEqual([
|
|
249
|
+
"sessions",
|
|
250
|
+
"--limit",
|
|
251
|
+
"3",
|
|
252
|
+
]);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test.each([
|
|
256
|
+
["db sessions --limit 5 --state active --user bob --database app"],
|
|
257
|
+
["db long-queries --min-seconds 0 --limit 200"],
|
|
258
|
+
["db table-sizes --database app --limit 1"],
|
|
259
|
+
["db settings maxmemory-policy"],
|
|
260
|
+
["db info opcountersRepl"],
|
|
261
|
+
["db cancel-query 5"],
|
|
262
|
+
])("%s re-parses to itself", (command: string) => {
|
|
263
|
+
const first: ParsedDatabaseCommand = parsed(command);
|
|
264
|
+
const second: ParsedDatabaseCommand = parsed(
|
|
265
|
+
["db", ...first.canonicalArgs].join(" "),
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
expect(second).toEqual(first);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
test.each([
|
|
272
|
+
[null],
|
|
273
|
+
[undefined],
|
|
274
|
+
[[]],
|
|
275
|
+
["db ping"],
|
|
276
|
+
[["db", 5]],
|
|
277
|
+
[["sql", "ping"]],
|
|
278
|
+
])("%p is refused, not thrown", (argv: unknown) => {
|
|
279
|
+
const result: DatabaseCommandParse = parseDatabaseCommand(argv);
|
|
280
|
+
|
|
281
|
+
expect(result.ok).toBe(false);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
describe("parseDatabaseEngine", () => {
|
|
286
|
+
test.each([
|
|
287
|
+
["postgresql", DatabaseEngine.PostgreSQL],
|
|
288
|
+
["PostgreSQL", DatabaseEngine.PostgreSQL],
|
|
289
|
+
[" postgres ", DatabaseEngine.PostgreSQL],
|
|
290
|
+
["pg", DatabaseEngine.PostgreSQL],
|
|
291
|
+
["pgsql", DatabaseEngine.PostgreSQL],
|
|
292
|
+
["mysql", DatabaseEngine.MySQL],
|
|
293
|
+
["mariadb", DatabaseEngine.MySQL],
|
|
294
|
+
["percona", DatabaseEngine.MySQL],
|
|
295
|
+
["redis", DatabaseEngine.Redis],
|
|
296
|
+
["valkey", DatabaseEngine.Redis],
|
|
297
|
+
["keydb", DatabaseEngine.Redis],
|
|
298
|
+
["dragonfly", DatabaseEngine.Redis],
|
|
299
|
+
["mongodb", DatabaseEngine.MongoDB],
|
|
300
|
+
["mongo", DatabaseEngine.MongoDB],
|
|
301
|
+
["microsoft.sql_server", null],
|
|
302
|
+
["oracle.db", null],
|
|
303
|
+
["elasticsearch", null],
|
|
304
|
+
["memcached", null],
|
|
305
|
+
["", null],
|
|
306
|
+
["constructor", null],
|
|
307
|
+
["__proto__", null],
|
|
308
|
+
[null, null],
|
|
309
|
+
[5, null],
|
|
310
|
+
])("%p", (value: unknown, expected: DatabaseEngine | null) => {
|
|
311
|
+
expect(parseDatabaseEngine(value)).toBe(expected);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("every engine has a display name", () => {
|
|
315
|
+
expect(ALL_DATABASE_ENGINES.length).toBe(4);
|
|
316
|
+
|
|
317
|
+
for (const engine of ALL_DATABASE_ENGINES) {
|
|
318
|
+
expect(DATABASE_ENGINE_DISPLAY_NAMES[engine].length).toBeGreaterThan(0);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
describe("getDatabaseEngineRefusal", () => {
|
|
324
|
+
test.each([
|
|
325
|
+
["db sessions", "redis", null],
|
|
326
|
+
["db sessions --limit 5 --user bob", "redis", null],
|
|
327
|
+
[
|
|
328
|
+
"db sessions --state idle",
|
|
329
|
+
"redis",
|
|
330
|
+
"--state is not available for db sessions on Redis",
|
|
331
|
+
],
|
|
332
|
+
["db sessions --state idle", "postgresql", null],
|
|
333
|
+
["db keyspace", "postgresql", "db keyspace is not available on PostgreSQL"],
|
|
334
|
+
["db keyspace", "valkey", null],
|
|
335
|
+
["db innodb-status", "mariadb", null],
|
|
336
|
+
["db innodb-status", "mongodb", "not available on MongoDB"],
|
|
337
|
+
["db top-statements", "mongodb", "not available on MongoDB"],
|
|
338
|
+
["db long-queries", "redis", "not available on Redis"],
|
|
339
|
+
["db info memory", "redis", null],
|
|
340
|
+
["db info", "redis", null],
|
|
341
|
+
["db info globalLock", "redis", "is not a SECTION on Redis"],
|
|
342
|
+
["db info mem", "mongodb", null],
|
|
343
|
+
["db info memory", "mongodb", "is not a SECTION on MongoDB"],
|
|
344
|
+
["db info memory", "postgresql", "not available on PostgreSQL"],
|
|
345
|
+
["db cancel-query 5", "postgresql", null],
|
|
346
|
+
["db cancel-query 5", "mongodb", null],
|
|
347
|
+
["db cancel-query 5", "redis", "not available on Redis"],
|
|
348
|
+
["db terminate-session 5", "redis", null],
|
|
349
|
+
["db terminate-session 5", "mysql", null],
|
|
350
|
+
["db terminate-session 5", "mongodb", "not available on MongoDB"],
|
|
351
|
+
["db slowlog", "redis", null],
|
|
352
|
+
["db slowlog", "postgresql", "not available on PostgreSQL"],
|
|
353
|
+
["db ping", "oracle.db", "does not know the engine"],
|
|
354
|
+
["db ping", "", "does not know the engine"],
|
|
355
|
+
])("%s on %s", (command: string, engine: string, refusal: string | null) => {
|
|
356
|
+
const described: string | null = getDatabaseEngineRefusal(
|
|
357
|
+
parsed(command),
|
|
358
|
+
engine,
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
if (refusal === null) {
|
|
362
|
+
expect(described).toBeNull();
|
|
363
|
+
} else {
|
|
364
|
+
expect(described).toContain(refusal);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
test("a refusal lists what the engine does have", () => {
|
|
369
|
+
const described: string = getDatabaseEngineRefusal(
|
|
370
|
+
parsed("db keyspace"),
|
|
371
|
+
"postgresql",
|
|
372
|
+
)!;
|
|
373
|
+
|
|
374
|
+
for (const operation of getDatabaseOperationsForEngine(
|
|
375
|
+
DatabaseEngine.PostgreSQL,
|
|
376
|
+
)) {
|
|
377
|
+
expect(described).toContain(operation.name);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test("a missing engine or command is refused, not thrown", () => {
|
|
382
|
+
expect(getDatabaseEngineRefusal(parsed("db ping"), undefined)).toContain(
|
|
383
|
+
"does not know the engine",
|
|
384
|
+
);
|
|
385
|
+
expect(
|
|
386
|
+
getDatabaseEngineRefusal(
|
|
387
|
+
null as unknown as ParsedDatabaseCommand,
|
|
388
|
+
"postgresql",
|
|
389
|
+
),
|
|
390
|
+
).toContain("could not be read");
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
test("every engine has the health checks Test connection runs", () => {
|
|
394
|
+
for (const engine of ALL_DATABASE_ENGINES) {
|
|
395
|
+
expect(getDatabaseEngineRefusal(parsed("db ping"), engine)).toBeNull();
|
|
396
|
+
expect(getDatabaseEngineRefusal(parsed("db version"), engine)).toBeNull();
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
describe("isDatabaseCredentialSettingName", () => {
|
|
402
|
+
test.each([
|
|
403
|
+
["requirepass", true],
|
|
404
|
+
["masterauth", true],
|
|
405
|
+
// Valkey 8+ names masterauth primaryauth (and CONFIG GET * lists both)
|
|
406
|
+
["primaryauth", true],
|
|
407
|
+
["PRIMARYAUTH", true],
|
|
408
|
+
["sentinel-masterauth", true],
|
|
409
|
+
["password_encryption", true],
|
|
410
|
+
["tls-key-file-pass", true],
|
|
411
|
+
["ssl_key_file", true],
|
|
412
|
+
["security.keyFile", true],
|
|
413
|
+
["client_secret", true],
|
|
414
|
+
["api_token", true],
|
|
415
|
+
["work_mem", false],
|
|
416
|
+
["max_connections", false],
|
|
417
|
+
["maxmemory-policy", false],
|
|
418
|
+
["ssl_cert_file", false],
|
|
419
|
+
[null, false],
|
|
420
|
+
[7, false],
|
|
421
|
+
])("%p: %p", (name: unknown, expected: boolean) => {
|
|
422
|
+
expect(isDatabaseCredentialSettingName(name)).toBe(expected);
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
describe("describeDatabaseOperationUsage", () => {
|
|
427
|
+
test.each([
|
|
428
|
+
["ping", null, "db ping"],
|
|
429
|
+
["cancel-query", null, "db cancel-query ID"],
|
|
430
|
+
["settings", null, "db settings [NAME]"],
|
|
431
|
+
["info", null, "db info [SECTION]"],
|
|
432
|
+
[
|
|
433
|
+
"sessions",
|
|
434
|
+
null,
|
|
435
|
+
"db sessions [--limit N] [--state active|idle|idle-in-transaction] [--user NAME] [--database NAME]",
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
"sessions",
|
|
439
|
+
DatabaseEngine.Redis,
|
|
440
|
+
"db sessions [--limit N] [--user NAME] [--database NAME]",
|
|
441
|
+
],
|
|
442
|
+
])(
|
|
443
|
+
"%s on %p",
|
|
444
|
+
(name: string, engine: DatabaseEngine | null, expected: string) => {
|
|
445
|
+
expect(
|
|
446
|
+
describeDatabaseOperationUsage(getDatabaseOperation(name)!, engine),
|
|
447
|
+
).toBe(expected);
|
|
448
|
+
},
|
|
449
|
+
);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
describe("the guides", () => {
|
|
453
|
+
function bullets(guide: string): Array<string> {
|
|
454
|
+
return guide.split("\n");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
test("every line is a markdown bullet", () => {
|
|
458
|
+
for (const guide of [
|
|
459
|
+
getDatabaseReadCommandGuide(),
|
|
460
|
+
getDatabaseWriteCommandGuide(),
|
|
461
|
+
getDatabaseReadCommandGuide("redis"),
|
|
462
|
+
getDatabaseWriteCommandGuide("mongodb"),
|
|
463
|
+
]) {
|
|
464
|
+
for (const line of bullets(guide)) {
|
|
465
|
+
expect(line.startsWith("- ")).toBe(true);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
test("the read guide names every read operation and no change", () => {
|
|
471
|
+
const guide: string = getDatabaseReadCommandGuide();
|
|
472
|
+
|
|
473
|
+
for (const operation of DATABASE_DIAGNOSTIC_OPERATIONS) {
|
|
474
|
+
if (operation.tier === ResourceCommandTier.Read) {
|
|
475
|
+
expect(guide).toContain(`\`db ${operation.name}`);
|
|
476
|
+
} else {
|
|
477
|
+
expect(guide).not.toContain(operation.name);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
expect(guide).toContain("never SQL");
|
|
482
|
+
expect(guide).toContain("--limit=20");
|
|
483
|
+
expect(guide).toContain("db current-ops");
|
|
484
|
+
expect(guide).toContain("(Redis)");
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
test.each([
|
|
488
|
+
[
|
|
489
|
+
"postgresql",
|
|
490
|
+
["db long-queries", "db top-statements", "--state"],
|
|
491
|
+
["db keyspace", "db innodb-status", "db info", "db slowlog", "db memory"],
|
|
492
|
+
],
|
|
493
|
+
[
|
|
494
|
+
"mariadb",
|
|
495
|
+
["db innodb-status", "db slowlog", "db top-statements"],
|
|
496
|
+
["db keyspace", "db info", "db memory"],
|
|
497
|
+
],
|
|
498
|
+
[
|
|
499
|
+
"redis",
|
|
500
|
+
["db keyspace", "db info [SECTION]", "db slowlog", "commandstats"],
|
|
501
|
+
["db long-queries", "--state", "db blocking", "globalLock"],
|
|
502
|
+
],
|
|
503
|
+
[
|
|
504
|
+
"mongodb",
|
|
505
|
+
["db info [SECTION]", "globalLock", "db memory", "--state"],
|
|
506
|
+
["db keyspace", "commandstats", "db top-statements"],
|
|
507
|
+
],
|
|
508
|
+
])(
|
|
509
|
+
"the read guide for %s",
|
|
510
|
+
(engine: string, present: Array<string>, absent: Array<string>) => {
|
|
511
|
+
const guide: string = getDatabaseReadCommandGuide(engine);
|
|
512
|
+
|
|
513
|
+
for (const text of present) {
|
|
514
|
+
expect(guide).toContain(text);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
for (const text of absent) {
|
|
518
|
+
expect(guide).not.toContain(text);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Written for one engine: no engine tags.
|
|
522
|
+
expect(guide).not.toContain("(PostgreSQL, MySQL/MariaDB");
|
|
523
|
+
},
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
test("an unknown engine gets the full guide", () => {
|
|
527
|
+
expect(getDatabaseReadCommandGuide("oracle.db")).toBe(
|
|
528
|
+
getDatabaseReadCommandGuide(),
|
|
529
|
+
);
|
|
530
|
+
expect(getDatabaseWriteCommandGuide(undefined)).toBe(
|
|
531
|
+
getDatabaseWriteCommandGuide(),
|
|
532
|
+
);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
test.each([
|
|
536
|
+
[undefined, ["cancel-query", "terminate-session"]],
|
|
537
|
+
["postgresql", ["cancel-query", "terminate-session"]],
|
|
538
|
+
["mysql", ["cancel-query", "terminate-session"]],
|
|
539
|
+
["redis", ["terminate-session"]],
|
|
540
|
+
["mongodb", ["cancel-query"]],
|
|
541
|
+
])(
|
|
542
|
+
"the write guide for %p",
|
|
543
|
+
(engine: string | undefined, operations: Array<string>) => {
|
|
544
|
+
const guide: string = getDatabaseWriteCommandGuide(engine);
|
|
545
|
+
|
|
546
|
+
for (const name of ["cancel-query", "terminate-session"]) {
|
|
547
|
+
if (operations.includes(name)) {
|
|
548
|
+
expect(guide).toContain(`\`db ${name} ID\``);
|
|
549
|
+
} else {
|
|
550
|
+
expect(guide).not.toContain(name);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
expect(guide).toContain("session:ID");
|
|
555
|
+
expect(guide).toContain("Nothing else changes the database");
|
|
556
|
+
},
|
|
557
|
+
);
|
|
558
|
+
});
|