@oneuptime/common 14.0.3 → 14.0.6
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/Alert.ts +55 -0
- package/Models/DatabaseModels/DatabaseServer.ts +1650 -0
- package/Models/DatabaseModels/DatabaseServerEndpoint.ts +540 -0
- package/Models/DatabaseModels/DatabaseServerFeed.ts +625 -0
- package/Models/DatabaseModels/DatabaseServerLabelRule.ts +514 -0
- package/Models/DatabaseModels/DatabaseServerOwnerRule.ts +596 -0
- package/Models/DatabaseModels/DatabaseServerOwnerTeam.ts +491 -0
- package/Models/DatabaseModels/DatabaseServerOwnerUser.ts +490 -0
- package/Models/DatabaseModels/Incident.ts +55 -0
- package/Models/DatabaseModels/Index.ts +16 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +26 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +55 -0
- package/Models/DatabaseModels/TelemetryException.ts +2 -0
- package/Models/DatabaseModels/UserProjectSsoConsent.ts +146 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.ts +673 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/MultipartFormData.ts +1 -1
- package/Server/Middleware/TelemetryIngest.ts +15 -8
- package/Server/Services/AlertReminderRuleService.ts +100 -24
- package/Server/Services/DatabaseServerEndpointService.ts +895 -0
- package/Server/Services/DatabaseServerFeedService.ts +128 -0
- package/Server/Services/DatabaseServerLabelRuleEngineService.ts +340 -0
- package/Server/Services/DatabaseServerLabelRuleService.ts +14 -0
- package/Server/Services/DatabaseServerOwnerRuleEngineService.ts +425 -0
- package/Server/Services/DatabaseServerOwnerRuleService.ts +14 -0
- package/Server/Services/DatabaseServerOwnerTeamService.ts +180 -0
- package/Server/Services/DatabaseServerOwnerUserService.ts +173 -0
- package/Server/Services/DatabaseServerService.ts +4546 -0
- package/Server/Services/DatabaseService.ts +14 -8
- package/Server/Services/DockerResourceService.ts +43 -2
- package/Server/Services/IncidentReminderRuleService.ts +103 -23
- package/Server/Services/Index.ts +16 -0
- package/Server/Services/InventoryItemService.ts +113 -5
- package/Server/Services/IoTDeviceService.ts +145 -37
- package/Server/Services/MetricService.ts +1 -1
- package/Server/Services/OpenTelemetryIngestService.ts +19 -0
- package/Server/Services/PodmanResourceService.ts +43 -2
- package/Server/Services/ScheduledMaintenanceReminderRuleService.ts +107 -23
- package/Server/Services/ServiceService.ts +1 -1
- package/Server/Services/TelemetryUsageBillingService.ts +29 -2
- package/Server/Services/UserProjectSsoConsentService.ts +74 -0
- package/Server/Services/UserService.ts +14 -1
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +18 -0
- package/Server/Types/Database/QueryHelper.ts +84 -2
- package/Server/Utils/AI/Toolbox/MetricTools.ts +13 -2
- package/Server/Utils/AI/Toolbox/ResourceTools.ts +81 -2
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +1 -1
- package/Server/Utils/Database/AffectedResourceRelations.ts +6 -0
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +33 -0
- package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +192 -9
- package/Server/Utils/Monitor/MonitorAlert.ts +28 -1
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +2264 -755
- package/Server/Utils/Monitor/MonitorIncident.ts +28 -1
- package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +268 -6
- package/Server/Utils/Monitor/MonitorResource.ts +47 -11
- package/Server/Utils/Monitor/MonitorResourceContext.ts +1 -0
- package/Server/Utils/Monitor/MonitorStepResourceIdentity.ts +239 -21
- package/Server/Utils/Monitor/PerSeriesResolutionRootCause.ts +43 -0
- package/Server/Utils/Monitor/SeriesResourceLabels.ts +291 -0
- package/Server/Utils/Monitor/SeriesResourceLinker.ts +111 -12
- package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +25 -0
- package/Server/Utils/StartServer.ts +26 -6
- package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +2 -0
- package/Server/Utils/Telemetry/DatabaseEndpointDiscovery.ts +688 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +5 -1
- package/Server/Utils/Telemetry/LogExceptionExtractor.ts +18 -1
- package/Server/Utils/Telemetry/ResourceEntityFilter.ts +175 -12
- package/Server/Utils/Telemetry/ResourceFacetResolver.ts +12 -0
- package/Server/Utils/Telemetry/ServiceDependencyDiscovery.ts +606 -36
- package/Server/Utils/Telemetry/Telemetry.ts +16 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +22 -22
- package/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.ts +16 -10
- package/Tests/App/Accounts/SignedInRedirect.test.tsx +241 -0
- package/Tests/App/AdminDashboard/AdminHeaderSmallScreens.test.tsx +221 -4
- package/Tests/App/Dashboard/AIInsightsResourcePageContext.test.ts +42 -0
- package/Tests/App/Dashboard/AffectedResourcesDisplay.test.tsx +100 -0
- package/Tests/App/Dashboard/AffectedResourcesPicker.test.tsx +86 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerHiddenTypes.test.tsx +2 -0
- package/Tests/App/Dashboard/AffectedResourcesSummaryStep.test.tsx +19 -0
- package/Tests/App/Dashboard/BreadcrumbCoverage.test.tsx +14 -0
- package/Tests/App/Dashboard/CorrelateFilterBuilder.test.tsx +26 -1
- package/Tests/App/Dashboard/DashboardAppSsoError.test.tsx +501 -0
- package/Tests/App/Dashboard/DashboardHeaderRequests.test.tsx +64 -1
- package/Tests/App/Dashboard/DashboardHeaderSmallScreens.test.tsx +178 -18
- package/Tests/App/Dashboard/DashboardMasterPageSsoRedirect.test.tsx +444 -0
- package/Tests/App/Dashboard/DashboardNavBarForeignHiddenRule.test.tsx +573 -0
- package/Tests/App/Dashboard/DatabaseChartAxes.test.tsx +431 -0
- package/Tests/App/Dashboard/DatabaseContainerDetailBadge.test.tsx +249 -0
- package/Tests/App/Dashboard/DatabaseDashboardE2EFixes.test.ts +681 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +1801 -0
- package/Tests/App/Dashboard/DatabaseFleetSummaryRefresh.test.tsx +280 -0
- package/Tests/App/Dashboard/DatabaseFormHelpers.test.tsx +321 -0
- package/Tests/App/Dashboard/DatabaseMetricMonitorLink.test.tsx +795 -0
- package/Tests/App/Dashboard/DatabaseOverviewHeader.test.tsx +580 -0
- package/Tests/App/Dashboard/DatabaseRecommendationsEngineMetrics.test.ts +270 -0
- package/Tests/App/Dashboard/DatabaseServerComponents.test.tsx +1486 -0
- package/Tests/App/Dashboard/DatabaseServerEngineMetricsFilter.test.ts +223 -0
- package/Tests/App/Dashboard/DatabaseServerPresentation.test.ts +435 -0
- package/Tests/App/Dashboard/DatabaseServerSummary.test.ts +186 -0
- package/Tests/App/Dashboard/DatabaseServerTelemetryQueries.test.ts +1553 -0
- package/Tests/App/Dashboard/DatabaseTableTruncation.test.tsx +326 -0
- package/Tests/App/Dashboard/DatabaseTelemetryScope.test.ts +512 -0
- package/Tests/App/Dashboard/DatabaseTelemetryTabs.test.tsx +774 -0
- package/Tests/App/Dashboard/DatabaseViewLayout.test.tsx +233 -0
- package/Tests/App/Dashboard/DatabaseWorkloadBadge.test.tsx +972 -0
- package/Tests/App/Dashboard/DiscoveryReviewInventoryRefresh.test.tsx +5 -0
- package/Tests/App/Dashboard/DiscoveryReviewUnnamedHostHint.test.tsx +1061 -0
- package/Tests/App/Dashboard/EventOverlayScope.test.ts +147 -0
- package/Tests/App/Dashboard/EventOverlayScopeHook.test.tsx +1 -0
- package/Tests/App/Dashboard/LogsResourceFacetChips.test.tsx +1 -0
- package/Tests/App/Dashboard/MetricsViewerDrillDown.test.tsx +310 -0
- package/Tests/App/Dashboard/MetricsViewerEntityScopedRows.test.tsx +495 -0
- package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +132 -1
- package/Tests/App/Dashboard/NavigationSearchKeywords.test.tsx +5 -0
- package/Tests/App/Dashboard/NetworkTopologyExplorerSearch.test.tsx +1267 -0
- package/Tests/App/Dashboard/ProductOrientation.test.tsx +4 -3
- package/Tests/App/Dashboard/RecommendationsLoadedContext.test.tsx +349 -0
- package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +62 -0
- package/Tests/App/Dashboard/ResourceFeedPageWiring.test.ts +8 -1
- package/Tests/App/Dashboard/ResourceFeedPagesFilterSort.test.tsx +14 -0
- package/Tests/App/Dashboard/ResourceOverviewTileTooltips.test.tsx +4 -1
- package/Tests/App/Dashboard/RumOverviewPage.test.tsx +127 -0
- package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +2 -0
- package/Tests/App/Dashboard/ServiceMapDatabaseLink.test.tsx +1085 -0
- package/Tests/App/Dashboard/SiteSearchBox.test.tsx +2110 -0
- package/Tests/App/Dashboard/TelemetryMetricsSignals.test.ts +168 -8
- package/Tests/App/Dashboard/TelemetryResourceRetentionSettings.test.tsx +10 -0
- package/Tests/App/Dashboard/TracesResourceFacets.test.tsx +2 -1
- package/Tests/App/StatusPage/StatusPageHeaderForeignHiddenRule.test.tsx +284 -0
- package/Tests/ClassStrings.ts +178 -0
- package/Tests/Fixtures/MobilePasskeyUser.json +1 -2
- package/Tests/ForeignHiddenRuleGuard.ts +2152 -0
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +2250 -0
- package/Tests/Models/DatabaseModels/ResourceFeedModels.test.ts +24 -5
- package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
- package/Tests/RenderedMarkup.ts +518 -0
- package/Tests/ResponsiveVisibility.test.ts +490 -4
- package/Tests/ResponsiveVisibility.ts +505 -52
- package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
- package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +541 -0
- package/Tests/Server/Infrastructure/Postgres/AddUserProjectSsoConsentMigration.test.ts +234 -0
- package/Tests/Server/Services/ContainerSnapshotUpsertPostgres.test.ts +319 -0
- package/Tests/Server/Services/CrossProjectRelationWriteGuard.test.ts +13 -0
- package/Tests/Server/Services/DatabaseServerEndpointService.test.ts +2033 -0
- package/Tests/Server/Services/DatabaseServerFeedAndOwnerServices.test.ts +529 -0
- package/Tests/Server/Services/DatabaseServerLifecycle.test.ts +3302 -0
- package/Tests/Server/Services/DatabaseServerRegistries.test.ts +603 -0
- package/Tests/Server/Services/DatabaseServerRuleEngines.test.ts +754 -0
- package/Tests/Server/Services/DatabaseServerService.test.ts +3558 -0
- package/Tests/Server/Services/DatabaseServerSqlPostgres.test.ts +2045 -0
- package/Tests/Server/Services/DatabaseServiceUpdateColumnsIfUnlockedPostgres.test.ts +362 -0
- package/Tests/Server/Services/DatabaseServiceUpdateColumnsIfUnlockedReply.test.ts +210 -0
- package/Tests/Server/Services/HookFreeWriteLengthClamp.test.ts +18 -0
- package/Tests/Server/Services/IncidentAlertSloLinkSurvivesEdit.test.ts +2 -0
- package/Tests/Server/Services/IncomingCallPolicyEscalationRuleTarget.test.ts +225 -0
- package/Tests/Server/Services/InventoryItemDisplayName.test.ts +280 -2
- package/Tests/Server/Services/InventoryUpsertSchemaParity.test.ts +8 -2
- package/Tests/Server/Services/IoTDeviceLatestMetricsPostgres.test.ts +689 -0
- package/Tests/Server/Services/IoTDeviceService.test.ts +379 -0
- package/Tests/Server/Services/LatestMetricsValuesShape.test.ts +360 -0
- package/Tests/Server/Services/LlmModelPriceService.test.ts +402 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +12 -0
- package/Tests/Server/Services/OpenTelemetryResourceRetentionMemo.test.ts +7 -1
- package/Tests/Server/Services/OwnerRowUniqueness.test.ts +61 -9
- package/Tests/Server/Services/ReminderRuleLookupPostgres.test.ts +2250 -0
- package/Tests/Server/Services/ReminderRuleRefreshOpenSubjectsPaging.test.ts +653 -0
- package/Tests/Server/Services/ResourceUpdateLastSeenLivenessFallback.test.ts +68 -20
- package/Tests/Server/Services/SavedViewDefaults.test.ts +325 -0
- package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +3 -3
- package/Tests/Server/Services/StatusPageCertificateService.test.ts +169 -0
- package/Tests/Server/Services/TeamComplianceSettingService.test.ts +191 -0
- package/Tests/Server/Services/TelemetryResourceFacetCounting.test.ts +9 -0
- package/Tests/Server/Services/UserProjectSsoConsentPostgres.test.ts +153 -0
- package/Tests/Server/Services/UserProjectSsoConsentService.test.ts +192 -0
- package/Tests/Server/Services/UserServiceFirstMasterAdminElection.test.ts +71 -0
- package/Tests/Server/Services/UserSignupIdTakeoverPostgres.test.ts +238 -0
- package/Tests/Server/Services/WorkspaceNotificationSummaryHelpers.test.ts +592 -0
- package/Tests/Server/Types/Billing/PayAsYouGoMeteredAuthorization.test.ts +3 -0
- package/Tests/Server/Types/Database/EventOverlayScopePostgres.test.ts +1 -0
- package/Tests/Server/Types/Database/FeedEventTypeFilterQuery.test.ts +11 -0
- package/Tests/Server/Types/Database/Permissions/InfrastructureOwnershipScope.test.ts +8 -0
- package/Tests/Server/Types/Database/QueryHelperBooleanForCriteriaBackedRule.test.ts +1094 -0
- package/Tests/Server/Types/Database/QueryHelperSearchAllWords.test.ts +651 -0
- package/Tests/Server/Utils/AI/AlertWriteTools.test.ts +256 -0
- package/Tests/Server/Utils/AI/IncidentWriteTools.test.ts +482 -0
- package/Tests/Server/Utils/AI/ResourceTools.test.ts +134 -0
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteria.test.ts +54 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +41 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaAnomalyUnits.test.ts +279 -9
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaDisplayContext.test.ts +933 -0
- package/Tests/Server/Utils/Monitor/DatabaseMaintenanceSuppression.test.ts +582 -0
- package/Tests/Server/Utils/Monitor/DatabaseServerMonitorLinking.test.ts +753 -0
- package/Tests/Server/Utils/Monitor/MetricDecimalThreshold.test.ts +417 -0
- package/Tests/Server/Utils/Monitor/MonitorActionTimestamps.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertCriteriaReferences.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +119 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +60 -25
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorAffectedResourceEdgeCases.test.ts +1815 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorKubernetesAffectedResources.test.ts +1447 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorKubernetesRatioEmail.test.ts +352 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformMetricUnits.test.ts +717 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformRawScan.test.ts +2125 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformSeriesAffectedResources.test.ts +1288 -0
- package/Tests/Server/Utils/Monitor/MonitorDependencySuppressionCreatorSkip.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentCriteriaReferences.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentMemberRoleMembership.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +88 -0
- package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +205 -0
- package/Tests/Server/Utils/Monitor/MonitorResourceContext.test.ts +62 -0
- package/Tests/Server/Utils/Monitor/MonitorResourceDatabaseMaintenance.test.ts +803 -0
- package/Tests/Server/Utils/Monitor/MonitorStepResourceIdentity.test.ts +133 -3
- package/Tests/Server/Utils/Monitor/MonitorSummaryPersistence.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +472 -1
- package/Tests/Server/Utils/Monitor/PerSeriesSecondEntityAlerting.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +236 -2
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +70 -0
- package/Tests/Server/Utils/StartServerProtobufContentType.test.ts +54 -0
- package/Tests/Server/Utils/Telemetry/DatabaseEndpointDiscovery.test.ts +1895 -0
- package/Tests/Server/Utils/Telemetry/EntityRegistry.test.ts +7 -0
- package/Tests/Server/Utils/Telemetry/LogExceptionExtractorSeverityGate.test.ts +90 -0
- package/Tests/Server/Utils/Telemetry/ResourceEntityFilter.test.ts +570 -0
- package/Tests/Server/Utils/Telemetry/ResourceFacetResolver.test.ts +97 -2
- package/Tests/Server/Utils/Telemetry/ServiceDependencyDiscovery.test.ts +1337 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +295 -0
- package/Tests/Types/AI/AIResourceContext.test.ts +30 -0
- package/Tests/Types/BaseDatabase/AggregationType.test.ts +5 -1
- package/Tests/Types/Dashboard/KubernetesDashboardTemplate.test.ts +184 -0
- package/Tests/Types/Dashboard/KubernetesDashboardTemplates.test.ts +107 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerClassifier.test.ts +3644 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommand.test.ts +340 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommandCorpus.ts +826 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommandPostgres.test.ts +150 -0
- package/Tests/Types/DatabaseServer/DatabaseEndpoint.test.ts +2657 -0
- package/Tests/Types/DatabaseServer/DatabaseServerDiscoverySource.test.ts +64 -0
- package/Tests/Types/DatabaseServer/DatabaseServerEntityKeys.test.ts +952 -0
- package/Tests/Types/DatabaseServer/DatabaseServerMetricCatalog.test.ts +1161 -0
- package/Tests/Types/DatabaseServer/DatabaseSystem.test.ts +1514 -0
- package/Tests/Types/DatabaseServer/DatabaseTelemetryResolver.test.ts +1558 -0
- package/Tests/Types/Monitor/CephAlertTemplates.test.ts +255 -6
- package/Tests/Types/Monitor/DatabaseAlertTemplates.test.ts +2254 -0
- package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +292 -0
- package/Tests/Types/Monitor/KubernetesMetricCatalog.test.ts +272 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +253 -9
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +13 -5
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +4 -2
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +111 -2
- package/Tests/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.test.ts +61 -0
- package/Tests/Types/Monitor/SeriesContext/SeriesLabelDisplay.test.ts +114 -0
- package/Tests/Types/Monitor/Utils/KubernetesAgentEmittedMetrics.ts +202 -0
- package/Tests/Types/NetworkDevice/DiscoveredHostNamingStatus.test.ts +401 -0
- package/Tests/Types/Telemetry/ResourceEntityFacet.test.ts +4 -1
- package/Tests/Types/Telemetry/ResourceFacetCatalog.test.ts +24 -2
- package/Tests/UI/Components/Card.test.tsx +93 -2
- package/Tests/UI/Components/FeedOptions.test.ts +6 -0
- package/Tests/UI/Components/FeedOptionsButton.test.tsx +8 -1
- package/Tests/UI/Components/ForeignHiddenRuleResilience.test.tsx +1147 -0
- package/Tests/UI/Components/HeaderRightRail.test.tsx +41 -1
- package/Tests/UI/Components/LogsEntityNames.test.ts +16 -1
- package/Tests/UI/Components/LogsFacetSidebarHiddenFacets.test.tsx +7 -3
- package/Tests/UI/Components/ResourceFacetConfigs.test.ts +2 -1
- package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
- package/Tests/UI/Components/SrOnlyForeignRule.test.tsx +994 -0
- package/Tests/UI/Components/StatusPage/ResourceListSelection.test.tsx +34 -1
- package/Tests/UI/Components/TelemetryFacetSidebarHiddenFacets.test.tsx +4 -1
- package/Tests/UI/ForeignHiddenRuleGuard.test.ts +1951 -0
- package/Tests/UI/Rum/ChunkLoader.test.ts +76 -0
- package/Tests/UI/Rum/ReplayPlayerChrome.test.tsx +19 -1
- package/Tests/UI/Rum/ReplayRailDetail.test.tsx +53 -0
- package/Tests/UI/Rum/ReplaySignals.test.ts +54 -0
- package/Tests/UI/Rum/ReplayTabSwitcher.test.tsx +19 -1
- package/Tests/UI/TailwindPlayCdnForeignHiddenRule.test.ts +1005 -0
- package/Tests/UI/ThemeGroupHoverReveal.test.ts +847 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +70 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +21 -0
- package/Tests/UI/Utils/ModelAPISsoRedirect.test.ts +127 -0
- package/Tests/UI/Utils/Navigation.test.ts +102 -0
- package/Tests/UI/Utils/Telemetry/TelemetryEntityNames.test.ts +23 -0
- package/Tests/Utils/Dashboard/KubernetesClusterCpuTileRepair.test.ts +370 -0
- package/Tests/Utils/LabelRuleImportExport.test.ts +5 -0
- package/Tests/Utils/MetricUnitUtil.test.ts +227 -2
- package/Tests/Utils/Monitor/MetricValueFormatter.test.ts +288 -2
- package/Tests/Utils/Monitor/PlatformResourceIdentityAndUnits.test.ts +1559 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.test.ts +2546 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredHostUtil.test.ts +315 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +336 -1
- package/Tests/Utils/NetworkDiscovery/NetbiosNameUtil.test.ts +244 -0
- package/Tests/Utils/Rules/MonitorTypeRuleCriteria.test.ts +181 -0
- package/Tests/Utils/ValueFormatter.test.ts +50 -0
- package/Tests/tsconfig.json +16 -0
- package/Types/AI/AIResourceContext.ts +7 -0
- package/Types/BaseDatabase/AggregationType.ts +7 -0
- package/Types/Dashboard/DashboardTemplates.ts +22 -8
- package/Types/DatabaseServer/DatabaseConnectionSpan.ts +77 -0
- package/Types/DatabaseServer/DatabaseContainerClassifier.ts +2068 -0
- package/Types/DatabaseServer/DatabaseContainerCommand.ts +801 -0
- package/Types/DatabaseServer/DatabaseEndpoint.ts +1943 -0
- package/Types/DatabaseServer/DatabaseServerDiscoverySource.ts +68 -0
- package/Types/DatabaseServer/DatabaseServerMetricCatalog.ts +966 -0
- package/Types/DatabaseServer/DatabaseSystem.ts +2124 -0
- package/Types/DatabaseServer/DatabaseTelemetryResolver.ts +555 -0
- package/Types/Email/EmailTemplateType.ts +1 -0
- package/Types/Monitor/CephAlertTemplates.ts +18 -0
- package/Types/Monitor/DatabaseAlertTemplates.ts +2020 -0
- package/Types/Monitor/KubernetesAlertTemplates.ts +64 -24
- package/Types/Monitor/KubernetesMetricCatalog.ts +118 -19
- package/Types/Monitor/MetricMonitor/MetricCriteriaContext.ts +14 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +93 -10
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +109 -8
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +36 -7
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +43 -2
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.ts +41 -6
- package/Types/Monitor/SeriesContext/SeriesLabelDisplay.ts +26 -0
- package/Types/NetworkDevice/DiscoveredHostNamingStatus.ts +147 -0
- package/Types/Permission.ts +267 -0
- package/Types/Probe/ProbeApiIngestResponse.ts +8 -0
- package/Types/Rules/RuleCriteriaFieldRegistry.ts +10 -0
- package/Types/Rules/RuleRun.ts +12 -0
- package/Types/Rum/SessionReplayCustomEvents.ts +29 -3
- package/Types/Rum/WebVitals.ts +13 -0
- package/Types/Telemetry/EntityType.ts +23 -0
- package/Types/Telemetry/ResourceFacetCatalog.ts +14 -0
- package/Types/Telemetry/ServiceType.ts +8 -0
- package/UI/Components/Banner/Banner.tsx +1 -1
- package/UI/Components/Card/Card.tsx +1 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +2 -2
- package/UI/Components/Charts/Line/LineChart.tsx +7 -0
- package/UI/Components/CommandPalette/CommandPalette.tsx +1 -1
- package/UI/Components/Date/StartAndEndDate.tsx +5 -5
- package/UI/Components/Diagram/HorizontalStepChain.tsx +1 -1
- package/UI/Components/Feed/FeedOptionsButton.tsx +1 -1
- package/UI/Components/Forms/BasicForm.tsx +1 -1
- package/UI/Components/Header/Header.tsx +1 -1
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +1 -1
- package/UI/Components/HeaderAlert/HeaderAlert.tsx +1 -1
- package/UI/Components/Input/Input.tsx +11 -0
- package/UI/Components/LogsViewer/components/FacetValueRow.tsx +1 -1
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +1 -1
- package/UI/Components/Modal/ModalFooter.tsx +1 -1
- package/UI/Components/ModelDetail/CardModelDetail.tsx +2 -2
- package/UI/Components/ModelTable/BaseModelTable.tsx +4 -4
- package/UI/Components/Navbar/NavBar.tsx +9 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +2 -2
- package/UI/Components/Page/Page.tsx +1 -1
- package/UI/Components/Pagination/Pagination.tsx +3 -3
- package/UI/Components/ProgressButtons/ProgressButtonItem.tsx +1 -1
- package/UI/Components/SideMenu/SideMenu.tsx +4 -1
- package/UI/Components/StatusPage/ResourceGroupNavigator.tsx +4 -2
- package/UI/Components/StatusPage/ResourceList.tsx +6 -6
- package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +1 -1
- package/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.tsx +1 -1
- package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +1 -1
- package/UI/Components/Workflow/ComponentsModal.tsx +2 -2
- package/UI/Components/Workflow/StepTraceViewer.tsx +1 -1
- package/UI/Styles/Theme.css +8 -1
- package/UI/Utils/Navigation.ts +89 -42
- package/UI/Utils/Telemetry/TelemetryEntityNames.ts +7 -0
- package/UI/Utils/TelemetryService.ts +4 -3
- package/Utils/Dashboard/KubernetesClusterCpuTileRepair.ts +147 -0
- package/Utils/LabelRuleImportExport.ts +2 -0
- package/Utils/MetricUnitUtil.ts +103 -11
- package/Utils/Monitor/MetricValueFormatter.ts +66 -13
- package/Utils/Monitor/PlatformMetricUnitUtil.ts +215 -0
- package/Utils/Monitor/PlatformResourceIdentity.ts +514 -0
- package/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.ts +425 -0
- package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +32 -0
- package/Utils/NetworkDiscovery/NetbiosNameUtil.ts +73 -0
- package/Utils/Telemetry/DatabaseServerEntityKeys.ts +275 -0
- package/Utils/Telemetry/EntityKey.ts +176 -0
- package/Utils/ValueFormatter.ts +16 -0
- package/build/dist/Models/DatabaseModels/Alert.js +54 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +1683 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerEndpoint.js +559 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerEndpoint.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerFeed.js +648 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerTeam.js +506 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerUser.js +505 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Incident.js +54 -0
- package/build/dist/Models/DatabaseModels/Incident.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/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +54 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +2 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserProjectSsoConsent.js +162 -0
- package/build/dist/Models/DatabaseModels/UserProjectSsoConsent.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.js +240 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/MultipartFormData.js +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +15 -8
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AlertReminderRuleService.js +72 -23
- package/build/dist/Server/Services/AlertReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseServerEndpointService.js +694 -0
- package/build/dist/Server/Services/DatabaseServerEndpointService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerFeedService.js +110 -0
- package/build/dist/Server/Services/DatabaseServerFeedService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleEngineService.js +272 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleService.js +13 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleEngineService.js +340 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerTeamService.js +160 -0
- package/build/dist/Server/Services/DatabaseServerOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerUserService.js +153 -0
- package/build/dist/Server/Services/DatabaseServerOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerService.js +3272 -0
- package/build/dist/Server/Services/DatabaseServerService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseService.js +8 -4
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DockerResourceService.js +30 -3
- package/build/dist/Server/Services/DockerResourceService.js.map +1 -1
- package/build/dist/Server/Services/IncidentReminderRuleService.js +73 -23
- package/build/dist/Server/Services/IncidentReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +16 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/InventoryItemService.js +88 -5
- package/build/dist/Server/Services/InventoryItemService.js.map +1 -1
- package/build/dist/Server/Services/IoTDeviceService.js +111 -24
- package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +24 -9
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/PodmanResourceService.js +30 -3
- package/build/dist/Server/Services/PodmanResourceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js +75 -23
- package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/ServiceService.js +1 -1
- package/build/dist/Server/Services/ServiceService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +23 -2
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/UserProjectSsoConsentService.js +79 -0
- package/build/dist/Server/Services/UserProjectSsoConsentService.js.map +1 -0
- package/build/dist/Server/Services/UserService.js +13 -1
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +18 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js +73 -2
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js +13 -2
- package/build/dist/Server/Utils/AI/Toolbox/MetricTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js +58 -1
- package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +1 -1
- package/build/dist/Server/Utils/Database/AffectedResourceRelations.js +6 -0
- package/build/dist/Server/Utils/Database/AffectedResourceRelations.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +31 -0
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +135 -14
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -6
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1489 -524
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +22 -6
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +196 -6
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +36 -9
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResourceContext.js +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResourceContext.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js +175 -17
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/PerSeriesResolutionRootCause.js +29 -0
- package/build/dist/Server/Utils/Monitor/PerSeriesResolutionRootCause.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +211 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +82 -10
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -1
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +25 -0
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +20 -4
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +2 -0
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/DatabaseEndpointDiscovery.js +442 -0
- package/build/dist/Server/Utils/Telemetry/DatabaseEndpointDiscovery.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +5 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +15 -1
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +121 -5
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ResourceFacetResolver.js +12 -0
- package/build/dist/Server/Utils/Telemetry/ResourceFacetResolver.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ServiceDependencyDiscovery.js +438 -36
- package/build/dist/Server/Utils/Telemetry/ServiceDependencyDiscovery.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +12 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +17 -18
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js +16 -10
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js.map +1 -1
- package/build/dist/Types/AI/AIResourceContext.js +7 -0
- package/build/dist/Types/AI/AIResourceContext.js.map +1 -1
- package/build/dist/Types/BaseDatabase/AggregationType.js +7 -0
- package/build/dist/Types/BaseDatabase/AggregationType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js +22 -8
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/DatabaseServer/DatabaseConnectionSpan.js +71 -0
- package/build/dist/Types/DatabaseServer/DatabaseConnectionSpan.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerClassifier.js +1462 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerClassifier.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerCommand.js +691 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerCommand.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseEndpoint.js +1407 -0
- package/build/dist/Types/DatabaseServer/DatabaseEndpoint.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerDiscoverySource.js +60 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerDiscoverySource.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerMetricCatalog.js +804 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerMetricCatalog.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseSystem.js +1860 -0
- package/build/dist/Types/DatabaseServer/DatabaseSystem.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseTelemetryResolver.js +406 -0
- package/build/dist/Types/DatabaseServer/DatabaseTelemetryResolver.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Monitor/CephAlertTemplates.js +18 -0
- package/build/dist/Types/Monitor/CephAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/DatabaseAlertTemplates.js +1518 -0
- package/build/dist/Types/Monitor/DatabaseAlertTemplates.js.map +1 -0
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +57 -24
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js +104 -18
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +80 -3
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +10 -3
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +29 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js +21 -6
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js.map +1 -1
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js +25 -0
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js.map +1 -1
- package/build/dist/Types/NetworkDevice/DiscoveredHostNamingStatus.js +136 -0
- package/build/dist/Types/NetworkDevice/DiscoveredHostNamingStatus.js.map +1 -0
- package/build/dist/Types/Permission.js +234 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +10 -0
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
- package/build/dist/Types/Rules/RuleRun.js +4 -0
- package/build/dist/Types/Rules/RuleRun.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplayCustomEvents.js.map +1 -1
- package/build/dist/Types/Rum/WebVitals.js +12 -0
- package/build/dist/Types/Rum/WebVitals.js.map +1 -1
- package/build/dist/Types/Telemetry/EntityType.js +23 -0
- package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
- package/build/dist/Types/Telemetry/ResourceFacetCatalog.js +14 -0
- package/build/dist/Types/Telemetry/ResourceFacetCatalog.js.map +1 -1
- package/build/dist/Types/Telemetry/ServiceType.js +8 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Banner/Banner.js +1 -1
- package/build/dist/UI/Components/Banner/Banner.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +1 -1
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/CommandPalette/CommandPalette.js +1 -1
- package/build/dist/UI/Components/CommandPalette/CommandPalette.js.map +1 -1
- package/build/dist/UI/Components/Date/StartAndEndDate.js +5 -5
- package/build/dist/UI/Components/Date/StartAndEndDate.js.map +1 -1
- package/build/dist/UI/Components/Diagram/HorizontalStepChain.js +1 -1
- package/build/dist/UI/Components/Diagram/HorizontalStepChain.js.map +1 -1
- package/build/dist/UI/Components/Feed/FeedOptionsButton.js +1 -1
- package/build/dist/UI/Components/Feed/FeedOptionsButton.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.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/HeaderAlert/HeaderAlert.js +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +1 -1
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/FacetValueRow.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/FacetValueRow.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js +2 -2
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +4 -4
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBar.js +9 -2
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +2 -2
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Components/Page/Page.js +1 -1
- package/build/dist/UI/Components/Page/Page.js.map +1 -1
- package/build/dist/UI/Components/Pagination/Pagination.js +3 -3
- package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
- package/build/dist/UI/Components/ProgressButtons/ProgressButtonItem.js +1 -1
- package/build/dist/UI/Components/ProgressButtons/ProgressButtonItem.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js +4 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupNavigator.js +3 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupNavigator.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceList.js +6 -6
- package/build/dist/UI/Components/StatusPage/ResourceList.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +1 -1
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +2 -2
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +66 -33
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/Telemetry/TelemetryEntityNames.js +7 -0
- package/build/dist/UI/Utils/Telemetry/TelemetryEntityNames.js.map +1 -1
- package/build/dist/UI/Utils/TelemetryService.js +3 -2
- package/build/dist/UI/Utils/TelemetryService.js.map +1 -1
- package/build/dist/Utils/Dashboard/KubernetesClusterCpuTileRepair.js +110 -0
- package/build/dist/Utils/Dashboard/KubernetesClusterCpuTileRepair.js.map +1 -0
- package/build/dist/Utils/LabelRuleImportExport.js +2 -0
- package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
- package/build/dist/Utils/MetricUnitUtil.js +77 -13
- package/build/dist/Utils/MetricUnitUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/MetricValueFormatter.js +58 -13
- package/build/dist/Utils/Monitor/MetricValueFormatter.js.map +1 -1
- package/build/dist/Utils/Monitor/PlatformMetricUnitUtil.js +161 -0
- package/build/dist/Utils/Monitor/PlatformMetricUnitUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/PlatformResourceIdentity.js +323 -0
- package/build/dist/Utils/Monitor/PlatformResourceIdentity.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.js +270 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +23 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/NetbiosNameUtil.js +61 -0
- package/build/dist/Utils/NetworkDiscovery/NetbiosNameUtil.js.map +1 -1
- package/build/dist/Utils/Telemetry/DatabaseServerEntityKeys.js +178 -0
- package/build/dist/Utils/Telemetry/DatabaseServerEntityKeys.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityKey.js +133 -0
- package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +15 -0
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tests.json +7 -5
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
import QueryHelper from "../../../../Server/Types/Database/QueryHelper";
|
|
2
|
+
import { describe, expect, it } from "@jest/globals";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* QueryHelper.searchAllWords backs POST /network-site/search, the dropdown
|
|
6
|
+
* that lets the Device Topology search box find a site on ANY level of the
|
|
7
|
+
* hierarchy (issue #3981). The customer recalls a site as a handful of words
|
|
8
|
+
* ("michigan 104822") and expects "Unit 104822 - Michigan Ave" to come back,
|
|
9
|
+
* so the helper turns every word into its own ILIKE and AND-joins them.
|
|
10
|
+
*
|
|
11
|
+
* As in the sibling QueryHelper suites, the SQL is produced by a function on
|
|
12
|
+
* the Raw operator given the column alias, and the values live in the
|
|
13
|
+
* operator's parameter bag. Neither is visible from the FindOperator's JSON,
|
|
14
|
+
* so every test renders the operator with `getSql(alias)` and reads
|
|
15
|
+
* `objectLiteralParameters`.
|
|
16
|
+
*
|
|
17
|
+
* The properties pinned here are the ones the endpoint relies on:
|
|
18
|
+
*
|
|
19
|
+
* 1. EVERY WORD, ANY ORDER. One ILIKE per word, AND-joined, each with its
|
|
20
|
+
* own bound parameter, the whole thing parenthesised so it cannot bleed
|
|
21
|
+
* into a neighbouring OR in the WHERE clause.
|
|
22
|
+
*
|
|
23
|
+
* 2. WORDS ARE LITERAL. A `%`, `_` or `\` the user typed is escaped, so
|
|
24
|
+
* "100%" is not a wildcard; glob characters are left alone because this
|
|
25
|
+
* is a substring search, not the wildcard operator.
|
|
26
|
+
*
|
|
27
|
+
* 3. NOTHING TO SEARCH FOR MATCHES NOTHING. An AND over zero predicates is
|
|
28
|
+
* vacuously true, and "the whole table" is never what an empty box meant.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
interface RawOperator {
|
|
32
|
+
type: string;
|
|
33
|
+
objectLiteralParameters: Record<string, unknown>;
|
|
34
|
+
// TypeORM builds the SQL through this, given the column alias.
|
|
35
|
+
getSql: (aliasPath: string) => string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type AsRawFunction = (operator: unknown) => RawOperator;
|
|
39
|
+
|
|
40
|
+
const asRaw: AsRawFunction = (operator: unknown): RawOperator => {
|
|
41
|
+
return operator as unknown as RawOperator;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// A stable alias to render every operator against.
|
|
45
|
+
const ALIAS: string = '"NetworkSite"."name"';
|
|
46
|
+
|
|
47
|
+
type SearchAllWordsFunction = (words: Array<string>) => RawOperator;
|
|
48
|
+
|
|
49
|
+
const searchAllWords: SearchAllWordsFunction = (
|
|
50
|
+
words: Array<string>,
|
|
51
|
+
): RawOperator => {
|
|
52
|
+
return asRaw(QueryHelper.searchAllWords(words));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type ParamValuesFunction = (operator: RawOperator) => Array<unknown>;
|
|
56
|
+
|
|
57
|
+
const paramValues: ParamValuesFunction = (
|
|
58
|
+
operator: RawOperator,
|
|
59
|
+
): Array<unknown> => {
|
|
60
|
+
return Object.values(operator.objectLiteralParameters);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type ParamNamesFunction = (operator: RawOperator) => Array<string>;
|
|
64
|
+
|
|
65
|
+
const paramNames: ParamNamesFunction = (
|
|
66
|
+
operator: RawOperator,
|
|
67
|
+
): Array<string> => {
|
|
68
|
+
return Object.keys(operator.objectLiteralParameters);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type CountFunction = (haystack: string, needle: string) => number;
|
|
72
|
+
|
|
73
|
+
const countOccurrences: CountFunction = (
|
|
74
|
+
haystack: string,
|
|
75
|
+
needle: string,
|
|
76
|
+
): number => {
|
|
77
|
+
return haystack.split(needle).length - 1;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type PlaceholdersFunction = (sql: string) => Array<string>;
|
|
81
|
+
|
|
82
|
+
// The `:name` placeholders the SQL references, in the order they appear.
|
|
83
|
+
const placeholdersIn: PlaceholdersFunction = (sql: string): Array<string> => {
|
|
84
|
+
const names: Array<string> = [];
|
|
85
|
+
const matcher: RegExp = /:([A-Za-z0-9_]+)/g;
|
|
86
|
+
let match: RegExpExecArray | null = matcher.exec(sql);
|
|
87
|
+
while (match) {
|
|
88
|
+
names.push(match[1] as string);
|
|
89
|
+
match = matcher.exec(sql);
|
|
90
|
+
}
|
|
91
|
+
return names;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type IlikeFunction = (value: string, pattern: string) => boolean;
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* A tiny model of Postgres ILIKE with its default `\` escape: `%` is any run
|
|
98
|
+
* of characters, `_` is exactly one, `\x` is the literal x, and the match is
|
|
99
|
+
* case-insensitive and anchored at both ends. It lets the tests below state
|
|
100
|
+
* the behaviour in the customer's terms ("does this name come back?") rather
|
|
101
|
+
* than only as pattern strings.
|
|
102
|
+
*/
|
|
103
|
+
const ilike: IlikeFunction = (value: string, pattern: string): boolean => {
|
|
104
|
+
let source: string = "";
|
|
105
|
+
for (let i: number = 0; i < pattern.length; i++) {
|
|
106
|
+
const char: string = pattern[i] as string;
|
|
107
|
+
if (char === "\\" && i + 1 < pattern.length) {
|
|
108
|
+
i++;
|
|
109
|
+
source += (pattern[i] as string).replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
110
|
+
} else if (char === "%") {
|
|
111
|
+
source += "[\\s\\S]*";
|
|
112
|
+
} else if (char === "_") {
|
|
113
|
+
source += "[\\s\\S]";
|
|
114
|
+
} else {
|
|
115
|
+
source += char.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return new RegExp(`^${source}$`, "iu").test(value);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type MatchesFunction = (operator: RawOperator, value: string) => boolean;
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* Evaluates the rendered SQL against one column value. It is driven by the
|
|
125
|
+
* SQL itself (split on AND, look up each placeholder) so that a regression
|
|
126
|
+
* to OR-joining, or a condition that references the wrong parameter, shows
|
|
127
|
+
* up as a wrong answer rather than passing on the parameter bag alone.
|
|
128
|
+
*/
|
|
129
|
+
const rowMatches: MatchesFunction = (
|
|
130
|
+
operator: RawOperator,
|
|
131
|
+
value: string,
|
|
132
|
+
): boolean => {
|
|
133
|
+
const sql: string = operator.getSql(ALIAS);
|
|
134
|
+
|
|
135
|
+
if (sql === "TRUE = FALSE") {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const body: string = sql.slice(1, -1);
|
|
140
|
+
|
|
141
|
+
return body.split(" AND ").every((condition: string): boolean => {
|
|
142
|
+
const names: Array<string> = placeholdersIn(condition);
|
|
143
|
+
expect(names).toHaveLength(1);
|
|
144
|
+
expect(condition).toBe(`CAST(${ALIAS} AS TEXT) ILIKE :${names[0]}`);
|
|
145
|
+
const pattern: unknown =
|
|
146
|
+
operator.objectLiteralParameters[names[0] as string];
|
|
147
|
+
expect(typeof pattern).toBe("string");
|
|
148
|
+
return ilike(value, pattern as string);
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
describe("QueryHelper.searchAllWords - SQL shape", () => {
|
|
153
|
+
/*
|
|
154
|
+
* The endpoint drops this straight into `where: { name: ... }`, so the
|
|
155
|
+
* shape has to be something TypeORM can splice into a larger WHERE: a Raw
|
|
156
|
+
* operator, bound placeholders only, one predicate per word, parenthesised.
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
it("returns a TypeORM Raw operator", () => {
|
|
160
|
+
expect(searchAllWords(["michigan"]).type).toBe("raw");
|
|
161
|
+
expect(searchAllWords([]).type).toBe("raw");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("one word renders exactly one ILIKE with the pattern %word%", () => {
|
|
165
|
+
const operator: RawOperator = searchAllWords(["michigan"]);
|
|
166
|
+
const sql: string = operator.getSql(ALIAS);
|
|
167
|
+
const names: Array<string> = paramNames(operator);
|
|
168
|
+
|
|
169
|
+
expect(names).toHaveLength(1);
|
|
170
|
+
expect(paramValues(operator)).toEqual(["%michigan%"]);
|
|
171
|
+
expect(countOccurrences(sql.toUpperCase(), "ILIKE")).toBe(1);
|
|
172
|
+
expect(sql).not.toContain(" AND ");
|
|
173
|
+
expect(sql).toBe(`(CAST(${ALIAS} AS TEXT) ILIKE :${names[0]})`);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("several words are AND-joined, one ILIKE and one parameter per word", () => {
|
|
177
|
+
const operator: RawOperator = searchAllWords([
|
|
178
|
+
"unit",
|
|
179
|
+
"104822",
|
|
180
|
+
"michigan",
|
|
181
|
+
]);
|
|
182
|
+
const sql: string = operator.getSql(ALIAS);
|
|
183
|
+
|
|
184
|
+
expect(countOccurrences(sql.toUpperCase(), "ILIKE")).toBe(3);
|
|
185
|
+
expect(countOccurrences(sql, " AND ")).toBe(2);
|
|
186
|
+
// An AND, never an OR: "any of the words" would flood the dropdown.
|
|
187
|
+
expect(sql.toUpperCase()).not.toContain(" OR ");
|
|
188
|
+
expect(paramValues(operator)).toEqual(["%unit%", "%104822%", "%michigan%"]);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it("gives every word a distinct parameter name, each referenced exactly once", () => {
|
|
192
|
+
/*
|
|
193
|
+
* Reusing one name would bind every condition to the same value; a name
|
|
194
|
+
* the SQL never references would silently drop a word from the search.
|
|
195
|
+
*/
|
|
196
|
+
const operator: RawOperator = searchAllWords(["a", "b", "c", "d"]);
|
|
197
|
+
const sql: string = operator.getSql(ALIAS);
|
|
198
|
+
const names: Array<string> = paramNames(operator);
|
|
199
|
+
|
|
200
|
+
expect(new Set<string>(names).size).toBe(4);
|
|
201
|
+
for (const name of names) {
|
|
202
|
+
expect(countOccurrences(sql, `:${name}`)).toBe(1);
|
|
203
|
+
}
|
|
204
|
+
// The SQL references nothing outside the parameter bag, in word order.
|
|
205
|
+
expect(placeholdersIn(sql)).toEqual(names);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("generates parameter names TypeORM accepts as named placeholders", () => {
|
|
209
|
+
const operator: RawOperator = searchAllWords(["alpha", "beta"]);
|
|
210
|
+
|
|
211
|
+
for (const name of paramNames(operator)) {
|
|
212
|
+
expect(name).toMatch(/^[A-Za-z]{10}$/);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it("wraps the whole expression in one pair of parentheses", () => {
|
|
217
|
+
/*
|
|
218
|
+
* Without them, `a AND b` spliced next to an `OR` elsewhere in the WHERE
|
|
219
|
+
* would bind wrongly (AND binds tighter than OR).
|
|
220
|
+
*/
|
|
221
|
+
const operator: RawOperator = searchAllWords(["alpha", "beta", "gamma"]);
|
|
222
|
+
const sql: string = operator.getSql(ALIAS);
|
|
223
|
+
const names: Array<string> = paramNames(operator);
|
|
224
|
+
|
|
225
|
+
expect(sql.startsWith("(")).toBe(true);
|
|
226
|
+
expect(sql.endsWith(")")).toBe(true);
|
|
227
|
+
expect(sql).toBe(
|
|
228
|
+
`(${names
|
|
229
|
+
.map((name: string) => {
|
|
230
|
+
return `CAST(${ALIAS} AS TEXT) ILIKE :${name}`;
|
|
231
|
+
})
|
|
232
|
+
.join(" AND ")})`,
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("casts the column alias it is given to TEXT in every condition", () => {
|
|
237
|
+
const words: Array<string> = ["alpha", "beta"];
|
|
238
|
+
const operator: RawOperator = searchAllWords(words);
|
|
239
|
+
|
|
240
|
+
const siteSql: string = operator.getSql('"NetworkSite"."name"');
|
|
241
|
+
const otherSql: string = operator.getSql('"Other"."title"');
|
|
242
|
+
|
|
243
|
+
expect(
|
|
244
|
+
countOccurrences(siteSql, 'CAST("NetworkSite"."name" AS TEXT)'),
|
|
245
|
+
).toBe(2);
|
|
246
|
+
expect(countOccurrences(otherSql, 'CAST("Other"."title" AS TEXT)')).toBe(2);
|
|
247
|
+
expect(otherSql).not.toContain("NetworkSite");
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("renders the same SQL every time it is asked", () => {
|
|
251
|
+
/*
|
|
252
|
+
* TypeORM may call getSql more than once while building a query; the
|
|
253
|
+
* parameter names are fixed when the operator is built, not per render.
|
|
254
|
+
*/
|
|
255
|
+
const operator: RawOperator = searchAllWords(["alpha", "beta"]);
|
|
256
|
+
|
|
257
|
+
expect(operator.getSql(ALIAS)).toBe(operator.getSql(ALIAS));
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("gives two separate calls distinct parameter names", () => {
|
|
261
|
+
/*
|
|
262
|
+
* Two operators can land in one query (e.g. one per OR branch). TypeORM
|
|
263
|
+
* merges their parameter bags, so a shared name would let one search's
|
|
264
|
+
* value overwrite the other's.
|
|
265
|
+
*/
|
|
266
|
+
const first: RawOperator = searchAllWords(["michigan"]);
|
|
267
|
+
const second: RawOperator = searchAllWords(["michigan"]);
|
|
268
|
+
|
|
269
|
+
const firstNames: Array<string> = paramNames(first);
|
|
270
|
+
const secondNames: Array<string> = paramNames(second);
|
|
271
|
+
|
|
272
|
+
expect(firstNames).toHaveLength(1);
|
|
273
|
+
expect(secondNames).toHaveLength(1);
|
|
274
|
+
expect(firstNames[0]).not.toBe(secondNames[0]);
|
|
275
|
+
expect(first.getSql(ALIAS)).not.toBe(second.getSql(ALIAS));
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it("handles the full eight-word budget the endpoint allows", () => {
|
|
279
|
+
const words: Array<string> = [
|
|
280
|
+
"one",
|
|
281
|
+
"two",
|
|
282
|
+
"three",
|
|
283
|
+
"four",
|
|
284
|
+
"five",
|
|
285
|
+
"six",
|
|
286
|
+
"seven",
|
|
287
|
+
"eight",
|
|
288
|
+
];
|
|
289
|
+
const operator: RawOperator = searchAllWords(words);
|
|
290
|
+
const sql: string = operator.getSql(ALIAS);
|
|
291
|
+
|
|
292
|
+
expect(countOccurrences(sql.toUpperCase(), "ILIKE")).toBe(8);
|
|
293
|
+
expect(countOccurrences(sql, " AND ")).toBe(7);
|
|
294
|
+
expect(new Set<string>(paramNames(operator)).size).toBe(8);
|
|
295
|
+
expect(paramValues(operator)).toEqual(
|
|
296
|
+
words.map((word: string) => {
|
|
297
|
+
return `%${word}%`;
|
|
298
|
+
}),
|
|
299
|
+
);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it("keeps a repeated word as its own predicate (harmless, and de-duplication belongs to the caller)", () => {
|
|
303
|
+
/*
|
|
304
|
+
* NetworkSiteHierarchyUtil.splitSearchWords already de-duplicates before
|
|
305
|
+
* calling in. Should a repeat slip through, `x AND x` means the same as
|
|
306
|
+
* `x`; what matters is that the two conditions do not share a name.
|
|
307
|
+
*/
|
|
308
|
+
const operator: RawOperator = searchAllWords(["unit", "unit"]);
|
|
309
|
+
const names: Array<string> = paramNames(operator);
|
|
310
|
+
|
|
311
|
+
expect(paramValues(operator)).toEqual(["%unit%", "%unit%"]);
|
|
312
|
+
expect(new Set<string>(names).size).toBe(2);
|
|
313
|
+
expect(rowMatches(operator, "Unit 7")).toBe(true);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
describe("QueryHelper.searchAllWords - values are bound and literal", () => {
|
|
318
|
+
/*
|
|
319
|
+
* The words come straight from a search box. They must never be spliced
|
|
320
|
+
* into the SQL, and the LIKE metacharacters in them must mean themselves:
|
|
321
|
+
* somebody searching for "unit_1" wants that name, not "unitX1".
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
it("binds every word rather than interpolating it", () => {
|
|
325
|
+
const hostile: string = '\'; DROP TABLE "NetworkSite"; --';
|
|
326
|
+
const operator: RawOperator = searchAllWords([hostile, "michigan"]);
|
|
327
|
+
const sql: string = operator.getSql(ALIAS);
|
|
328
|
+
|
|
329
|
+
expect(sql).not.toContain("DROP TABLE");
|
|
330
|
+
expect(sql).not.toContain("michigan");
|
|
331
|
+
expect(sql).not.toContain("'");
|
|
332
|
+
expect(paramValues(operator)).toEqual([`%${hostile}%`, "%michigan%"]);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it.each([
|
|
336
|
+
["100%", "%100\\%%"],
|
|
337
|
+
["unit_1", "%unit\\_1%"],
|
|
338
|
+
["%", "%\\%%"],
|
|
339
|
+
["_", "%\\_%"],
|
|
340
|
+
["50%_off", "%50\\%\\_off%"],
|
|
341
|
+
["%%__", "%\\%\\%\\_\\_%"],
|
|
342
|
+
])(
|
|
343
|
+
"escapes the LIKE metacharacters in %p to the pattern %p",
|
|
344
|
+
(word: string, pattern: string) => {
|
|
345
|
+
expect(paramValues(searchAllWords([word]))).toEqual([pattern]);
|
|
346
|
+
},
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
it.each([
|
|
350
|
+
["a\\b", "%a\\\\b%"],
|
|
351
|
+
["\\", "%\\\\%"],
|
|
352
|
+
["C:\\sites\\", "%C:\\\\sites\\\\%"],
|
|
353
|
+
])(
|
|
354
|
+
"doubles a backslash in %p so it cannot escape the next character (%p)",
|
|
355
|
+
(word: string, pattern: string) => {
|
|
356
|
+
expect(paramValues(searchAllWords([word]))).toEqual([pattern]);
|
|
357
|
+
},
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
it("escapes a backslash that precedes a metacharacter as two literals", () => {
|
|
361
|
+
/*
|
|
362
|
+
* `\%` typed by a user is a backslash followed by a percent. Both have
|
|
363
|
+
* to be escaped independently: `\\\%`. Escaping only the `%` would leave
|
|
364
|
+
* `\\%`, i.e. a literal backslash followed by a wildcard.
|
|
365
|
+
*/
|
|
366
|
+
expect(paramValues(searchAllWords(["\\%"]))).toEqual(["%\\\\\\%%"]);
|
|
367
|
+
expect(paramValues(searchAllWords(["\\_"]))).toEqual(["%\\\\\\_%"]);
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
it.each([
|
|
371
|
+
["api-*", "%api-*%"],
|
|
372
|
+
["a?c", "%a?c%"],
|
|
373
|
+
["*", "%*%"],
|
|
374
|
+
["?", "%?%"],
|
|
375
|
+
])(
|
|
376
|
+
"leaves the glob characters in %p untranslated (%p)",
|
|
377
|
+
(word: string, pattern: string) => {
|
|
378
|
+
/*
|
|
379
|
+
* Unlike QueryHelper.wildcard, this is a plain substring search: a `*`
|
|
380
|
+
* or `?` in a site name is just a character.
|
|
381
|
+
*/
|
|
382
|
+
expect(paramValues(searchAllWords([word]))).toEqual([pattern]);
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
it("differs from QueryHelper.wildcard, which does translate a glob", () => {
|
|
387
|
+
expect(paramValues(asRaw(QueryHelper.wildcard("api-*")))).toEqual([
|
|
388
|
+
"api-%",
|
|
389
|
+
]);
|
|
390
|
+
expect(paramValues(searchAllWords(["api-*"]))).toEqual(["%api-*%"]);
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
it("escapes each word independently", () => {
|
|
394
|
+
expect(paramValues(searchAllWords(["100%", "unit_1", "plain"]))).toEqual([
|
|
395
|
+
"%100\\%%",
|
|
396
|
+
"%unit\\_1%",
|
|
397
|
+
"%plain%",
|
|
398
|
+
]);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it("preserves case (ILIKE is already case-insensitive)", () => {
|
|
402
|
+
/*
|
|
403
|
+
* Lower-casing buys nothing under ILIKE, and QueryHelper.wildcard's
|
|
404
|
+
* suite records why it is avoided around escapes. The caller
|
|
405
|
+
* (splitSearchWords) lower-cases for de-duplication; the helper itself
|
|
406
|
+
* passes the word through untouched.
|
|
407
|
+
*/
|
|
408
|
+
expect(paramValues(searchAllWords(["Michigan", "AVE"]))).toEqual([
|
|
409
|
+
"%Michigan%",
|
|
410
|
+
"%AVE%",
|
|
411
|
+
]);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it("keeps non-ASCII characters intact", () => {
|
|
415
|
+
expect(paramValues(searchAllWords(["Zürich", "東京"]))).toEqual([
|
|
416
|
+
"%Zürich%",
|
|
417
|
+
"%東京%",
|
|
418
|
+
]);
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
describe("QueryHelper.searchAllWords - trimming and blank words", () => {
|
|
423
|
+
/*
|
|
424
|
+
* The caller splits on whitespace, but the helper is public and may be fed
|
|
425
|
+
* raw strings. A blank word would otherwise become `ILIKE '%%'`, which
|
|
426
|
+
* matches every row and hides nothing, and an all-blank list would become
|
|
427
|
+
* an AND over nothing.
|
|
428
|
+
*/
|
|
429
|
+
|
|
430
|
+
it("trims the whitespace around each word", () => {
|
|
431
|
+
expect(paramValues(searchAllWords([" michigan ", "\t104822\n"]))).toEqual(
|
|
432
|
+
["%michigan%", "%104822%"],
|
|
433
|
+
);
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
it("does not split a word on its inner whitespace (splitting is the caller's job)", () => {
|
|
437
|
+
const operator: RawOperator = searchAllWords([" michigan ave "]);
|
|
438
|
+
|
|
439
|
+
expect(paramValues(operator)).toEqual(["%michigan ave%"]);
|
|
440
|
+
expect(
|
|
441
|
+
countOccurrences(operator.getSql(ALIAS).toUpperCase(), "ILIKE"),
|
|
442
|
+
).toBe(1);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
it("skips empty and whitespace-only words without leaving a dangling AND", () => {
|
|
446
|
+
const operator: RawOperator = searchAllWords([
|
|
447
|
+
"",
|
|
448
|
+
"michigan",
|
|
449
|
+
" ",
|
|
450
|
+
"\t\n",
|
|
451
|
+
"104822",
|
|
452
|
+
"",
|
|
453
|
+
]);
|
|
454
|
+
const sql: string = operator.getSql(ALIAS);
|
|
455
|
+
|
|
456
|
+
expect(paramValues(operator)).toEqual(["%michigan%", "%104822%"]);
|
|
457
|
+
expect(countOccurrences(sql.toUpperCase(), "ILIKE")).toBe(2);
|
|
458
|
+
expect(countOccurrences(sql, " AND ")).toBe(1);
|
|
459
|
+
expect(sql).not.toMatch(/AND\s*\)/);
|
|
460
|
+
expect(sql).not.toMatch(/\(\s*AND/);
|
|
461
|
+
expect(sql).not.toContain("AND AND");
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
it("skips null and undefined entries instead of throwing", () => {
|
|
465
|
+
const words: Array<string> = [
|
|
466
|
+
null,
|
|
467
|
+
"michigan",
|
|
468
|
+
undefined,
|
|
469
|
+
] as unknown as Array<string>;
|
|
470
|
+
|
|
471
|
+
expect(paramValues(searchAllWords(words))).toEqual(["%michigan%"]);
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it("does not mutate the array it is given", () => {
|
|
475
|
+
const words: Array<string> = [" michigan ", "", "100%"];
|
|
476
|
+
const copy: Array<string> = [...words];
|
|
477
|
+
|
|
478
|
+
searchAllWords(words);
|
|
479
|
+
|
|
480
|
+
expect(words).toEqual(copy);
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
describe("QueryHelper.searchAllWords - nothing to search for", () => {
|
|
485
|
+
/*
|
|
486
|
+
* An AND over zero predicates is vacuously true. If the helper rendered
|
|
487
|
+
* `()` or dropped the condition, an empty search would return every site
|
|
488
|
+
* in the project; it must return none.
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
it("renders TRUE = FALSE with no parameters for an empty list", () => {
|
|
492
|
+
const operator: RawOperator = searchAllWords([]);
|
|
493
|
+
|
|
494
|
+
expect(operator.getSql(ALIAS)).toBe("TRUE = FALSE");
|
|
495
|
+
expect(operator.objectLiteralParameters).toEqual({});
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it.each([[[""]], [["", " ", "\t", "\n"]], [[" \r\n "]]])(
|
|
499
|
+
"renders TRUE = FALSE with no parameters when every word is blank (%p)",
|
|
500
|
+
(words: Array<string>) => {
|
|
501
|
+
const operator: RawOperator = searchAllWords(words);
|
|
502
|
+
|
|
503
|
+
expect(operator.getSql(ALIAS)).toBe("TRUE = FALSE");
|
|
504
|
+
expect(operator.objectLiteralParameters).toEqual({});
|
|
505
|
+
},
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
it("does not reference the column at all when there is nothing to match", () => {
|
|
509
|
+
const operator: RawOperator = searchAllWords(["", " "]);
|
|
510
|
+
const sql: string = operator.getSql(ALIAS);
|
|
511
|
+
|
|
512
|
+
expect(sql).not.toContain(ALIAS);
|
|
513
|
+
expect(sql.toUpperCase()).not.toContain("ILIKE");
|
|
514
|
+
expect(placeholdersIn(sql)).toEqual([]);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
it("matches no row, not every row", () => {
|
|
518
|
+
const operator: RawOperator = searchAllWords([]);
|
|
519
|
+
|
|
520
|
+
expect(rowMatches(operator, "Unit 104822 - Michigan Ave")).toBe(false);
|
|
521
|
+
expect(rowMatches(operator, "")).toBe(false);
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
describe("QueryHelper.searchAllWords - which names come back", () => {
|
|
526
|
+
/*
|
|
527
|
+
* The customer-facing contract of issue #3981, evaluated against the
|
|
528
|
+
* rendered SQL with the ILIKE model above: every word must appear, in any
|
|
529
|
+
* order, case-insensitively, as a literal substring.
|
|
530
|
+
*/
|
|
531
|
+
|
|
532
|
+
const SITE: string = "Unit 104822 - Michigan Ave";
|
|
533
|
+
|
|
534
|
+
it("finds a site from words typed in a different order than the name", () => {
|
|
535
|
+
expect(rowMatches(searchAllWords(["michigan", "104822"]), SITE)).toBe(true);
|
|
536
|
+
expect(rowMatches(searchAllWords(["104822", "michigan"]), SITE)).toBe(true);
|
|
537
|
+
expect(rowMatches(searchAllWords(["ave", "unit"]), SITE)).toBe(true);
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
it("matches case-insensitively even though the pattern keeps its case", () => {
|
|
541
|
+
expect(rowMatches(searchAllWords(["MICHIGAN", "Unit"]), SITE)).toBe(true);
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it("matches partial words", () => {
|
|
545
|
+
expect(rowMatches(searchAllWords(["mich", "0482"]), SITE)).toBe(true);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it("requires every word: one miss excludes the site", () => {
|
|
549
|
+
expect(rowMatches(searchAllWords(["michigan", "999999"]), SITE)).toBe(
|
|
550
|
+
false,
|
|
551
|
+
);
|
|
552
|
+
expect(rowMatches(searchAllWords(["chicago"]), SITE)).toBe(false);
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it("treats a typed % literally", () => {
|
|
556
|
+
const operator: RawOperator = searchAllWords(["100%"]);
|
|
557
|
+
|
|
558
|
+
expect(rowMatches(operator, "Rack 100% uptime")).toBe(true);
|
|
559
|
+
// As a wildcard, "100%" would also have matched these.
|
|
560
|
+
expect(rowMatches(operator, "Rack 1000")).toBe(false);
|
|
561
|
+
expect(rowMatches(operator, "Rack 100")).toBe(false);
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
it("treats a typed _ literally", () => {
|
|
565
|
+
const operator: RawOperator = searchAllWords(["unit_1"]);
|
|
566
|
+
|
|
567
|
+
expect(rowMatches(operator, "floor unit_1 east")).toBe(true);
|
|
568
|
+
// As a wildcard, `_` would have matched any one character.
|
|
569
|
+
expect(rowMatches(operator, "floor unitX1 east")).toBe(false);
|
|
570
|
+
expect(rowMatches(operator, "floor unit-1 east")).toBe(false);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it("treats a typed backslash literally", () => {
|
|
574
|
+
const operator: RawOperator = searchAllWords(["a\\b"]);
|
|
575
|
+
|
|
576
|
+
expect(rowMatches(operator, "path a\\b here")).toBe(true);
|
|
577
|
+
expect(rowMatches(operator, "path ab here")).toBe(false);
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it("treats a typed * literally", () => {
|
|
581
|
+
const operator: RawOperator = searchAllWords(["api-*"]);
|
|
582
|
+
|
|
583
|
+
expect(rowMatches(operator, "api-*")).toBe(true);
|
|
584
|
+
expect(rowMatches(operator, "api-gateway")).toBe(false);
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it("ignores blank words rather than letting them match everything", () => {
|
|
588
|
+
const operator: RawOperator = searchAllWords(["", "michigan", " "]);
|
|
589
|
+
|
|
590
|
+
expect(rowMatches(operator, SITE)).toBe(true);
|
|
591
|
+
expect(rowMatches(operator, "Unit 5 - Chicago")).toBe(false);
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
describe("QueryHelper.searchAllWords versus QueryHelper.search", () => {
|
|
596
|
+
/*
|
|
597
|
+
* Why the new helper exists. `search` keeps the whole string as ONE
|
|
598
|
+
* substring, so "michigan 104822" only matches a name containing exactly
|
|
599
|
+
* that phrase and misses "Unit 104822 - Michigan Ave". It also passes
|
|
600
|
+
* LIKE metacharacters through, and an empty string becomes `%%`, which
|
|
601
|
+
* matches everything. searchAllWords fixes all three for the site search.
|
|
602
|
+
*/
|
|
603
|
+
|
|
604
|
+
const SITE: string = "Unit 104822 - Michigan Ave";
|
|
605
|
+
|
|
606
|
+
it("search keeps the text as a single substring; searchAllWords splits the predicate per word", () => {
|
|
607
|
+
const single: RawOperator = asRaw(QueryHelper.search("michigan 104822"));
|
|
608
|
+
const perWord: RawOperator = searchAllWords(["michigan", "104822"]);
|
|
609
|
+
|
|
610
|
+
expect(paramValues(single)).toEqual(["%michigan 104822%"]);
|
|
611
|
+
expect(countOccurrences(single.getSql(ALIAS).toUpperCase(), "ILIKE")).toBe(
|
|
612
|
+
1,
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
expect(paramValues(perWord)).toEqual(["%michigan%", "%104822%"]);
|
|
616
|
+
expect(countOccurrences(perWord.getSql(ALIAS).toUpperCase(), "ILIKE")).toBe(
|
|
617
|
+
2,
|
|
618
|
+
);
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
it("only searchAllWords finds the site the customer was looking for", () => {
|
|
622
|
+
const single: RawOperator = asRaw(QueryHelper.search("michigan 104822"));
|
|
623
|
+
const patterns: Array<unknown> = paramValues(single);
|
|
624
|
+
|
|
625
|
+
expect(patterns).toHaveLength(1);
|
|
626
|
+
expect(ilike(SITE, patterns[0] as string)).toBe(false);
|
|
627
|
+
expect(rowMatches(searchAllWords(["michigan", "104822"]), SITE)).toBe(true);
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
it("search does not escape LIKE metacharacters; searchAllWords does", () => {
|
|
631
|
+
expect(paramValues(asRaw(QueryHelper.search("100%")))).toEqual(["%100%%"]);
|
|
632
|
+
expect(paramValues(searchAllWords(["100%"]))).toEqual(["%100\\%%"]);
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
it("search lower-cases; searchAllWords leaves case to ILIKE", () => {
|
|
636
|
+
expect(paramValues(asRaw(QueryHelper.search("Michigan")))).toEqual([
|
|
637
|
+
"%michigan%",
|
|
638
|
+
]);
|
|
639
|
+
expect(paramValues(searchAllWords(["Michigan"]))).toEqual(["%Michigan%"]);
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
it("an empty search matches everything; an empty searchAllWords matches nothing", () => {
|
|
643
|
+
const everything: RawOperator = asRaw(QueryHelper.search(""));
|
|
644
|
+
|
|
645
|
+
expect(paramValues(everything)).toEqual(["%%"]);
|
|
646
|
+
expect(ilike(SITE, "%%")).toBe(true);
|
|
647
|
+
|
|
648
|
+
expect(searchAllWords([]).getSql(ALIAS)).toBe("TRUE = FALSE");
|
|
649
|
+
expect(rowMatches(searchAllWords([]), SITE)).toBe(false);
|
|
650
|
+
});
|
|
651
|
+
});
|