@oneuptime/common 11.6.1 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/Index.ts +4 -0
- package/Models/AnalyticsModels/KubernetesCostAllocation.ts +842 -0
- package/Models/AnalyticsModels/NetworkFlow.ts +54 -0
- package/Models/AnalyticsModels/SloHistory.ts +243 -0
- package/Models/DatabaseModels/Index.ts +20 -0
- package/Models/DatabaseModels/NetworkDevice.ts +453 -6
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +7 -6
- package/Models/DatabaseModels/NetworkEndpoint.ts +753 -0
- package/Models/DatabaseModels/NetworkSite.ts +1155 -0
- package/Models/DatabaseModels/NetworkSiteAssignmentRule.ts +517 -0
- package/Models/DatabaseModels/NetworkSiteLink.ts +611 -0
- package/Models/DatabaseModels/NetworkSiteStatusTimeline.ts +520 -0
- package/Models/DatabaseModels/NetworkSiteType.ts +499 -0
- package/Models/DatabaseModels/ServiceLevelObjective.ts +1115 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.ts +762 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.ts +444 -0
- package/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.ts +443 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.ts +359 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.ts +48 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.ts +65 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.ts +88 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.ts +391 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.ts +30 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Services/AnalyticsDatabaseService.ts +25 -9
- package/Server/Services/Index.ts +24 -0
- package/Server/Services/KubernetesCostAllocationService.ts +14 -0
- package/Server/Services/MetricService.ts +21 -2
- package/Server/Services/MonitorService.ts +22 -0
- package/Server/Services/NetworkDeviceService.ts +438 -2
- package/Server/Services/NetworkEndpointService.ts +414 -0
- package/Server/Services/NetworkSiteAssignmentRuleService.ts +98 -0
- package/Server/Services/NetworkSiteLinkService.ts +10 -0
- package/Server/Services/NetworkSiteService.ts +1254 -0
- package/Server/Services/NetworkSiteStatusTimelineService.ts +10 -0
- package/Server/Services/NetworkSiteTypeService.ts +10 -0
- package/Server/Services/ProjectService.ts +122 -2
- package/Server/Services/ServiceLevelObjectiveBurnRateRuleService.ts +457 -0
- package/Server/Services/ServiceLevelObjectiveOwnerTeamService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveOwnerUserService.ts +10 -0
- package/Server/Services/ServiceLevelObjectiveService.ts +685 -0
- package/Server/Services/SloHistoryService.ts +101 -0
- package/Server/Services/UserNotificationSettingService.ts +37 -0
- package/Server/Types/AnalyticsDatabase/AggregateBy.ts +9 -0
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +15 -0
- package/Server/Utils/AnalyticsDatabase/Statement.ts +39 -3
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +87 -48
- package/Server/Utils/Memory.ts +9 -1
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +190 -12
- package/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/Server/Utils/Monitor/DnsResolutionCache.ts +129 -0
- package/Server/Utils/Monitor/MonitorResource.ts +4 -30
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +214 -39
- package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +343 -0
- package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +251 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +176 -142
- package/Server/Utils/Monitor/OuiLookupUtil.ts +49 -0
- package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +17 -13
- package/Server/Utils/WhatsAppTemplateUtil.ts +7 -3
- package/Tests/Models/AnalyticsModels/KubernetesCostAllocation.test.ts +135 -0
- package/Tests/Models/NetworkSiteHierarchy.test.ts +134 -0
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +239 -0
- package/Tests/Server/Services/KubernetesCostAllocationAggregate.test.ts +338 -0
- package/Tests/Server/Services/MetricServiceAggregate.test.ts +142 -0
- package/Tests/Server/Services/NetworkDeviceSiteAssignment.test.ts +484 -0
- package/Tests/Server/Services/NetworkEndpointServiceUpsert.test.ts +686 -0
- package/Tests/Server/Services/NetworkSiteAssignmentRuleService.test.ts +185 -0
- package/Tests/Server/Services/NetworkSiteService.test.ts +1354 -0
- package/Tests/Server/Services/ServiceLevelObjectiveBurnRateRuleService.test.ts +1313 -0
- package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +1988 -0
- package/Tests/Server/Utils/AnalyticsDatabase/Statement.test.ts +22 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +404 -0
- package/Tests/Server/Utils/Encryption.test.ts +70 -0
- package/Tests/Server/Utils/FileAttachmentMarkdownUtil.test.ts +225 -0
- package/Tests/Server/Utils/JsonWebToken.test.ts +175 -0
- package/Tests/Server/Utils/LocalFile.test.ts +258 -0
- package/Tests/Server/Utils/Memory.test.ts +213 -0
- package/Tests/Server/Utils/Monitor/Criteria/LogMonitorCriteria.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +385 -0
- package/Tests/Server/Utils/Monitor/DnsResolutionCache.test.ts +194 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +155 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +600 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +151 -124
- package/Tests/Server/Utils/Monitor/SnmpInterfaceRateUtil.test.ts +496 -0
- package/Tests/Server/Utils/MonitorCriteriaDataExtractor.test.ts +175 -0
- package/Tests/Server/Utils/MonitorCriteriaMessageFormatter.test.ts +282 -0
- package/Tests/Server/Utils/OuiLookupUtil.test.ts +59 -0
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +117 -0
- package/Tests/Server/Utils/StackTraceParser.test.ts +370 -0
- package/Tests/Server/Utils/Stream.test.ts +87 -0
- package/Tests/Server/Utils/ValidateGlobalProviderProjectTeams.test.ts +221 -0
- package/Tests/Server/Utils/WhatsAppTemplateUtil.test.ts +199 -0
- package/Tests/Types/Database/CompareOperatorWireSerialization.test.ts +33 -0
- package/Tests/Types/Email.test.ts +198 -0
- package/Tests/Types/Kubernetes/KubernetesObjectParser.test.ts +177 -0
- package/Tests/Types/Log/LogQueryToFilter.test.ts +111 -0
- package/Tests/Types/Monitor/MonitorCriteria.test.ts +155 -0
- package/Tests/Types/Monitor/MonitorCriteriaInstance.test.ts +465 -0
- package/Tests/Types/Monitor/MonitorStep.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorStepNetworkDeviceMonitor.test.ts +141 -1
- package/Tests/Types/Monitor/MonitorSteps.test.ts +183 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +59 -1
- package/Tests/Types/Monitor/NetworkDeviceAlertPack.test.ts +97 -0
- package/Tests/Types/Monitor/SnmpEndpointDiscovery.test.ts +151 -0
- package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +110 -6
- package/Tests/Types/NetworkSite/DefaultNetworkSiteType.test.ts +129 -0
- package/Tests/Types/SerializableObjectDictionary.test.ts +166 -0
- package/Tests/Types/Time/RangeStartAndEndDateTime.test.ts +98 -0
- package/Tests/Types/WebsiteRequest.test.ts +230 -0
- package/Tests/UI/Components/EntityFilterRoundTrip.test.tsx +103 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableUrlState.test.tsx +612 -0
- package/Tests/UI/Components/ModelTable/FilterDataToQuery.test.ts +275 -0
- package/Tests/UI/Utils/LogExport.test.ts +159 -0
- package/Tests/UI/Utils/Navigation.test.ts +183 -0
- package/Tests/UI/Utils/TableFilterUrlState.test.ts +539 -0
- package/Tests/UI/Utils/TableViewUrlState.test.ts +272 -0
- package/Tests/Utils/Base64.test.ts +51 -0
- package/Tests/Utils/Boolean.test.ts +76 -0
- package/Tests/Utils/Crypto.test.ts +48 -0
- package/Tests/Utils/Dashboard/DashboardSloComponent.test.ts +259 -0
- package/Tests/Utils/Dashboard/ModelQueryVariableInterpolation.test.ts +162 -0
- package/Tests/Utils/Enum.test.ts +54 -0
- package/Tests/Utils/IpCanonicalUtil.test.ts +85 -0
- package/Tests/Utils/Memory.test.ts +44 -0
- package/Tests/Utils/Metrics/MetricSeriesFingerprint.test.ts +160 -0
- package/Tests/Utils/Monitor/EndpointAttachmentUtil.test.ts +836 -0
- package/Tests/Utils/Monitor/MonitorMetricType.test.ts +218 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +447 -0
- package/Tests/Utils/NetworkSite/CidrMatchUtil.test.ts +440 -0
- package/Tests/Utils/NetworkSite/MaterializedPathUtil.test.ts +205 -0
- package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +221 -0
- package/Tests/Utils/NetworkSite/SiteUptimeUtil.test.ts +283 -0
- package/Tests/Utils/ObjectUtil.test.ts +30 -0
- package/Tests/Utils/Slo/SloBurnRateRuleState.test.ts +124 -0
- package/Tests/Utils/Slo/SloDuration.test.ts +148 -0
- package/Tests/Utils/Slo/SloHealth.test.ts +334 -0
- package/Tests/Utils/Slo/SloStatusColor.test.ts +89 -0
- package/Tests/Utils/Slo/SloUtil.test.ts +1980 -0
- package/Tests/Utils/Slo/SloWidgetFormat.test.ts +605 -0
- package/Tests/Utils/TechStack.test.ts +50 -0
- package/Tests/Utils/Traces/CriticalPath.test.ts +178 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +10 -0
- package/Types/BaseDatabase/EqualTo.ts +9 -1
- package/Types/BaseDatabase/EqualToOrNull.ts +9 -1
- package/Types/BaseDatabase/NotEqual.ts +9 -1
- package/Types/Dashboard/DashboardComponentType.ts +1 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardSloComponent.ts +42 -0
- package/Types/Dashboard/DashboardTemplates.ts +214 -0
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/Kubernetes/KubernetesCostIngest.ts +79 -0
- package/Types/Monitor/CriteriaFilter.ts +9 -0
- package/Types/Monitor/MonitorStep.ts +5 -8
- package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +27 -5
- package/Types/Monitor/MonitorType.ts +15 -5
- package/Types/Monitor/SnmpMonitor/ArpEntry.ts +14 -0
- package/Types/Monitor/SnmpMonitor/FdbEntry.ts +18 -0
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +10 -3
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -5
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +12 -0
- package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +231 -3
- package/Types/NetworkSite/DefaultNetworkSiteType.ts +20 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
- package/Types/Permission.ts +449 -0
- package/Types/ServiceLevelObjective/SliType.ts +6 -0
- package/Types/ServiceLevelObjective/SloMultiMonitorMode.ts +6 -0
- package/Types/ServiceLevelObjective/SloStatus.ts +9 -0
- package/Types/ServiceLevelObjective/SloWindowType.ts +6 -0
- package/Types/Telemetry/ServiceType.ts +1 -0
- package/UI/Components/Filters/EntityFilter.tsx +16 -0
- package/UI/Components/Filters/FilterViewer.tsx +22 -5
- package/UI/Components/List/List.tsx +8 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +309 -106
- package/UI/Components/ModelTable/FilterDataToQuery.ts +172 -0
- package/UI/Components/Navbar/NavBar.tsx +16 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +3 -3
- package/UI/Utils/Navigation.ts +10 -0
- package/UI/Utils/TableFilterUrlState.ts +204 -17
- package/UI/Utils/TableViewUrlState.ts +165 -0
- package/Utils/Dashboard/Components/DashboardSloComponent.ts +114 -0
- package/Utils/Dashboard/Components/Index.ts +7 -0
- package/Utils/IpCanonicalUtil.ts +134 -0
- package/Utils/Monitor/EndpointAttachmentUtil.ts +508 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +157 -5
- package/Utils/NetworkSite/CidrMatchUtil.ts +296 -0
- package/Utils/NetworkSite/MaterializedPathUtil.ts +115 -0
- package/Utils/NetworkSite/SiteStatusRollupUtil.ts +97 -0
- package/Utils/NetworkSite/SiteUptimeUtil.ts +111 -0
- package/Utils/Slo/SloBurnRateRuleState.ts +91 -0
- package/Utils/Slo/SloDuration.ts +165 -0
- package/Utils/Slo/SloEvaluation.ts +22 -0
- package/Utils/Slo/SloHealth.ts +302 -0
- package/Utils/Slo/SloStatusColor.ts +54 -0
- package/Utils/Slo/SloUtil.ts +637 -0
- package/Utils/Slo/SloWidgetFormat.ts +383 -0
- package/build/dist/Models/AnalyticsModels/Index.js +4 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js +713 -0
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js +44 -0
- package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/SloHistory.js +218 -0
- package/build/dist/Models/AnalyticsModels/SloHistory.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +20 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +458 -6
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +0 -6
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js +779 -0
- package/build/dist/Models/DatabaseModels/NetworkEndpoint.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js +1180 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js +534 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js +629 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteLink.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js +538 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js +522 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js +1134 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +769 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js +460 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js +459 -0
- package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js +130 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js +49 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js +140 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js +21 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +23 -6
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +24 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/KubernetesCostAllocationService.js +12 -0
- package/build/dist/Server/Services/KubernetesCostAllocationService.js.map +1 -0
- package/build/dist/Server/Services/MetricService.js +21 -3
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +19 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +351 -1
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/NetworkEndpointService.js +319 -0
- package/build/dist/Server/Services/NetworkEndpointService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js +90 -0
- package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteLinkService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteService.js +1038 -0
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js +9 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js.map +1 -0
- package/build/dist/Server/Services/ProjectService.js +98 -2
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js +358 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js +9 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js +588 -0
- package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -0
- package/build/dist/Server/Services/SloHistoryService.js +77 -0
- package/build/dist/Server/Services/SloHistoryService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js +20 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +9 -0
- package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +15 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +31 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +76 -48
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Memory.js +9 -1
- package/build/dist/Server/Utils/Memory.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +132 -10
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js +77 -0
- package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +21 -41
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +152 -40
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +262 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +201 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +152 -120
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js +44 -0
- package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +10 -10
- package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +5 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +10 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualTo.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js +9 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js +9 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js +23 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +205 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js +21 -0
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js.map +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js +1 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +5 -5
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +8 -0
- package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +15 -5
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +9 -3
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +217 -3
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js +21 -0
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +409 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/ServiceLevelObjective/SliType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SliType.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js +10 -0
- package/build/dist/Types/ServiceLevelObjective/SloStatus.js.map +1 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js +7 -0
- package/build/dist/Types/ServiceLevelObjective/SloWindowType.js.map +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js +1 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Filters/EntityFilter.js +15 -0
- package/build/dist/UI/Components/Filters/EntityFilter.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js +19 -4
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/List/List.js +1 -1
- package/build/dist/UI/Components/List/List.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +235 -89
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js +96 -0
- package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js.map +1 -0
- package/build/dist/UI/Components/Navbar/NavBar.js +14 -2
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +3 -2
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +9 -0
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/TableFilterUrlState.js +159 -15
- package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
- package/build/dist/UI/Utils/TableViewUrlState.js +103 -0
- package/build/dist/UI/Utils/TableViewUrlState.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js +93 -0
- package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/IpCanonicalUtil.js +110 -0
- package/build/dist/Utils/IpCanonicalUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js +311 -0
- package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +98 -5
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js +222 -0
- package/build/dist/Utils/NetworkSite/CidrMatchUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js +89 -0
- package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +60 -0
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js +76 -0
- package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js +35 -0
- package/build/dist/Utils/Slo/SloBurnRateRuleState.js.map +1 -0
- package/build/dist/Utils/Slo/SloDuration.js +87 -0
- package/build/dist/Utils/Slo/SloDuration.js.map +1 -0
- package/build/dist/Utils/Slo/SloEvaluation.js +21 -0
- package/build/dist/Utils/Slo/SloEvaluation.js.map +1 -0
- package/build/dist/Utils/Slo/SloHealth.js +179 -0
- package/build/dist/Utils/Slo/SloHealth.js.map +1 -0
- package/build/dist/Utils/Slo/SloStatusColor.js +18 -0
- package/build/dist/Utils/Slo/SloStatusColor.js.map +1 -0
- package/build/dist/Utils/Slo/SloUtil.js +393 -0
- package/build/dist/Utils/Slo/SloUtil.js.map +1 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js +174 -0
- package/build/dist/Utils/Slo/SloWidgetFormat.js.map +1 -0
- package/package.json +2 -2
- package/Types/Dashboard/DashboardComponents/Index.ts +0 -7
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js +0 -8
- package/build/dist/Types/Dashboard/DashboardComponents/Index.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
QualifiedColumn,
|
|
2
3
|
SQL,
|
|
3
4
|
Statement,
|
|
4
5
|
} from "../../../../Server/Utils/AnalyticsDatabase/Statement";
|
|
@@ -53,6 +54,27 @@ describe("Statement", () => {
|
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
56
|
|
|
57
|
+
test("should bind a QualifiedColumn as a table.column identifier pair", () => {
|
|
58
|
+
/*
|
|
59
|
+
* The qualifier and the column must be two separate Identifier
|
|
60
|
+
* params — a dotted string bound as one Identifier is treated by
|
|
61
|
+
* ClickHouse as a single quoted identifier, not a qualified
|
|
62
|
+
* reference.
|
|
63
|
+
*/
|
|
64
|
+
const statement: Statement = SQL`SELECT col FROM tbl WHERE ${new QualifiedColumn(
|
|
65
|
+
"tbl",
|
|
66
|
+
"col",
|
|
67
|
+
)} = ${{ value: "<text>", type: TableColumnType.Text }}`;
|
|
68
|
+
expect(statement.query).toBe(
|
|
69
|
+
"SELECT col FROM tbl WHERE {p0_t:Identifier}.{p0_c:Identifier} = {p1:String}",
|
|
70
|
+
);
|
|
71
|
+
expect(statement.query_params).toStrictEqual({
|
|
72
|
+
p0_t: "tbl",
|
|
73
|
+
p0_c: "col",
|
|
74
|
+
p1: "<text>",
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
56
78
|
describe("append", () => {
|
|
57
79
|
test("should append a Statement", () => {
|
|
58
80
|
const statement: Statement = SQL`
|
|
@@ -18,10 +18,13 @@ import NotEqual from "../../../../Types/BaseDatabase/NotEqual";
|
|
|
18
18
|
import IsNull from "../../../../Types/BaseDatabase/IsNull";
|
|
19
19
|
import NotNull from "../../../../Types/BaseDatabase/NotNull";
|
|
20
20
|
import GreaterThan from "../../../../Types/BaseDatabase/GreaterThan";
|
|
21
|
+
import InBetween from "../../../../Types/BaseDatabase/InBetween";
|
|
21
22
|
import Includes from "../../../../Types/BaseDatabase/Includes";
|
|
22
23
|
import IncludesNone from "../../../../Types/BaseDatabase/IncludesNone";
|
|
24
|
+
import MultiSearch from "../../../../Types/BaseDatabase/MultiSearch";
|
|
23
25
|
import Search from "../../../../Types/BaseDatabase/Search";
|
|
24
26
|
import StartsWith from "../../../../Types/BaseDatabase/StartsWith";
|
|
27
|
+
import BadDataException from "../../../../Types/Exception/BadDataException";
|
|
25
28
|
|
|
26
29
|
function expectStatement(actual: Statement, expected: Statement): void {
|
|
27
30
|
expect(actual.query).toBe(expected.query);
|
|
@@ -193,6 +196,33 @@ describe("StatementGenerator", () => {
|
|
|
193
196
|
});
|
|
194
197
|
});
|
|
195
198
|
|
|
199
|
+
test("table-qualifies every column reference when tableAlias is set", () => {
|
|
200
|
+
/*
|
|
201
|
+
* Aggregate statements alias expressions to real column names
|
|
202
|
+
* (`sum(col) as col`), and ClickHouse substitutes those aliases
|
|
203
|
+
* into same-level unqualified WHERE references. Qualified
|
|
204
|
+
* references always resolve to the table column.
|
|
205
|
+
*/
|
|
206
|
+
const statement: Statement = generator.toWhereStatement(
|
|
207
|
+
{
|
|
208
|
+
_id: "<value>",
|
|
209
|
+
column_1: "<text>",
|
|
210
|
+
} as any,
|
|
211
|
+
{ tableAlias: "<table-name>" },
|
|
212
|
+
);
|
|
213
|
+
expect(statement.query).toBe(
|
|
214
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} = {p1:String} AND {p2_t:Identifier}.{p2_c:Identifier} = {p3:String}",
|
|
215
|
+
);
|
|
216
|
+
expect(statement.query_params).toStrictEqual({
|
|
217
|
+
p0_t: "<table-name>",
|
|
218
|
+
p0_c: "_id",
|
|
219
|
+
p1: "<value>",
|
|
220
|
+
p2_t: "<table-name>",
|
|
221
|
+
p2_c: "column_1",
|
|
222
|
+
p3: "<text>",
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
196
226
|
describe("MapStringString columns", () => {
|
|
197
227
|
class MapModel extends AnalyticsBaseModel {
|
|
198
228
|
public constructor() {
|
|
@@ -924,6 +954,380 @@ describe("StatementGenerator", () => {
|
|
|
924
954
|
});
|
|
925
955
|
});
|
|
926
956
|
});
|
|
957
|
+
|
|
958
|
+
/*
|
|
959
|
+
* Table qualification (tableAlias option). Aggregate statements
|
|
960
|
+
* alias expressions to real column names (`sum(col) as col`, and
|
|
961
|
+
* `min(ts) as ts` under Total), and ClickHouse substitutes those
|
|
962
|
+
* SELECT aliases into same-level unqualified WHERE references —
|
|
963
|
+
* which injects an aggregate into WHERE (ILLEGAL_AGGREGATION; this
|
|
964
|
+
* 500'd the Kubernetes Costs page) or silently changes the filter.
|
|
965
|
+
* Table-qualified references always resolve to the real column, so
|
|
966
|
+
* every operator branch must qualify when the option is set.
|
|
967
|
+
*/
|
|
968
|
+
describe("table qualification (tableAlias)", () => {
|
|
969
|
+
class QualModel extends AnalyticsBaseModel {
|
|
970
|
+
public constructor() {
|
|
971
|
+
super({
|
|
972
|
+
tableName: "<qual-table>",
|
|
973
|
+
singularName: "<singular>",
|
|
974
|
+
pluralName: "<plural>",
|
|
975
|
+
tableColumns: [
|
|
976
|
+
new AnalyticsTableColumn({
|
|
977
|
+
key: "_id",
|
|
978
|
+
title: "<title>",
|
|
979
|
+
description: "<description>",
|
|
980
|
+
required: true,
|
|
981
|
+
type: TableColumnType.ObjectID,
|
|
982
|
+
}),
|
|
983
|
+
new AnalyticsTableColumn({
|
|
984
|
+
key: "text_col",
|
|
985
|
+
title: "<title>",
|
|
986
|
+
description: "<description>",
|
|
987
|
+
required: false,
|
|
988
|
+
type: TableColumnType.Text,
|
|
989
|
+
}),
|
|
990
|
+
new AnalyticsTableColumn({
|
|
991
|
+
key: "num_col",
|
|
992
|
+
title: "<title>",
|
|
993
|
+
description: "<description>",
|
|
994
|
+
required: false,
|
|
995
|
+
type: TableColumnType.Number,
|
|
996
|
+
}),
|
|
997
|
+
new AnalyticsTableColumn({
|
|
998
|
+
key: "time_col",
|
|
999
|
+
title: "<title>",
|
|
1000
|
+
description: "<description>",
|
|
1001
|
+
required: false,
|
|
1002
|
+
type: TableColumnType.DateTime64,
|
|
1003
|
+
}),
|
|
1004
|
+
new AnalyticsTableColumn({
|
|
1005
|
+
key: "arr_col",
|
|
1006
|
+
title: "<title>",
|
|
1007
|
+
description: "<description>",
|
|
1008
|
+
required: false,
|
|
1009
|
+
defaultValue: [],
|
|
1010
|
+
type: TableColumnType.ArrayText,
|
|
1011
|
+
}),
|
|
1012
|
+
new AnalyticsTableColumn({
|
|
1013
|
+
key: "json_col",
|
|
1014
|
+
title: "<title>",
|
|
1015
|
+
description: "<description>",
|
|
1016
|
+
required: false,
|
|
1017
|
+
type: TableColumnType.JSON,
|
|
1018
|
+
}),
|
|
1019
|
+
new AnalyticsTableColumn({
|
|
1020
|
+
key: "attrKeys",
|
|
1021
|
+
title: "<title>",
|
|
1022
|
+
description: "<description>",
|
|
1023
|
+
required: true,
|
|
1024
|
+
defaultValue: [],
|
|
1025
|
+
type: TableColumnType.ArrayText,
|
|
1026
|
+
}),
|
|
1027
|
+
new AnalyticsTableColumn({
|
|
1028
|
+
key: "attributes",
|
|
1029
|
+
title: "<title>",
|
|
1030
|
+
description: "<description>",
|
|
1031
|
+
required: true,
|
|
1032
|
+
defaultValue: {},
|
|
1033
|
+
type: TableColumnType.MapStringString,
|
|
1034
|
+
mapKeysColumn: "attrKeys",
|
|
1035
|
+
}),
|
|
1036
|
+
new AnalyticsTableColumn({
|
|
1037
|
+
key: "entityKeys",
|
|
1038
|
+
title: "<title>",
|
|
1039
|
+
description: "<description>",
|
|
1040
|
+
required: true,
|
|
1041
|
+
defaultValue: [],
|
|
1042
|
+
type: TableColumnType.ArrayText,
|
|
1043
|
+
}),
|
|
1044
|
+
],
|
|
1045
|
+
crudApiPath: new Route("route"),
|
|
1046
|
+
primaryKeys: ["_id"],
|
|
1047
|
+
sortKeys: ["_id"],
|
|
1048
|
+
partitionKey: "_id",
|
|
1049
|
+
tableEngine: AnalyticsTableEngine.MergeTree,
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
const ALIAS: string = "<qual-table>";
|
|
1055
|
+
|
|
1056
|
+
let qualGenerator: StatementGenerator<QualModel>;
|
|
1057
|
+
beforeEach(() => {
|
|
1058
|
+
qualGenerator = new StatementGenerator<QualModel>({
|
|
1059
|
+
modelType: QualModel,
|
|
1060
|
+
database: ClickhouseAppInstance,
|
|
1061
|
+
});
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
type QualifiedWhere = (query: Record<string, unknown>) => Statement;
|
|
1065
|
+
const qualifiedWhere: QualifiedWhere = (
|
|
1066
|
+
query: Record<string, unknown>,
|
|
1067
|
+
): Statement => {
|
|
1068
|
+
return qualGenerator.toWhereStatement(query as any, {
|
|
1069
|
+
tableAlias: ALIAS,
|
|
1070
|
+
});
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Every `pN_t` qualifier param must carry the table alias, and the
|
|
1075
|
+
* set of qualified column names must be exactly `expectedColumns`
|
|
1076
|
+
* (order-insensitive, duplicates preserved).
|
|
1077
|
+
*/
|
|
1078
|
+
type ExpectQualifiers = (
|
|
1079
|
+
statement: Statement,
|
|
1080
|
+
expectedColumns: Array<string>,
|
|
1081
|
+
) => void;
|
|
1082
|
+
const expectQualifiers: ExpectQualifiers = (
|
|
1083
|
+
statement: Statement,
|
|
1084
|
+
expectedColumns: Array<string>,
|
|
1085
|
+
): void => {
|
|
1086
|
+
const params: Record<string, unknown> = statement.query_params;
|
|
1087
|
+
const tableEntries: Array<unknown> = Object.entries(params)
|
|
1088
|
+
.filter(([key]: [string, unknown]) => {
|
|
1089
|
+
return key.endsWith("_t");
|
|
1090
|
+
})
|
|
1091
|
+
.map(([, value]: [string, unknown]) => {
|
|
1092
|
+
return value;
|
|
1093
|
+
});
|
|
1094
|
+
const columnEntries: Array<unknown> = Object.entries(params)
|
|
1095
|
+
.filter(([key]: [string, unknown]) => {
|
|
1096
|
+
return key.endsWith("_c");
|
|
1097
|
+
})
|
|
1098
|
+
.map(([, value]: [string, unknown]) => {
|
|
1099
|
+
return value;
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
expect(tableEntries).toHaveLength(expectedColumns.length);
|
|
1103
|
+
for (const table of tableEntries) {
|
|
1104
|
+
expect(table).toBe(ALIAS);
|
|
1105
|
+
}
|
|
1106
|
+
expect([...columnEntries].sort()).toStrictEqual(
|
|
1107
|
+
[...expectedColumns].sort(),
|
|
1108
|
+
);
|
|
1109
|
+
// No unqualified bare-identifier column references may remain.
|
|
1110
|
+
expect(statement.query).not.toMatch(/AND \{p\d+:Identifier\}/);
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
test("qualifies bare equality", () => {
|
|
1114
|
+
const statement: Statement = qualifiedWhere({ _id: "<value>" });
|
|
1115
|
+
expect(statement.query).toBe(
|
|
1116
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} = {p1:String}",
|
|
1117
|
+
);
|
|
1118
|
+
expect(statement.query_params).toStrictEqual({
|
|
1119
|
+
p0_t: ALIAS,
|
|
1120
|
+
p0_c: "_id",
|
|
1121
|
+
p1: "<value>",
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
test("qualifies scalar comparison operators", () => {
|
|
1126
|
+
const statement: Statement = qualifiedWhere({
|
|
1127
|
+
text_col: new NotEqual("<x>"),
|
|
1128
|
+
num_col: new GreaterThan(5),
|
|
1129
|
+
});
|
|
1130
|
+
expect(statement.query).toBe(
|
|
1131
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} != {p1:String} " +
|
|
1132
|
+
"AND {p2_t:Identifier}.{p2_c:Identifier} > {p3:Int32}",
|
|
1133
|
+
);
|
|
1134
|
+
expectQualifiers(statement, ["text_col", "num_col"]);
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
test("qualifies both bounds of an InBetween (the costs-page window filter)", () => {
|
|
1138
|
+
const start: Date = new Date("2026-07-18T10:00:00.000Z");
|
|
1139
|
+
const end: Date = new Date("2026-07-25T10:00:00.000Z");
|
|
1140
|
+
const statement: Statement = qualifiedWhere({
|
|
1141
|
+
time_col: new InBetween(start, end),
|
|
1142
|
+
});
|
|
1143
|
+
expect(statement.query).toBe(
|
|
1144
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} >= {p1:DateTime64(9)} " +
|
|
1145
|
+
"AND {p2_t:Identifier}.{p2_c:Identifier} <= {p3:DateTime64(9)}",
|
|
1146
|
+
);
|
|
1147
|
+
expectQualifiers(statement, ["time_col", "time_col"]);
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
test("qualifies ILIKE search", () => {
|
|
1151
|
+
const statement: Statement = qualifiedWhere({
|
|
1152
|
+
text_col: new Search("needle"),
|
|
1153
|
+
});
|
|
1154
|
+
expect(statement.query).toBe(
|
|
1155
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} ILIKE {p1:String}",
|
|
1156
|
+
);
|
|
1157
|
+
expectQualifiers(statement, ["text_col"]);
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
test("qualifies scalar IN / NOT IN", () => {
|
|
1161
|
+
const statement: Statement = qualifiedWhere({
|
|
1162
|
+
text_col: new Includes(["a", "b"]),
|
|
1163
|
+
});
|
|
1164
|
+
expect(statement.query).toBe(
|
|
1165
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} IN {p1:Array(String)}",
|
|
1166
|
+
);
|
|
1167
|
+
expectQualifiers(statement, ["text_col"]);
|
|
1168
|
+
|
|
1169
|
+
const exclusion: Statement = qualifiedWhere({
|
|
1170
|
+
text_col: new IncludesNone(["a", "b"]),
|
|
1171
|
+
});
|
|
1172
|
+
expect(exclusion.query).toBe(
|
|
1173
|
+
"AND {p0_t:Identifier}.{p0_c:Identifier} NOT IN {p1:Array(String)}",
|
|
1174
|
+
);
|
|
1175
|
+
expectQualifiers(exclusion, ["text_col"]);
|
|
1176
|
+
});
|
|
1177
|
+
|
|
1178
|
+
test("qualifies hasAny membership on ArrayText columns", () => {
|
|
1179
|
+
const statement: Statement = qualifiedWhere({
|
|
1180
|
+
arr_col: new Includes(["k1"]),
|
|
1181
|
+
});
|
|
1182
|
+
expect(statement.query).toBe(
|
|
1183
|
+
"AND hasAny({p0_t:Identifier}.{p0_c:Identifier}, {p1:Array(String)})",
|
|
1184
|
+
);
|
|
1185
|
+
expectQualifiers(statement, ["arr_col"]);
|
|
1186
|
+
|
|
1187
|
+
const exclusion: Statement = qualifiedWhere({
|
|
1188
|
+
arr_col: new IncludesNone(["k1"]),
|
|
1189
|
+
});
|
|
1190
|
+
expect(exclusion.query).toBe(
|
|
1191
|
+
"AND NOT hasAny({p0_t:Identifier}.{p0_c:Identifier}, {p1:Array(String)})",
|
|
1192
|
+
);
|
|
1193
|
+
expectQualifiers(exclusion, ["arr_col"]);
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
test("qualifies both references of a Text IS NULL check", () => {
|
|
1197
|
+
const statement: Statement = qualifiedWhere({
|
|
1198
|
+
text_col: new IsNull(),
|
|
1199
|
+
});
|
|
1200
|
+
expect(statement.query).toBe(
|
|
1201
|
+
"AND ({p0_t:Identifier}.{p0_c:Identifier} IS NULL OR {p1_t:Identifier}.{p1_c:Identifier} = '')",
|
|
1202
|
+
);
|
|
1203
|
+
expectQualifiers(statement, ["text_col", "text_col"]);
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
test("qualifies map subscripts and the key-presence prefilter", () => {
|
|
1207
|
+
const statement: Statement = qualifiedWhere({
|
|
1208
|
+
attributes: { "service.name": "web" },
|
|
1209
|
+
});
|
|
1210
|
+
/*
|
|
1211
|
+
* The presence prefilter reads the denormalized `attrKeys`
|
|
1212
|
+
* column and must be qualified too — it is part of the same
|
|
1213
|
+
* WHERE level as the aggregate aliases.
|
|
1214
|
+
*/
|
|
1215
|
+
expect(statement.query).toBe(
|
|
1216
|
+
"AND (empty({p0_t:Identifier}.{p0_c:Identifier}) OR hasAny({p1_t:Identifier}.{p1_c:Identifier}, {p2:Array(String)})) " +
|
|
1217
|
+
"AND {p3_t:Identifier}.{p3_c:Identifier}[{p4:String}] = {p5:String}",
|
|
1218
|
+
);
|
|
1219
|
+
expectQualifiers(statement, ["attrKeys", "attrKeys", "attributes"]);
|
|
1220
|
+
});
|
|
1221
|
+
|
|
1222
|
+
test("qualifies map numeric comparisons", () => {
|
|
1223
|
+
const statement: Statement = qualifiedWhere({
|
|
1224
|
+
attributes: { latency: new GreaterThan(100) },
|
|
1225
|
+
});
|
|
1226
|
+
expect(statement.query).toBe(
|
|
1227
|
+
"AND (empty({p0_t:Identifier}.{p0_c:Identifier}) OR hasAny({p1_t:Identifier}.{p1_c:Identifier}, {p2:Array(String)})) " +
|
|
1228
|
+
"AND toFloat64OrNull({p3_t:Identifier}.{p3_c:Identifier}[{p4:String}]) > {p5:Int32}",
|
|
1229
|
+
);
|
|
1230
|
+
expectQualifiers(statement, ["attrKeys", "attrKeys", "attributes"]);
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
test("qualifies map null checks", () => {
|
|
1234
|
+
const isNull: Statement = qualifiedWhere({
|
|
1235
|
+
attributes: { k: new IsNull() },
|
|
1236
|
+
});
|
|
1237
|
+
expect(isNull.query).toBe(
|
|
1238
|
+
"AND ((NOT mapContains({p0_t:Identifier}.{p0_c:Identifier}, {p1:String})) OR {p2_t:Identifier}.{p2_c:Identifier}[{p3:String}] = '')",
|
|
1239
|
+
);
|
|
1240
|
+
expectQualifiers(isNull, ["attributes", "attributes"]);
|
|
1241
|
+
|
|
1242
|
+
const notNull: Statement = qualifiedWhere({
|
|
1243
|
+
attributes: { k: new NotNull() },
|
|
1244
|
+
});
|
|
1245
|
+
expect(notNull.query).toBe(
|
|
1246
|
+
"AND (empty({p0_t:Identifier}.{p0_c:Identifier}) OR hasAny({p1_t:Identifier}.{p1_c:Identifier}, {p2:Array(String)})) " +
|
|
1247
|
+
"AND mapContains({p3_t:Identifier}.{p3_c:Identifier}, {p4:String}) AND {p5_t:Identifier}.{p5_c:Identifier}[{p6:String}] != ''",
|
|
1248
|
+
);
|
|
1249
|
+
expectQualifiers(notNull, [
|
|
1250
|
+
"attrKeys",
|
|
1251
|
+
"attrKeys",
|
|
1252
|
+
"attributes",
|
|
1253
|
+
"attributes",
|
|
1254
|
+
]);
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
test("qualifies the case-insensitive arrayExists search over map keys/values", () => {
|
|
1258
|
+
const statement: Statement = qualifiedWhere({
|
|
1259
|
+
attributes: { k: new Search("needle") },
|
|
1260
|
+
});
|
|
1261
|
+
expect(statement.query).toBe(
|
|
1262
|
+
"AND arrayExists((k, v) -> lowerUTF8(k) = lowerUTF8({p0:String}) AND v ILIKE {p1:String}, " +
|
|
1263
|
+
"mapKeys({p2_t:Identifier}.{p2_c:Identifier}), mapValues({p3_t:Identifier}.{p3_c:Identifier}))",
|
|
1264
|
+
);
|
|
1265
|
+
expectQualifiers(statement, ["attributes", "attributes"]);
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
test("qualifies JSON extraction filters", () => {
|
|
1269
|
+
const statement: Statement = qualifiedWhere({
|
|
1270
|
+
json_col: { field: "<v>", flag: true, count: 3 },
|
|
1271
|
+
});
|
|
1272
|
+
// JSON-extract fragments append back-to-back with no separator.
|
|
1273
|
+
expect(statement.query).toBe(
|
|
1274
|
+
"AND JSONExtractString({p0_t:Identifier}.{p0_c:Identifier}, {p1:String}) = {p2:String}" +
|
|
1275
|
+
"AND JSONExtractBool({p3_t:Identifier}.{p3_c:Identifier}, {p4:String}) = {p5:Bool}" +
|
|
1276
|
+
"AND JSONExtractInt({p6_t:Identifier}.{p6_c:Identifier}, {p7:String}) = {p8:Int32}",
|
|
1277
|
+
);
|
|
1278
|
+
expectQualifiers(statement, ["json_col", "json_col", "json_col"]);
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
test("qualifies every column of a MultiSearch fan-out", () => {
|
|
1282
|
+
const statement: Statement = qualifiedWhere({
|
|
1283
|
+
multiSearch: new MultiSearch({
|
|
1284
|
+
fields: ["text_col", "num_col"],
|
|
1285
|
+
value: "needle",
|
|
1286
|
+
}),
|
|
1287
|
+
});
|
|
1288
|
+
// The search value binds with each column's own type (num_col → Int32).
|
|
1289
|
+
expect(statement.query).toBe(
|
|
1290
|
+
"AND ({p0_t:Identifier}.{p0_c:Identifier} ILIKE {p1:String} OR {p2_t:Identifier}.{p2_c:Identifier} ILIKE {p3:Int32})",
|
|
1291
|
+
);
|
|
1292
|
+
expectQualifiers(statement, ["text_col", "num_col"]);
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1295
|
+
test("qualifies both sides of the entityScope OR-fallback", () => {
|
|
1296
|
+
const statement: Statement = qualifiedWhere({
|
|
1297
|
+
entityScope: {
|
|
1298
|
+
entityKeys: ["210dac24142f1baa"],
|
|
1299
|
+
attributeKey: "resource.host.name",
|
|
1300
|
+
attributeValue: "web-1",
|
|
1301
|
+
},
|
|
1302
|
+
});
|
|
1303
|
+
expect(statement.query).toBe(
|
|
1304
|
+
"AND (hasAny({p0_t:Identifier}.{p0_c:Identifier}, {p1:Array(String)}) OR {p2_t:Identifier}.{p2_c:Identifier}[{p3:String}] = {p4:String})",
|
|
1305
|
+
);
|
|
1306
|
+
expectQualifiers(statement, ["entityKeys", "attributes"]);
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
test("omitting the option produces the exact unqualified statement", () => {
|
|
1310
|
+
const query: Record<string, unknown> = {
|
|
1311
|
+
_id: "<value>",
|
|
1312
|
+
attributes: { "service.name": "web" },
|
|
1313
|
+
};
|
|
1314
|
+
const unqualified: Statement = qualGenerator.toWhereStatement(
|
|
1315
|
+
query as any,
|
|
1316
|
+
);
|
|
1317
|
+
expect(unqualified.query).not.toContain("_t:Identifier");
|
|
1318
|
+
expect(unqualified.query).toBe(
|
|
1319
|
+
"AND {p0:Identifier} = {p1:String} " +
|
|
1320
|
+
"AND (empty({p2:Identifier}) OR hasAny({p3:Identifier}, {p4:Array(String)})) " +
|
|
1321
|
+
"AND {p5:Identifier}[{p6:String}] = {p7:String}",
|
|
1322
|
+
);
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
test("still rejects unknown columns when qualifying", () => {
|
|
1326
|
+
expect(() => {
|
|
1327
|
+
return qualifiedWhere({ nonexistent: "<value>" });
|
|
1328
|
+
}).toThrow(BadDataException);
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
927
1331
|
});
|
|
928
1332
|
|
|
929
1333
|
describe("toCreateStatement", () => {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import Encryption from "../../../Server/Utils/Encryption";
|
|
2
|
+
|
|
3
|
+
describe("Encryption", () => {
|
|
4
|
+
describe("encrypt", () => {
|
|
5
|
+
test("should return an empty string for empty input", async () => {
|
|
6
|
+
expect(await Encryption.encrypt("")).toEqual("");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("should not return the plain text", async () => {
|
|
10
|
+
const plainText: string = "super-secret-value";
|
|
11
|
+
const cipherText: string = await Encryption.encrypt(plainText);
|
|
12
|
+
|
|
13
|
+
expect(cipherText).not.toEqual(plainText);
|
|
14
|
+
expect(cipherText.length).toBeGreaterThan(0);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("should produce a different cipher text each time because of the random salt", async () => {
|
|
18
|
+
const first: string = await Encryption.encrypt("same-input");
|
|
19
|
+
const second: string = await Encryption.encrypt("same-input");
|
|
20
|
+
|
|
21
|
+
expect(first).not.toEqual(second);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("decrypt", () => {
|
|
26
|
+
test("should return an empty string for empty input", async () => {
|
|
27
|
+
expect(await Encryption.decrypt("")).toEqual("");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("should round trip a value", async () => {
|
|
31
|
+
const plainText: string = "round-trip-me";
|
|
32
|
+
|
|
33
|
+
expect(
|
|
34
|
+
await Encryption.decrypt(await Encryption.encrypt(plainText)),
|
|
35
|
+
).toEqual(plainText);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("should round trip unicode and long values", async () => {
|
|
39
|
+
const unicode: string = "héllo wörld 🚀 — ünïcodé";
|
|
40
|
+
const long: string = "a".repeat(5000);
|
|
41
|
+
|
|
42
|
+
expect(
|
|
43
|
+
await Encryption.decrypt(await Encryption.encrypt(unicode)),
|
|
44
|
+
).toEqual(unicode);
|
|
45
|
+
expect(await Encryption.decrypt(await Encryption.encrypt(long))).toEqual(
|
|
46
|
+
long,
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("should round trip json shaped strings", async () => {
|
|
51
|
+
const json: string = JSON.stringify({
|
|
52
|
+
apiKey: "abc-123",
|
|
53
|
+
nested: { value: 42 },
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(await Encryption.decrypt(await Encryption.encrypt(json))).toEqual(
|
|
57
|
+
json,
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("should decrypt every random cipher text of the same input back to that input", async () => {
|
|
62
|
+
const plainText: string = "same-input";
|
|
63
|
+
const first: string = await Encryption.encrypt(plainText);
|
|
64
|
+
const second: string = await Encryption.encrypt(plainText);
|
|
65
|
+
|
|
66
|
+
expect(await Encryption.decrypt(first)).toEqual(plainText);
|
|
67
|
+
expect(await Encryption.decrypt(second)).toEqual(plainText);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|