@oneuptime/common 11.6.1 → 11.6.2
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 +240 -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 +1106 -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/Index.ts +10 -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 +677 -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/MonitorStepNetworkDeviceMonitor.test.ts +141 -1
- 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/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/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/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 +215 -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 +1124 -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/Index.js +10 -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 +582 -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/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
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appendRecipientToWhatsAppMessage,
|
|
3
|
+
createWhatsAppMessageFromTemplate,
|
|
4
|
+
getWhatsAppTemplateIdForEventType,
|
|
5
|
+
getWhatsAppTemplateStringForEventType,
|
|
6
|
+
} from "../../../Server/Utils/WhatsAppTemplateUtil";
|
|
7
|
+
import NotificationSettingEventType from "../../../Types/NotificationSetting/NotificationSettingEventType";
|
|
8
|
+
import Phone from "../../../Types/Phone";
|
|
9
|
+
import WhatsAppMessage, {
|
|
10
|
+
WhatsAppMessagePayload,
|
|
11
|
+
} from "../../../Types/WhatsApp/WhatsAppMessage";
|
|
12
|
+
import {
|
|
13
|
+
WhatsAppTemplateIds,
|
|
14
|
+
WhatsAppTemplateMessages,
|
|
15
|
+
} from "../../../Types/WhatsApp/WhatsAppTemplates";
|
|
16
|
+
import { describe, expect, test } from "@jest/globals";
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* WhatsAppTemplateUtil turns an event type + variables into a rendered
|
|
20
|
+
* WhatsApp template payload. The two behaviors most worth guarding:
|
|
21
|
+
*
|
|
22
|
+
* 1. Variable substitution is strict — a missing {{var}} throws rather than
|
|
23
|
+
* silently shipping a broken "{{alert_link}}" literal to a customer.
|
|
24
|
+
* 2. The dashboard-link injection defaults the template's link variable to
|
|
25
|
+
* the action link (or the hard-coded dashboard URL) when the caller does
|
|
26
|
+
* not supply one, so link-bearing templates never render an empty URL.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
describe("getWhatsAppTemplateIdForEventType", () => {
|
|
30
|
+
test("maps a known event type to its template id", () => {
|
|
31
|
+
expect(
|
|
32
|
+
getWhatsAppTemplateIdForEventType(
|
|
33
|
+
NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION,
|
|
34
|
+
),
|
|
35
|
+
).toBe(WhatsAppTemplateIds.IncidentCreatedOwnerNotification);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("throws for an event type that has no WhatsApp template", () => {
|
|
39
|
+
expect(() => {
|
|
40
|
+
return getWhatsAppTemplateIdForEventType(
|
|
41
|
+
"not-a-real-event" as unknown as NotificationSettingEventType,
|
|
42
|
+
);
|
|
43
|
+
}).toThrow("WhatsApp template is not defined for event type");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("getWhatsAppTemplateStringForEventType", () => {
|
|
48
|
+
test("returns the template content string for a known event type", () => {
|
|
49
|
+
const content: string = getWhatsAppTemplateStringForEventType(
|
|
50
|
+
NotificationSettingEventType.SEND_MONITOR_CREATED_OWNER_NOTIFICATION,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(content).toBe(
|
|
54
|
+
WhatsAppTemplateMessages[
|
|
55
|
+
WhatsAppTemplateIds.MonitorCreatedOwnerNotification
|
|
56
|
+
],
|
|
57
|
+
);
|
|
58
|
+
expect(content).toContain("{{monitor_name}}");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("throws for an unknown event type", () => {
|
|
62
|
+
expect(() => {
|
|
63
|
+
return getWhatsAppTemplateStringForEventType(
|
|
64
|
+
"nope" as unknown as NotificationSettingEventType,
|
|
65
|
+
);
|
|
66
|
+
}).toThrow("WhatsApp template is not defined for event type");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe("createWhatsAppMessageFromTemplate", () => {
|
|
71
|
+
test("renders variables from a supplied template string", () => {
|
|
72
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
73
|
+
templateKey: WhatsAppTemplateIds.VerificationCode,
|
|
74
|
+
templateString: "{{1}} is your code.",
|
|
75
|
+
templateVariables: { "1": "123456" },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(payload.body).toBe("123456 is your code.");
|
|
79
|
+
expect(payload.templateKey).toBe(WhatsAppTemplateIds.VerificationCode);
|
|
80
|
+
expect(payload.templateLanguageCode).toBe("en");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("resolves the template id from an event type", () => {
|
|
84
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
85
|
+
eventType:
|
|
86
|
+
NotificationSettingEventType.SEND_MONITOR_CREATED_OWNER_NOTIFICATION,
|
|
87
|
+
templateVariables: {
|
|
88
|
+
monitor_name: "API Monitor",
|
|
89
|
+
monitor_link: "https://oneuptime.com/monitor/1",
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
expect(payload.templateKey).toBe(
|
|
94
|
+
WhatsAppTemplateIds.MonitorCreatedOwnerNotification,
|
|
95
|
+
);
|
|
96
|
+
expect(payload.body).toContain("API Monitor");
|
|
97
|
+
expect(payload.body).toContain("https://oneuptime.com/monitor/1");
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("defaults the dashboard link variable to the provided action link", () => {
|
|
101
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
102
|
+
templateKey: WhatsAppTemplateIds.MonitorCreatedOwnerNotification,
|
|
103
|
+
actionLink: "https://oneuptime.com/dashboard/monitor/42",
|
|
104
|
+
templateVariables: {
|
|
105
|
+
monitor_name: "DB Monitor",
|
|
106
|
+
// monitor_link intentionally omitted — should be injected
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(payload.templateVariables?.["monitor_link"]).toBe(
|
|
111
|
+
"https://oneuptime.com/dashboard/monitor/42",
|
|
112
|
+
);
|
|
113
|
+
expect(payload.body).toContain(
|
|
114
|
+
"https://oneuptime.com/dashboard/monitor/42",
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("falls back to the default dashboard URL when no action link given", () => {
|
|
119
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
120
|
+
templateKey: WhatsAppTemplateIds.MonitorCreatedOwnerNotification,
|
|
121
|
+
templateVariables: {
|
|
122
|
+
monitor_name: "DB Monitor",
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
expect(payload.templateVariables?.["monitor_link"]).toBe(
|
|
127
|
+
"https://oneuptime.com/dashboard",
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("a caller-supplied link variable wins over the action link", () => {
|
|
132
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
133
|
+
templateKey: WhatsAppTemplateIds.MonitorCreatedOwnerNotification,
|
|
134
|
+
actionLink: "https://oneuptime.com/dashboard/fallback",
|
|
135
|
+
templateVariables: {
|
|
136
|
+
monitor_name: "DB Monitor",
|
|
137
|
+
monitor_link: "https://oneuptime.com/explicit",
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
expect(payload.templateVariables?.["monitor_link"]).toBe(
|
|
142
|
+
"https://oneuptime.com/explicit",
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("trims whitespace around the resolved link", () => {
|
|
147
|
+
const payload: WhatsAppMessagePayload = createWhatsAppMessageFromTemplate({
|
|
148
|
+
templateKey: WhatsAppTemplateIds.MonitorCreatedOwnerNotification,
|
|
149
|
+
actionLink: " https://oneuptime.com/trimmed ",
|
|
150
|
+
templateVariables: {
|
|
151
|
+
monitor_name: "DB Monitor",
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
expect(payload.templateVariables?.["monitor_link"]).toBe(
|
|
156
|
+
"https://oneuptime.com/trimmed",
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("throws when a required template variable is missing", () => {
|
|
161
|
+
expect(() => {
|
|
162
|
+
return createWhatsAppMessageFromTemplate({
|
|
163
|
+
templateKey: WhatsAppTemplateIds.VerificationCode,
|
|
164
|
+
templateString: "{{1}} is your code for {{app_name}}.",
|
|
165
|
+
templateVariables: { "1": "123456" }, // app_name missing
|
|
166
|
+
});
|
|
167
|
+
}).toThrow('Missing variable "app_name"');
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test("throws when neither template key nor event type is provided", () => {
|
|
171
|
+
expect(() => {
|
|
172
|
+
return createWhatsAppMessageFromTemplate({
|
|
173
|
+
templateVariables: {},
|
|
174
|
+
});
|
|
175
|
+
}).toThrow("WhatsApp template key or event type must be provided");
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe("appendRecipientToWhatsAppMessage", () => {
|
|
180
|
+
test("attaches the recipient phone without mutating other fields", () => {
|
|
181
|
+
const payload: WhatsAppMessagePayload = {
|
|
182
|
+
body: "hello",
|
|
183
|
+
templateKey: WhatsAppTemplateIds.VerificationCode,
|
|
184
|
+
templateVariables: { "1": "1" },
|
|
185
|
+
templateLanguageCode: "en",
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const to: Phone = new Phone("+15551234567");
|
|
189
|
+
const message: WhatsAppMessage = appendRecipientToWhatsAppMessage(
|
|
190
|
+
payload,
|
|
191
|
+
to,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
expect(message.to).toBe(to);
|
|
195
|
+
expect(message.body).toBe("hello");
|
|
196
|
+
expect(message.templateKey).toBe(WhatsAppTemplateIds.VerificationCode);
|
|
197
|
+
expect(message.templateLanguageCode).toBe("en");
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import CompareBase, { CompareType } from "../../../Types/Database/CompareBase";
|
|
2
|
+
import EqualTo from "../../../Types/BaseDatabase/EqualTo";
|
|
3
|
+
import EqualToOrNull from "../../../Types/BaseDatabase/EqualToOrNull";
|
|
2
4
|
import GreaterThan from "../../../Types/BaseDatabase/GreaterThan";
|
|
3
5
|
import GreaterThanOrEqual from "../../../Types/BaseDatabase/GreaterThanOrEqual";
|
|
4
6
|
import GreaterThanOrNull from "../../../Types/BaseDatabase/GreaterThanOrNull";
|
|
@@ -6,6 +8,7 @@ import InBetween from "../../../Types/BaseDatabase/InBetween";
|
|
|
6
8
|
import LessThan from "../../../Types/BaseDatabase/LessThan";
|
|
7
9
|
import LessThanOrEqual from "../../../Types/BaseDatabase/LessThanOrEqual";
|
|
8
10
|
import LessThanOrNull from "../../../Types/BaseDatabase/LessThanOrNull";
|
|
11
|
+
import NotEqual from "../../../Types/BaseDatabase/NotEqual";
|
|
9
12
|
import JSONFunctions from "../../../Types/JSONFunctions";
|
|
10
13
|
import { JSONObject } from "../../../Types/JSON";
|
|
11
14
|
import { describe, expect, it } from "@jest/globals";
|
|
@@ -87,6 +90,36 @@ const OPERATOR_CASES: Array<OperatorCase> = [
|
|
|
87
90
|
return new GreaterThanOrNull(value);
|
|
88
91
|
},
|
|
89
92
|
},
|
|
93
|
+
/*
|
|
94
|
+
* The equality operators were missed when the six ordering operators above
|
|
95
|
+
* were converted, and kept serializing via toString(). That made them the
|
|
96
|
+
* only type-lossy path left: `new EqualTo(42)` came back as the string
|
|
97
|
+
* "42", and a Date came back as a locale string such as
|
|
98
|
+
* "Wed Jul 01 2026 13:34:56 GMT+0100 (British Summer Time)" — timezone
|
|
99
|
+
* dependent and missing milliseconds. Both broke as soon as a filter had to
|
|
100
|
+
* survive a round trip through the URL.
|
|
101
|
+
*/
|
|
102
|
+
{
|
|
103
|
+
name: "EqualTo",
|
|
104
|
+
type: EqualTo,
|
|
105
|
+
create: (value: CompareType) => {
|
|
106
|
+
return new EqualTo(value);
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "EqualToOrNull",
|
|
111
|
+
type: EqualToOrNull,
|
|
112
|
+
create: (value: CompareType) => {
|
|
113
|
+
return new EqualToOrNull(value);
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "NotEqual",
|
|
118
|
+
type: NotEqual,
|
|
119
|
+
create: (value: CompareType) => {
|
|
120
|
+
return new NotEqual(value);
|
|
121
|
+
},
|
|
122
|
+
},
|
|
90
123
|
];
|
|
91
124
|
|
|
92
125
|
type SimulateHttpHopFunction = (query: JSONObject) => JSONObject;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import Email from "../../Types/Email";
|
|
2
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
3
|
+
import { ObjectType } from "../../Types/JSON";
|
|
4
|
+
|
|
5
|
+
describe("Email", () => {
|
|
6
|
+
describe("isValid", () => {
|
|
7
|
+
test("should accept well formed addresses", () => {
|
|
8
|
+
const valid: Array<string> = [
|
|
9
|
+
"user@example.com",
|
|
10
|
+
"user.name+tag@example.co.uk",
|
|
11
|
+
"user_name@sub.domain.example.com",
|
|
12
|
+
"user-name@example.io",
|
|
13
|
+
"u@e.co",
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
for (const value of valid) {
|
|
17
|
+
expect(Email.isValid(value)).toBe(true);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("should reject malformed addresses", () => {
|
|
22
|
+
const invalid: Array<string> = [
|
|
23
|
+
"",
|
|
24
|
+
"userexample.com",
|
|
25
|
+
"@example.com",
|
|
26
|
+
"user@",
|
|
27
|
+
"user@@example.com",
|
|
28
|
+
"user @example.com",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
for (const value of invalid) {
|
|
32
|
+
expect(Email.isValid(value)).toBe(false);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("constructor", () => {
|
|
38
|
+
test("should trim and lowercase the address", () => {
|
|
39
|
+
expect(new Email(" User.Name@Example.COM ").toString()).toEqual(
|
|
40
|
+
"user.name@example.com",
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("should throw BadDataException for an invalid address", () => {
|
|
45
|
+
expect(() => {
|
|
46
|
+
return new Email("not-an-email");
|
|
47
|
+
}).toThrow(BadDataException);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("should throw BadDataException for an empty address", () => {
|
|
51
|
+
expect(() => {
|
|
52
|
+
return new Email("");
|
|
53
|
+
}).toThrow(BadDataException);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe("fromString", () => {
|
|
58
|
+
test("should build an Email instance", () => {
|
|
59
|
+
const email: Email = Email.fromString("user@example.com");
|
|
60
|
+
|
|
61
|
+
expect(email).toBeInstanceOf(Email);
|
|
62
|
+
expect(email.toString()).toEqual("user@example.com");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("getEmailDomain", () => {
|
|
67
|
+
test("should return the hostname after the @", () => {
|
|
68
|
+
expect(
|
|
69
|
+
new Email("user@sub.example.com").getEmailDomain().hostname,
|
|
70
|
+
).toEqual("sub.example.com");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("isBusinessEmail", () => {
|
|
75
|
+
test("should return false for well known consumer providers", () => {
|
|
76
|
+
const consumer: Array<string> = [
|
|
77
|
+
"user@gmail.com",
|
|
78
|
+
"user@yahoo.com",
|
|
79
|
+
"user@hotmail.com",
|
|
80
|
+
"user@outlook.com",
|
|
81
|
+
"user@icloud.com",
|
|
82
|
+
"user@protonmail.com",
|
|
83
|
+
"user@yandex.com",
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
for (const value of consumer) {
|
|
87
|
+
expect(new Email(value).isBusinessEmail()).toBe(false);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("should return true for company domains", () => {
|
|
92
|
+
expect(new Email("user@oneuptime.com").isBusinessEmail()).toBe(true);
|
|
93
|
+
expect(new Email("user@acme.io").isBusinessEmail()).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe("parseList", () => {
|
|
98
|
+
test("should return an empty list for null, undefined and empty input", () => {
|
|
99
|
+
expect(Email.parseList(null)).toEqual([]);
|
|
100
|
+
expect(Email.parseList(undefined)).toEqual([]);
|
|
101
|
+
expect(Email.parseList("")).toEqual([]);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("should split on commas, semicolons and whitespace", () => {
|
|
105
|
+
const emails: Array<Email> = Email.parseList(
|
|
106
|
+
"a@example.com, b@example.com; c@example.com d@example.com",
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
expect(
|
|
110
|
+
emails.map((e: Email) => {
|
|
111
|
+
return e.toString();
|
|
112
|
+
}),
|
|
113
|
+
).toEqual([
|
|
114
|
+
"a@example.com",
|
|
115
|
+
"b@example.com",
|
|
116
|
+
"c@example.com",
|
|
117
|
+
"d@example.com",
|
|
118
|
+
]);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test("should de-duplicate addresses case insensitively", () => {
|
|
122
|
+
const emails: Array<Email> = Email.parseList(
|
|
123
|
+
"a@example.com, A@Example.com, b@example.com",
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
expect(emails.length).toEqual(2);
|
|
127
|
+
expect(emails[0]!.toString()).toEqual("a@example.com");
|
|
128
|
+
expect(emails[1]!.toString()).toEqual("b@example.com");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("should throw when any entry in the list is invalid", () => {
|
|
132
|
+
expect(() => {
|
|
133
|
+
return Email.parseList("a@example.com, not-an-email");
|
|
134
|
+
}).toThrow(BadDataException);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe("isValidList", () => {
|
|
139
|
+
test("should treat null, undefined and empty input as valid", () => {
|
|
140
|
+
expect(Email.isValidList(null)).toBe(true);
|
|
141
|
+
expect(Email.isValidList(undefined)).toBe(true);
|
|
142
|
+
expect(Email.isValidList("")).toBe(true);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test("should return false when the input has only separators", () => {
|
|
146
|
+
expect(Email.isValidList(" , ; ")).toBe(false);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("should validate every entry", () => {
|
|
150
|
+
expect(Email.isValidList("a@example.com; b@example.com")).toBe(true);
|
|
151
|
+
expect(Email.isValidList("a@example.com, bad")).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe("toJSON / fromJSON", () => {
|
|
156
|
+
test("should round trip through JSON", () => {
|
|
157
|
+
const email: Email = new Email("user@example.com");
|
|
158
|
+
const json: ReturnType<Email["toJSON"]> = email.toJSON();
|
|
159
|
+
|
|
160
|
+
expect(json).toEqual({
|
|
161
|
+
_type: ObjectType.Email,
|
|
162
|
+
value: "user@example.com",
|
|
163
|
+
});
|
|
164
|
+
expect(Email.fromJSON(json).toString()).toEqual("user@example.com");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test("should throw when the JSON is not an Email object", () => {
|
|
168
|
+
expect(() => {
|
|
169
|
+
return Email.fromJSON({ _type: "SomethingElse", value: "x@y.com" });
|
|
170
|
+
}).toThrow(BadDataException);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe("toDatabase / fromDatabase", () => {
|
|
175
|
+
test("should convert to a plain string for the database", () => {
|
|
176
|
+
expect(Email.toDatabase(new Email("user@example.com"))).toEqual(
|
|
177
|
+
"user@example.com",
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("should accept a raw string and normalize it", () => {
|
|
182
|
+
expect(Email.toDatabase("User@Example.com" as unknown as Email)).toEqual(
|
|
183
|
+
"user@example.com",
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("should return null for empty database values", () => {
|
|
188
|
+
expect(Email.toDatabase(null as unknown as Email)).toBeNull();
|
|
189
|
+
expect(Email.fromDatabase("")).toBeNull();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("should hydrate from a database string", () => {
|
|
193
|
+
expect(Email.fromDatabase("user@example.com")?.toString()).toEqual(
|
|
194
|
+
"user@example.com",
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
2
|
+
import {
|
|
3
|
+
extractObjectFromLogBody,
|
|
4
|
+
getArrayValues,
|
|
5
|
+
getKvListAsRecord,
|
|
6
|
+
getKvStringValue,
|
|
7
|
+
getKvValue,
|
|
8
|
+
getNestedKvValue,
|
|
9
|
+
kvListToPlainObject,
|
|
10
|
+
} from "../../../Types/Kubernetes/KubernetesObjectParser";
|
|
11
|
+
import { describe, expect, test } from "@jest/globals";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* KubernetesObjectParser decodes OTLP kvlistValue payloads (the wire shape the
|
|
15
|
+
* agent ships k8s objects in) into plain values. The OTLP encoding carries the
|
|
16
|
+
* SAME field under camelCase (JSON transport) and snake_case (protobufjs
|
|
17
|
+
* transport), and the parser must accept both — a regression that handled only
|
|
18
|
+
* one encoding would silently drop half the fleet's data. These tests cover the
|
|
19
|
+
* low-level kv helpers on both encodings plus the log-body entrypoint.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// Build an OTLP kvlist from a list of [key, valueWrapper] pairs.
|
|
23
|
+
function kvList(entries: Array<[string, JSONObject]>): JSONObject {
|
|
24
|
+
return {
|
|
25
|
+
values: entries.map(([key, value]: [string, JSONObject]) => {
|
|
26
|
+
return { key, value };
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe("getKvValue", () => {
|
|
32
|
+
test("reads a camelCase stringValue", () => {
|
|
33
|
+
const list: JSONObject = kvList([["name", { stringValue: "web-1" }]]);
|
|
34
|
+
expect(getKvValue(list, "name")).toBe("web-1");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("reads a snake_case string_value", () => {
|
|
38
|
+
const list: JSONObject = kvList([["name", { string_value: "web-1" }]]);
|
|
39
|
+
expect(getKvValue(list, "name")).toBe("web-1");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("stringifies int and bool values", () => {
|
|
43
|
+
expect(
|
|
44
|
+
getKvValue(kvList([["replicas", { intValue: 3 }]]), "replicas"),
|
|
45
|
+
).toBe("3");
|
|
46
|
+
expect(getKvValue(kvList([["ready", { boolValue: true }]]), "ready")).toBe(
|
|
47
|
+
"true",
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("returns a nested kvlist as an object", () => {
|
|
52
|
+
const nested: JSONObject = kvList([["app", { stringValue: "api" }]]);
|
|
53
|
+
const list: JSONObject = kvList([["labels", { kvlistValue: nested }]]);
|
|
54
|
+
expect(getKvValue(list, "labels")).toEqual(nested);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("returns null for a missing key, missing values, or undefined list", () => {
|
|
58
|
+
expect(getKvValue(kvList([["a", { stringValue: "1" }]]), "b")).toBeNull();
|
|
59
|
+
expect(getKvValue({}, "a")).toBeNull();
|
|
60
|
+
expect(getKvValue(undefined, "a")).toBeNull();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe("getKvStringValue", () => {
|
|
65
|
+
test("returns the string value", () => {
|
|
66
|
+
expect(getKvStringValue(kvList([["k", { stringValue: "v" }]]), "k")).toBe(
|
|
67
|
+
"v",
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("returns empty string when the value is a nested object or missing", () => {
|
|
72
|
+
const list: JSONObject = kvList([["k", { kvlistValue: kvList([]) }]]);
|
|
73
|
+
expect(getKvStringValue(list, "k")).toBe("");
|
|
74
|
+
expect(getKvStringValue(list, "missing")).toBe("");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("getNestedKvValue", () => {
|
|
79
|
+
test("reads parent -> child", () => {
|
|
80
|
+
const child: JSONObject = kvList([["name", { stringValue: "prod" }]]);
|
|
81
|
+
const list: JSONObject = kvList([["metadata", { kvlistValue: child }]]);
|
|
82
|
+
expect(getNestedKvValue(list, "metadata", "name")).toBe("prod");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("returns empty string when the parent is absent or a string", () => {
|
|
86
|
+
const list: JSONObject = kvList([["metadata", { stringValue: "flat" }]]);
|
|
87
|
+
expect(getNestedKvValue(list, "metadata", "name")).toBe("");
|
|
88
|
+
expect(getNestedKvValue(list, "missing", "name")).toBe("");
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe("getKvListAsRecord", () => {
|
|
93
|
+
test("flattens mixed scalar entries into a string record", () => {
|
|
94
|
+
const list: JSONObject = kvList([
|
|
95
|
+
["app", { stringValue: "api" }],
|
|
96
|
+
["replicas", { intValue: 2 }],
|
|
97
|
+
["ready", { boolValue: false }],
|
|
98
|
+
]);
|
|
99
|
+
expect(getKvListAsRecord(list)).toEqual({
|
|
100
|
+
app: "api",
|
|
101
|
+
replicas: "2",
|
|
102
|
+
ready: "false",
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("skips entries without a key or value and handles undefined", () => {
|
|
107
|
+
expect(getKvListAsRecord(undefined)).toEqual({});
|
|
108
|
+
const list: JSONObject = {
|
|
109
|
+
values: [{ key: "", value: { stringValue: "x" } }],
|
|
110
|
+
};
|
|
111
|
+
expect(getKvListAsRecord(list)).toEqual({});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("getArrayValues", () => {
|
|
116
|
+
test("extracts kvlistValue items from an OTLP arrayValue", () => {
|
|
117
|
+
const item1: JSONObject = kvList([["name", { stringValue: "c1" }]]);
|
|
118
|
+
const item2: JSONObject = kvList([["name", { stringValue: "c2" }]]);
|
|
119
|
+
const arrayValue: JSONObject = {
|
|
120
|
+
values: [{ kvlistValue: item1 }, { kvlistValue: item2 }],
|
|
121
|
+
};
|
|
122
|
+
expect(getArrayValues(arrayValue)).toEqual([item1, item2]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("returns an empty array for undefined or empty input", () => {
|
|
126
|
+
expect(getArrayValues(undefined)).toEqual([]);
|
|
127
|
+
expect(getArrayValues({})).toEqual([]);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("kvListToPlainObject", () => {
|
|
132
|
+
test("converts values to their native JS types", () => {
|
|
133
|
+
const list: JSONObject = kvList([
|
|
134
|
+
["name", { stringValue: "api" }],
|
|
135
|
+
["replicas", { intValue: "3" }],
|
|
136
|
+
["enabled", { boolValue: true }],
|
|
137
|
+
]);
|
|
138
|
+
const plain: Record<string, unknown> = kvListToPlainObject(list);
|
|
139
|
+
expect(plain["name"]).toBe("api");
|
|
140
|
+
expect(plain["replicas"]).toBe(3); // number, not string
|
|
141
|
+
expect(plain["enabled"]).toBe(true);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("returns an empty object for undefined input", () => {
|
|
145
|
+
expect(kvListToPlainObject(undefined)).toEqual({});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe("extractObjectFromLogBody", () => {
|
|
150
|
+
test("returns null for invalid JSON", () => {
|
|
151
|
+
expect(extractObjectFromLogBody("{ not json")).toBeNull();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("returns null when there is no top-level kvlist", () => {
|
|
155
|
+
expect(extractObjectFromLogBody(JSON.stringify({ foo: "bar" }))).toBeNull();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("extracts the nested object under the 'object' key (watch mode)", () => {
|
|
159
|
+
const inner: JSONObject = kvList([["kind", { stringValue: "Pod" }]]);
|
|
160
|
+
const body: JSONObject = {
|
|
161
|
+
kvlistValue: kvList([["object", { kvlistValue: inner }]]),
|
|
162
|
+
};
|
|
163
|
+
expect(extractObjectFromLogBody(JSON.stringify(body))).toEqual(inner);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("treats the kvlist itself as the object when it has a kind (pull mode)", () => {
|
|
167
|
+
const topList: JSONObject = kvList([["kind", { stringValue: "Node" }]]);
|
|
168
|
+
const body: JSONObject = { kvlistValue: topList };
|
|
169
|
+
expect(extractObjectFromLogBody(JSON.stringify(body))).toEqual(topList);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("accepts the snake_case kvlist_value transport", () => {
|
|
173
|
+
const topList: JSONObject = kvList([["kind", { string_value: "Pod" }]]);
|
|
174
|
+
const body: JSONObject = { kvlist_value: topList };
|
|
175
|
+
expect(extractObjectFromLogBody(JSON.stringify(body))).toEqual(topList);
|
|
176
|
+
});
|
|
177
|
+
});
|