@oneuptime/common 11.7.2 → 11.7.4
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/KubernetesCostAllocation.ts +103 -0
- package/Models/DatabaseModels/AlertEpisodeStateTimeline.ts +1 -0
- package/Models/DatabaseModels/AlertStateTimeline.ts +1 -0
- package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +1 -0
- package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -0
- package/Models/DatabaseModels/Index.ts +5 -0
- package/Models/DatabaseModels/LogDropFilter.ts +89 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +13 -3
- package/Models/DatabaseModels/RecommendationDismissal.ts +463 -0
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.ts +1 -0
- package/Models/DatabaseModels/StatusPageGroup.ts +95 -0
- package/Models/DatabaseModels/TableView.ts +40 -0
- package/Models/DatabaseModels/TraceDropFilter.ts +89 -0
- package/Models/DatabaseModels/WorkflowVariable.ts +5 -1
- package/Server/API/AlertAPI.ts +32 -17
- package/Server/API/BaseAPI.ts +31 -2
- package/Server/API/BaseAnalyticsAPI.ts +36 -2
- package/Server/API/CommonAPI.ts +57 -0
- package/Server/API/IncidentAPI.ts +60 -33
- package/Server/API/IncidentEpisodeAPI.ts +31 -16
- package/Server/API/MonitorAPI.ts +30 -0
- package/Server/API/MonitorTemplateAPI.ts +8 -0
- package/Server/API/ProbeAPI.ts +196 -15
- package/Server/API/ProjectAPI.ts +79 -1
- package/Server/API/ScheduledMaintenanceAPI.ts +33 -18
- package/Server/API/StatusPageAPI.ts +74 -37
- package/Server/API/WorkspaceNotificationRuleAPI.ts +34 -4
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785241000000-AddColumnsToTableView.ts +13 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.ts +527 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.ts +55 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.ts +53 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +10 -0
- package/Server/Services/AlertEpisodeService.ts +47 -0
- package/Server/Services/AlertService.ts +125 -0
- package/Server/Services/BillingService.ts +98 -0
- package/Server/Services/DatabaseService.ts +184 -20
- package/Server/Services/IncidentEpisodeService.ts +47 -0
- package/Server/Services/IncidentService.ts +123 -0
- package/Server/Services/IncidentTemplateService.ts +123 -1
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/LogDropFilterService.ts +133 -0
- package/Server/Services/MonitorProbeService.ts +94 -4
- package/Server/Services/MonitorService.ts +48 -43
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +70 -0
- package/Server/Services/ProbeService.ts +66 -0
- package/Server/Services/ProjectService.ts +131 -7
- package/Server/Services/RecommendationDismissalService.ts +52 -0
- package/Server/Services/RunbookAgentJobService.ts +68 -7
- package/Server/Services/ScheduledMaintenanceService.ts +103 -0
- package/Server/Services/ScheduledMaintenanceTemplateService.ts +90 -0
- package/Server/Services/StatusPageGroupService.ts +186 -0
- package/Server/Services/TraceDropFilterService.ts +133 -0
- package/Server/Types/Workflow/Components/API/Delete.ts +12 -0
- package/Server/Types/Workflow/Components/API/Get.ts +12 -0
- package/Server/Types/Workflow/Components/API/Patch.ts +12 -0
- package/Server/Types/Workflow/Components/API/Post.ts +12 -0
- package/Server/Types/Workflow/Components/API/Put.ts +13 -0
- package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +212 -0
- package/Server/Utils/DropFilterValidation.ts +127 -0
- package/Server/Utils/Errors.ts +5 -0
- package/Server/Utils/Monitor/MonitorAlert.ts +28 -1
- package/Server/Utils/Monitor/MonitorIncident.ts +31 -2
- package/Server/Utils/Telemetry/AppMetrics.ts +31 -0
- package/Tests/Models/AnalyticsModels/KubernetesCostAllocation.test.ts +16 -0
- package/Tests/Models/DatabaseModels/MonitorProbeColumnAccessControl.test.ts +196 -0
- package/Tests/Models/RecommendationDismissalModel.test.ts +269 -0
- package/Tests/Server/API/BaseAPIUpdatePayloadValidation.test.ts +320 -0
- package/Tests/Server/API/BaseAnalyticsAPIUpdatePayloadValidation.test.ts +293 -0
- package/Tests/Server/API/CommonAPIAuthGuard.test.ts +164 -0
- package/Tests/Server/API/ProbeAPI.test.ts +422 -53
- package/Tests/Server/API/ProjectAPI.test.ts +180 -0
- package/Tests/Server/API/ProjectAPIExtendTrialBillingDisabled.test.ts +138 -0
- package/Tests/Server/API/ProjectScopedCustomRouteAuth.test.ts +458 -0
- package/Tests/Server/Infrastructure/ContainerBootConfiguration.test.ts +359 -0
- package/Tests/Server/Infrastructure/ProcessSignalDelivery.test.ts +427 -0
- package/Tests/Server/Services/BillingServiceExtendTrial.test.ts +439 -0
- package/Tests/Server/Services/CrossProjectReferenceWriteGuard.test.ts +810 -0
- package/Tests/Server/Services/DatabaseServiceAtomicAddToColumns.test.ts +269 -0
- package/Tests/Server/Services/DatabaseServiceEmptyUpdate.test.ts +277 -0
- package/Tests/Server/Services/DatabaseServiceSortColumnSelect.test.ts +201 -0
- package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +81 -23
- package/Tests/Server/Services/DropFilterSaveValidation.test.ts +398 -0
- package/Tests/Server/Services/MonitorProbeDeleteHooks.test.ts +280 -0
- package/Tests/Server/Services/MonitorProbeServiceProbeTenancy.test.ts +304 -0
- package/Tests/Server/Services/NetworkDeviceDiscoveryScanService.test.ts +262 -0
- package/Tests/Server/Services/ProjectServiceExtendTrial.test.ts +614 -0
- package/Tests/Server/Services/RecommendationDismissalService.test.ts +306 -0
- package/Tests/Server/Services/RepairCrossProjectIncidentReferencesMigration.test.ts +528 -0
- package/Tests/Server/Services/StatusPageGroupNesting.test.ts +395 -0
- package/Tests/Server/TestingUtils/Services/BillingServiceHelper.ts +26 -21
- package/Tests/Server/Types/Database/Permissions/WorkflowVariableColumnPermission.test.ts +227 -0
- package/Tests/Server/Types/Workflow/Components/ApiComponentErrorPort.test.ts +285 -0
- package/Tests/Server/Utils/Database/ProjectScopedReferenceValidator.test.ts +463 -0
- package/Tests/Server/Utils/DropFilterValidation.test.ts +269 -0
- package/Tests/Server/Utils/Telemetry/SpanUtil.test.ts +94 -0
- package/Tests/Types/DateUserTimezone.test.ts +52 -0
- package/Tests/Types/JSONFunctions.test.ts +103 -1
- package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +177 -9
- package/Tests/Types/Monitor/MonitorStepDnsMonitor.test.ts +105 -0
- package/Tests/Types/Monitor/MonitorStepDnssecMonitor.test.ts +131 -0
- package/Tests/Types/Monitor/MonitorStepDomainMonitor.test.ts +60 -0
- package/Tests/Types/Monitor/MonitorStepExternalStatusPageMonitor.test.ts +82 -0
- package/Tests/Types/Monitor/MonitorStepInfrastructureMonitors.test.ts +268 -0
- package/Tests/Types/Monitor/MonitorStepMetricMonitor.test.ts +386 -0
- package/Tests/Types/Monitor/MonitorStepProfileMonitor.test.ts +185 -0
- package/Tests/Types/Monitor/MonitorStepSnmpMonitor.test.ts +156 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +371 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +901 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +607 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.test.ts +754 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +960 -0
- package/Tests/Types/RollingTime/RollingTimeUtil.test.ts +186 -0
- package/Tests/Types/Runbook/RunbookStepTimeout.test.ts +410 -0
- package/Tests/Types/Telemetry/DropFilterSampling.test.ts +241 -0
- package/Tests/Types/Workspace/NotificationRuleConditionUtil.test.ts +353 -0
- package/Tests/Types/Workspace/NotificationRuleUtil.test.ts +566 -0
- package/Tests/UI/Components/CodeEditor.test.tsx +174 -0
- package/Tests/UI/Components/ErrorBoundary.test.tsx +555 -24
- package/Tests/UI/Components/InfoCard.test.tsx +358 -0
- package/Tests/UI/Components/LogTimeRangePicker.test.tsx +138 -0
- package/Tests/UI/Components/Modal.test.tsx +43 -5
- package/Tests/UI/Components/ModelTable/BaseModelTableColumnCustomization.test.tsx +679 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableSearchLabels.test.tsx +397 -0
- package/Tests/UI/Components/ModelTable/ColumnCustomizationModal.test.tsx +999 -0
- package/Tests/UI/Components/ModelTable/ColumnPreference.test.ts +1678 -0
- package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +1094 -0
- package/Tests/UI/Components/Runbook/StepTimeoutInput.test.tsx +386 -0
- package/Tests/UI/Components/StatusPage/ResourceGroupSection.test.tsx +671 -0
- package/Tests/UI/Components/TelemetryTimeRangePicker.test.tsx +404 -0
- package/Tests/UI/Utils/DropdownAlignment.test.ts +306 -0
- package/Tests/UI/Utils/TableFilterUrlState.test.ts +292 -0
- package/Tests/Utils/Monitor/MonitorSummaryProbeUtil.test.ts +263 -0
- package/Tests/Utils/NetworkDiscovery/ScanTargetUtil.test.ts +583 -0
- package/Tests/Utils/StatusPage/GroupNestingLayout.test.ts +1072 -0
- package/Tests/Utils/StatusPage/GroupTree.test.ts +583 -0
- package/Tests/Utils/StatusPage/ResourceUptime.test.ts +411 -0
- package/Tests/Utils/UserPreferences.test.ts +563 -0
- package/Types/Date.ts +15 -6
- package/Types/JSONFunctions.ts +7 -2
- package/Types/Kubernetes/KubernetesCostIngest.ts +37 -1
- package/Types/Monitor/KubernetesAlertTemplates.ts +205 -0
- package/Types/Monitor/MonitorStep.ts +10 -1
- package/Types/Monitor/MonitorStepMetricMonitor.ts +46 -1
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +413 -0
- package/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.ts +168 -0
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +175 -0
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +743 -0
- package/Types/Permission.ts +45 -0
- package/Types/Recommendation/RecommendationType.ts +20 -0
- package/Types/Runbook/RunbookExecutionDeadline.ts +129 -0
- package/Types/Runbook/RunbookStepTimeout.ts +202 -0
- package/Types/Telemetry/DropFilterSampling.ts +92 -0
- package/UI/Components/AI/GenerateFromAIModal.tsx +0 -2
- package/UI/Components/Accordion/Accordion.tsx +10 -2
- package/UI/Components/BulkUpdate/BulkLabelActions.tsx +0 -1
- package/UI/Components/CodeEditor/CodeEditor.tsx +34 -20
- package/UI/Components/Date/RangeStartAndEndDateView.tsx +0 -1
- package/UI/Components/EditionLabel/EditionLabel.tsx +1 -27
- package/UI/Components/Error/PageError.tsx +0 -4
- package/UI/Components/ErrorBoundary.tsx +252 -15
- package/UI/Components/InfoCard/InfoCard.tsx +58 -1
- package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +34 -1
- package/UI/Components/MasterPage/MasterPage.tsx +65 -0
- package/UI/Components/Modal/Modal.tsx +16 -60
- package/UI/Components/ModelFormModal/ModelFormModal.tsx +0 -8
- package/UI/Components/ModelTable/BaseModelTable.tsx +503 -71
- package/UI/Components/ModelTable/Column.ts +17 -0
- package/UI/Components/ModelTable/ColumnCustomizationModal.tsx +523 -0
- package/UI/Components/ModelTable/ColumnPreference.ts +482 -0
- package/UI/Components/ModelTable/CustomFieldColumns.tsx +326 -0
- package/UI/Components/ModelTable/TableView.tsx +24 -2
- package/UI/Components/ModelTable/useCustomFieldColumns.ts +150 -0
- package/UI/Components/Runbook/StepTimeoutInput.tsx +173 -0
- package/UI/Components/SideMenu/SideMenu.tsx +24 -4
- package/UI/Components/StatusPage/ResourceGroupSection.tsx +231 -0
- package/UI/Components/Table/Table.tsx +14 -1
- package/UI/Components/Table/TableRow.tsx +180 -175
- package/UI/Components/Table/Types/Column.ts +2 -0
- package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +34 -1
- package/UI/Utils/DropdownAlignment.ts +162 -0
- package/UI/Utils/TableFilterUrlState.ts +59 -20
- package/Utils/API.ts +106 -2
- package/Utils/Monitor/MonitorSummaryProbeUtil.ts +130 -0
- package/Utils/NetworkDiscovery/ScanTargetUtil.ts +434 -0
- package/Utils/StatusPage/GroupNestingLayout.ts +343 -0
- package/Utils/StatusPage/GroupTree.ts +307 -0
- package/Utils/StatusPage/ResourceUptime.ts +90 -17
- package/Utils/UserPreferences.ts +53 -0
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js +86 -0
- package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/AlertStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/LogDropFilter.js +91 -0
- package/build/dist/Models/DatabaseModels/LogDropFilter.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +14 -4
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RecommendationDismissal.js +484 -0
- package/build/dist/Models/DatabaseModels/RecommendationDismissal.js.map +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageGroup.js +94 -0
- package/build/dist/Models/DatabaseModels/StatusPageGroup.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TableView.js +40 -0
- package/build/dist/Models/DatabaseModels/TableView.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TraceDropFilter.js +91 -0
- package/build/dist/Models/DatabaseModels/TraceDropFilter.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkflowVariable.js +5 -1
- package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +22 -13
- package/build/dist/Server/API/AlertAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +22 -1
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js +24 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +42 -0
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentAPI.js +43 -26
- package/build/dist/Server/API/IncidentAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +21 -12
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
- package/build/dist/Server/API/MonitorAPI.js +23 -0
- package/build/dist/Server/API/MonitorAPI.js.map +1 -1
- package/build/dist/Server/API/MonitorTemplateAPI.js +4 -0
- package/build/dist/Server/API/MonitorTemplateAPI.js.map +1 -1
- package/build/dist/Server/API/ProbeAPI.js +131 -15
- package/build/dist/Server/API/ProbeAPI.js.map +1 -1
- package/build/dist/Server/API/ProjectAPI.js +62 -3
- package/build/dist/Server/API/ProjectAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +23 -14
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +61 -33
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js +26 -2
- package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785241000000-AddColumnsToTableView.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785241000000-AddColumnsToTableView.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js +397 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.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/AlertEpisodeService.js +39 -0
- package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +95 -0
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +71 -0
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +140 -17
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js +39 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +100 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentTemplateService.js +97 -0
- package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/LogDropFilterService.js +93 -0
- package/build/dist/Server/Services/LogDropFilterService.js.map +1 -1
- package/build/dist/Server/Services/MonitorProbeService.js +73 -5
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +34 -39
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +71 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +64 -0
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +103 -7
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/RecommendationDismissalService.js +50 -0
- package/build/dist/Server/Services/RecommendationDismissalService.js.map +1 -0
- package/build/dist/Server/Services/RunbookAgentJobService.js +63 -5
- package/build/dist/Server/Services/RunbookAgentJobService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +83 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +65 -0
- package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageGroupService.js +136 -0
- package/build/dist/Server/Services/StatusPageGroupService.js.map +1 -1
- package/build/dist/Server/Services/TraceDropFilterService.js +93 -0
- package/build/dist/Server/Services/TraceDropFilterService.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Delete.js +11 -0
- package/build/dist/Server/Types/Workflow/Components/API/Delete.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Get.js +11 -0
- package/build/dist/Server/Types/Workflow/Components/API/Get.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Patch.js +11 -0
- package/build/dist/Server/Types/Workflow/Components/API/Patch.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -0
- package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Put.js +12 -0
- package/build/dist/Server/Types/Workflow/Components/API/Put.js.map +1 -1
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +132 -0
- package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -0
- package/build/dist/Server/Utils/DropFilterValidation.js +80 -0
- package/build/dist/Server/Utils/DropFilterValidation.js.map +1 -0
- package/build/dist/Server/Utils/Errors.js +3 -0
- package/build/dist/Server/Utils/Errors.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +30 -12
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +38 -18
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/AppMetrics.js +26 -0
- package/build/dist/Server/Utils/Telemetry/AppMetrics.js.map +1 -1
- package/build/dist/Types/Date.js +14 -4
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js +8 -3
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/Kubernetes/KubernetesCostIngest.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +192 -0
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +6 -1
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js +32 -1
- package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +294 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js +110 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js.map +1 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +58 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +451 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -0
- package/build/dist/Types/Permission.js +40 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Recommendation/RecommendationType.js +21 -0
- package/build/dist/Types/Recommendation/RecommendationType.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookExecutionDeadline.js +93 -0
- package/build/dist/Types/Runbook/RunbookExecutionDeadline.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepTimeout.js +142 -0
- package/build/dist/Types/Runbook/RunbookStepTimeout.js.map +1 -0
- package/build/dist/Types/Telemetry/DropFilterSampling.js +75 -0
- package/build/dist/Types/Telemetry/DropFilterSampling.js.map +1 -0
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js +1 -2
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js.map +1 -1
- package/build/dist/UI/Components/Accordion/Accordion.js +9 -2
- package/build/dist/UI/Components/Accordion/Accordion.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +27 -14
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js +1 -1
- package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js +2 -20
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- package/build/dist/UI/Components/Error/PageError.js +1 -3
- package/build/dist/UI/Components/Error/PageError.js.map +1 -1
- package/build/dist/UI/Components/ErrorBoundary.js +145 -11
- package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
- package/build/dist/UI/Components/InfoCard/InfoCard.js +28 -1
- package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +13 -2
- package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Components/MasterPage/MasterPage.js +50 -1
- package/build/dist/UI/Components/MasterPage/MasterPage.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +4 -32
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +308 -40
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js +230 -0
- package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/ColumnPreference.js +258 -0
- package/build/dist/UI/Components/ModelTable/ColumnPreference.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +168 -0
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/TableView.js +13 -2
- package/build/dist/UI/Components/ModelTable/TableView.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/useCustomFieldColumns.js +84 -0
- package/build/dist/UI/Components/ModelTable/useCustomFieldColumns.js.map +1 -0
- package/build/dist/UI/Components/Runbook/StepTimeoutInput.js +101 -0
- package/build/dist/UI/Components/Runbook/StepTimeoutInput.js.map +1 -0
- package/build/dist/UI/Components/SideMenu/SideMenu.js +15 -5
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js +73 -0
- package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js.map +1 -0
- package/build/dist/UI/Components/Table/Table.js +15 -2
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/Table/TableRow.js +11 -6
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +13 -2
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
- package/build/dist/UI/Utils/DropdownAlignment.js +98 -0
- package/build/dist/UI/Utils/DropdownAlignment.js.map +1 -0
- package/build/dist/UI/Utils/TableFilterUrlState.js +48 -15
- package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
- package/build/dist/Utils/API.js +39 -2
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js +97 -0
- package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js +330 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js.map +1 -0
- package/build/dist/Utils/StatusPage/GroupNestingLayout.js +280 -0
- package/build/dist/Utils/StatusPage/GroupNestingLayout.js.map +1 -0
- package/build/dist/Utils/StatusPage/GroupTree.js +214 -0
- package/build/dist/Utils/StatusPage/GroupTree.js.map +1 -0
- package/build/dist/Utils/StatusPage/ResourceUptime.js +60 -16
- package/build/dist/Utils/StatusPage/ResourceUptime.js.map +1 -1
- package/build/dist/Utils/UserPreferences.js +33 -0
- package/build/dist/Utils/UserPreferences.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import FilterCondition from "../../../Types/Filter/FilterCondition";
|
|
2
|
+
import {
|
|
3
|
+
ConditionType,
|
|
4
|
+
NotificationRuleConditionCheckOn,
|
|
5
|
+
} from "../../../Types/Workspace/NotificationRules/NotificationRuleCondition";
|
|
6
|
+
import { WorkspaceNotificationRuleUtil } from "../../../Types/Workspace/NotificationRules/NotificationRuleUtil";
|
|
7
|
+
import IncidentNotificationRule from "../../../Types/Workspace/NotificationRules/NotificationRuleTypes/IncidentNotificationRule";
|
|
8
|
+
import { describe, expect, it } from "@jest/globals";
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* WorkspaceNotificationRuleUtil.isRuleMatching decides whether an incident /
|
|
12
|
+
* alert / monitor event should fire a workspace notification rule. Getting the
|
|
13
|
+
* comparison semantics wrong here means a rule silently over- or under-fires
|
|
14
|
+
* (a channel that never gets created, or one that gets created for every
|
|
15
|
+
* event), so every condition operator and both filter-combining modes are
|
|
16
|
+
* pinned down below.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
type CheckOnValues = {
|
|
20
|
+
[key in NotificationRuleConditionCheckOn]: string | Array<string> | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// A rule with a single filter is the simplest way to exercise one operator.
|
|
24
|
+
function ruleWithFilters(
|
|
25
|
+
filters: Array<{
|
|
26
|
+
checkOn: NotificationRuleConditionCheckOn;
|
|
27
|
+
conditionType: ConditionType | undefined;
|
|
28
|
+
value: string | Array<string> | undefined;
|
|
29
|
+
}>,
|
|
30
|
+
filterCondition: FilterCondition = FilterCondition.All,
|
|
31
|
+
): IncidentNotificationRule {
|
|
32
|
+
return {
|
|
33
|
+
_type: "IncidentNotificationRule",
|
|
34
|
+
filterCondition,
|
|
35
|
+
filters,
|
|
36
|
+
shouldCreateNewChannel: false,
|
|
37
|
+
shouldPostToExistingChannel: false,
|
|
38
|
+
existingChannelNames: "",
|
|
39
|
+
inviteTeamsToNewChannel: [],
|
|
40
|
+
inviteUsersToNewChannel: [],
|
|
41
|
+
shouldInviteOwnersToNewChannel: false,
|
|
42
|
+
newChannelTemplateName: "",
|
|
43
|
+
archiveChannelAutomatically: false,
|
|
44
|
+
shouldAutomaticallyInviteOnCallUsersToNewChannel: false,
|
|
45
|
+
} as IncidentNotificationRule;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* Only the checkOn keys referenced by a test need real values; fill the rest
|
|
50
|
+
* with undefined so the typed record stays complete.
|
|
51
|
+
*/
|
|
52
|
+
function valuesFor(partial: Partial<CheckOnValues>): CheckOnValues {
|
|
53
|
+
const base: Partial<CheckOnValues> = {};
|
|
54
|
+
for (const key of Object.values(NotificationRuleConditionCheckOn)) {
|
|
55
|
+
base[key] = undefined;
|
|
56
|
+
}
|
|
57
|
+
return { ...base, ...partial } as CheckOnValues;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function isMatching(
|
|
61
|
+
filters: Array<{
|
|
62
|
+
checkOn: NotificationRuleConditionCheckOn;
|
|
63
|
+
conditionType: ConditionType | undefined;
|
|
64
|
+
value: string | Array<string> | undefined;
|
|
65
|
+
}>,
|
|
66
|
+
values: Partial<CheckOnValues>,
|
|
67
|
+
filterCondition: FilterCondition = FilterCondition.All,
|
|
68
|
+
): boolean {
|
|
69
|
+
return WorkspaceNotificationRuleUtil.isRuleMatching({
|
|
70
|
+
notificationRule: ruleWithFilters(filters, filterCondition),
|
|
71
|
+
values: valuesFor(values),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe("WorkspaceNotificationRuleUtil.isRuleMatching", () => {
|
|
76
|
+
describe("empty / degenerate filter sets", () => {
|
|
77
|
+
it("matches by default when there are no filters", () => {
|
|
78
|
+
expect(isMatching([], {})).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("skips a filter with no conditionType and matches (All) when it is the only filter", () => {
|
|
82
|
+
/*
|
|
83
|
+
* With no condition the filter is skipped; under All the loop then falls
|
|
84
|
+
* through to the trailing 'return true'.
|
|
85
|
+
*/
|
|
86
|
+
expect(
|
|
87
|
+
isMatching(
|
|
88
|
+
[
|
|
89
|
+
{
|
|
90
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
91
|
+
conditionType: undefined,
|
|
92
|
+
value: "anything",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "anything" },
|
|
96
|
+
),
|
|
97
|
+
).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("does not match (Any) when the only filter has no conditionType", () => {
|
|
101
|
+
// Skipped filter never sets isMatched true, so Any falls through to false.
|
|
102
|
+
expect(
|
|
103
|
+
isMatching(
|
|
104
|
+
[
|
|
105
|
+
{
|
|
106
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
107
|
+
conditionType: undefined,
|
|
108
|
+
value: "anything",
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "anything" },
|
|
112
|
+
FilterCondition.Any,
|
|
113
|
+
),
|
|
114
|
+
).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe("undefined value or filter value never matches", () => {
|
|
119
|
+
it("returns false when the event value is undefined", () => {
|
|
120
|
+
expect(
|
|
121
|
+
isMatching(
|
|
122
|
+
[
|
|
123
|
+
{
|
|
124
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
125
|
+
conditionType: ConditionType.EqualTo,
|
|
126
|
+
value: "prod-down",
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: undefined },
|
|
130
|
+
),
|
|
131
|
+
).toBe(false);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("returns false when the filter value is undefined", () => {
|
|
135
|
+
expect(
|
|
136
|
+
isMatching(
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
140
|
+
conditionType: ConditionType.EqualTo,
|
|
141
|
+
value: undefined,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
145
|
+
),
|
|
146
|
+
).toBe(false);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe("EqualTo", () => {
|
|
151
|
+
it("matches identical strings", () => {
|
|
152
|
+
expect(
|
|
153
|
+
isMatching(
|
|
154
|
+
[
|
|
155
|
+
{
|
|
156
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
157
|
+
conditionType: ConditionType.EqualTo,
|
|
158
|
+
value: "prod-down",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
162
|
+
),
|
|
163
|
+
).toBe(true);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("compares numerically when both sides are numeric strings", () => {
|
|
167
|
+
expect(
|
|
168
|
+
isMatching(
|
|
169
|
+
[
|
|
170
|
+
{
|
|
171
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
172
|
+
conditionType: ConditionType.EqualTo,
|
|
173
|
+
value: "1.0",
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "1" },
|
|
177
|
+
),
|
|
178
|
+
).toBe(true);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("does not match different strings", () => {
|
|
182
|
+
expect(
|
|
183
|
+
isMatching(
|
|
184
|
+
[
|
|
185
|
+
{
|
|
186
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
187
|
+
conditionType: ConditionType.EqualTo,
|
|
188
|
+
value: "prod-down",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "staging-down" },
|
|
192
|
+
),
|
|
193
|
+
).toBe(false);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe("NotEqualTo", () => {
|
|
198
|
+
it("matches when the strings differ", () => {
|
|
199
|
+
expect(
|
|
200
|
+
isMatching(
|
|
201
|
+
[
|
|
202
|
+
{
|
|
203
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
204
|
+
conditionType: ConditionType.NotEqualTo,
|
|
205
|
+
value: "prod-down",
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "staging-down" },
|
|
209
|
+
),
|
|
210
|
+
).toBe(true);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("does not match when the strings are equal", () => {
|
|
214
|
+
expect(
|
|
215
|
+
isMatching(
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
219
|
+
conditionType: ConditionType.NotEqualTo,
|
|
220
|
+
value: "prod-down",
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
224
|
+
),
|
|
225
|
+
).toBe(false);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("matches an array event value that is not fully contained in the filter set", () => {
|
|
229
|
+
expect(
|
|
230
|
+
isMatching(
|
|
231
|
+
[
|
|
232
|
+
{
|
|
233
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentLabels,
|
|
234
|
+
conditionType: ConditionType.NotEqualTo,
|
|
235
|
+
value: ["a", "b", "c"],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
{ [NotificationRuleConditionCheckOn.IncidentLabels]: ["a", "z"] },
|
|
239
|
+
),
|
|
240
|
+
).toBe(true);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
describe("numeric comparisons", () => {
|
|
245
|
+
it("GreaterThan matches when value is larger", () => {
|
|
246
|
+
expect(
|
|
247
|
+
isMatching(
|
|
248
|
+
[
|
|
249
|
+
{
|
|
250
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
251
|
+
conditionType: ConditionType.GreaterThan,
|
|
252
|
+
value: "5",
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "10" },
|
|
256
|
+
),
|
|
257
|
+
).toBe(true);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it("LessThan does not match when value is larger", () => {
|
|
261
|
+
expect(
|
|
262
|
+
isMatching(
|
|
263
|
+
[
|
|
264
|
+
{
|
|
265
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
266
|
+
conditionType: ConditionType.LessThan,
|
|
267
|
+
value: "5",
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "10" },
|
|
271
|
+
),
|
|
272
|
+
).toBe(false);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it("GreaterThanOrEqualTo matches on equality", () => {
|
|
276
|
+
expect(
|
|
277
|
+
isMatching(
|
|
278
|
+
[
|
|
279
|
+
{
|
|
280
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
281
|
+
conditionType: ConditionType.GreaterThanOrEqualTo,
|
|
282
|
+
value: "5",
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "5" },
|
|
286
|
+
),
|
|
287
|
+
).toBe(true);
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it("LessThanOrEqualTo matches on equality", () => {
|
|
291
|
+
expect(
|
|
292
|
+
isMatching(
|
|
293
|
+
[
|
|
294
|
+
{
|
|
295
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
296
|
+
conditionType: ConditionType.LessThanOrEqualTo,
|
|
297
|
+
value: "5",
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "5" },
|
|
301
|
+
),
|
|
302
|
+
).toBe(true);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
describe("string containment", () => {
|
|
307
|
+
it("Contains matches a substring", () => {
|
|
308
|
+
expect(
|
|
309
|
+
isMatching(
|
|
310
|
+
[
|
|
311
|
+
{
|
|
312
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
313
|
+
conditionType: ConditionType.Contains,
|
|
314
|
+
value: "down",
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
318
|
+
),
|
|
319
|
+
).toBe(true);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("ContainsAny matches when any filter value is present", () => {
|
|
323
|
+
expect(
|
|
324
|
+
isMatching(
|
|
325
|
+
[
|
|
326
|
+
{
|
|
327
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentLabels,
|
|
328
|
+
conditionType: ConditionType.ContainsAny,
|
|
329
|
+
value: ["urgent", "prod"],
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
{ [NotificationRuleConditionCheckOn.IncidentLabels]: ["prod"] },
|
|
333
|
+
),
|
|
334
|
+
).toBe(true);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it("NotContains matches when the substring is absent", () => {
|
|
338
|
+
expect(
|
|
339
|
+
isMatching(
|
|
340
|
+
[
|
|
341
|
+
{
|
|
342
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
343
|
+
conditionType: ConditionType.NotContains,
|
|
344
|
+
value: "staging",
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
348
|
+
),
|
|
349
|
+
).toBe(true);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it("NotContains does not match when the substring is present", () => {
|
|
353
|
+
expect(
|
|
354
|
+
isMatching(
|
|
355
|
+
[
|
|
356
|
+
{
|
|
357
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
358
|
+
conditionType: ConditionType.NotContains,
|
|
359
|
+
value: "down",
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
363
|
+
),
|
|
364
|
+
).toBe(false);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it("StartsWith matches a prefix", () => {
|
|
368
|
+
expect(
|
|
369
|
+
isMatching(
|
|
370
|
+
[
|
|
371
|
+
{
|
|
372
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
373
|
+
conditionType: ConditionType.StartsWith,
|
|
374
|
+
value: "prod",
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
378
|
+
),
|
|
379
|
+
).toBe(true);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it("EndsWith matches a suffix", () => {
|
|
383
|
+
expect(
|
|
384
|
+
isMatching(
|
|
385
|
+
[
|
|
386
|
+
{
|
|
387
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
388
|
+
conditionType: ConditionType.EndsWith,
|
|
389
|
+
value: "down",
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
393
|
+
),
|
|
394
|
+
).toBe(true);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it("ContainsAll matches only when every filter value is present in some event value", () => {
|
|
398
|
+
expect(
|
|
399
|
+
isMatching(
|
|
400
|
+
[
|
|
401
|
+
{
|
|
402
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentLabels,
|
|
403
|
+
conditionType: ConditionType.ContainsAll,
|
|
404
|
+
value: ["prod", "urgent"],
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
{
|
|
408
|
+
[NotificationRuleConditionCheckOn.IncidentLabels]: [
|
|
409
|
+
"prod",
|
|
410
|
+
"urgent",
|
|
411
|
+
"extra",
|
|
412
|
+
],
|
|
413
|
+
},
|
|
414
|
+
),
|
|
415
|
+
).toBe(true);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it("ContainsAll does not match when one filter value is missing", () => {
|
|
419
|
+
expect(
|
|
420
|
+
isMatching(
|
|
421
|
+
[
|
|
422
|
+
{
|
|
423
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentLabels,
|
|
424
|
+
conditionType: ConditionType.ContainsAll,
|
|
425
|
+
value: ["prod", "urgent"],
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
{ [NotificationRuleConditionCheckOn.IncidentLabels]: ["prod"] },
|
|
429
|
+
),
|
|
430
|
+
).toBe(false);
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
describe("emptiness and boolean conditions", () => {
|
|
435
|
+
it("IsEmpty matches an empty array", () => {
|
|
436
|
+
expect(
|
|
437
|
+
isMatching(
|
|
438
|
+
[
|
|
439
|
+
{
|
|
440
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentLabels,
|
|
441
|
+
conditionType: ConditionType.IsEmpty,
|
|
442
|
+
value: "unused",
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
{ [NotificationRuleConditionCheckOn.IncidentLabels]: [] },
|
|
446
|
+
),
|
|
447
|
+
).toBe(true);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
it("IsNotEmpty matches a non-empty string", () => {
|
|
451
|
+
expect(
|
|
452
|
+
isMatching(
|
|
453
|
+
[
|
|
454
|
+
{
|
|
455
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
456
|
+
conditionType: ConditionType.IsNotEmpty,
|
|
457
|
+
value: "unused",
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down" },
|
|
461
|
+
),
|
|
462
|
+
).toBe(true);
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it("True matches the literal string 'true'", () => {
|
|
466
|
+
expect(
|
|
467
|
+
isMatching(
|
|
468
|
+
[
|
|
469
|
+
{
|
|
470
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
471
|
+
conditionType: ConditionType.True,
|
|
472
|
+
value: "unused",
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "true" },
|
|
476
|
+
),
|
|
477
|
+
).toBe(true);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it("False matches the literal string 'false'", () => {
|
|
481
|
+
expect(
|
|
482
|
+
isMatching(
|
|
483
|
+
[
|
|
484
|
+
{
|
|
485
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
486
|
+
conditionType: ConditionType.False,
|
|
487
|
+
value: "unused",
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
{ [NotificationRuleConditionCheckOn.IncidentTitle]: "false" },
|
|
491
|
+
),
|
|
492
|
+
).toBe(true);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
describe("filter combining (All vs Any)", () => {
|
|
497
|
+
const twoFilters: Array<{
|
|
498
|
+
checkOn: NotificationRuleConditionCheckOn;
|
|
499
|
+
conditionType: ConditionType | undefined;
|
|
500
|
+
value: string | Array<string> | undefined;
|
|
501
|
+
}> = [
|
|
502
|
+
{
|
|
503
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentTitle,
|
|
504
|
+
conditionType: ConditionType.Contains,
|
|
505
|
+
value: "down",
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
checkOn: NotificationRuleConditionCheckOn.IncidentSeverity,
|
|
509
|
+
conditionType: ConditionType.EqualTo,
|
|
510
|
+
value: "critical",
|
|
511
|
+
},
|
|
512
|
+
];
|
|
513
|
+
|
|
514
|
+
it("All requires every filter to match", () => {
|
|
515
|
+
expect(
|
|
516
|
+
isMatching(
|
|
517
|
+
twoFilters,
|
|
518
|
+
{
|
|
519
|
+
[NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down",
|
|
520
|
+
[NotificationRuleConditionCheckOn.IncidentSeverity]: "critical",
|
|
521
|
+
},
|
|
522
|
+
FilterCondition.All,
|
|
523
|
+
),
|
|
524
|
+
).toBe(true);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it("All fails if any single filter does not match", () => {
|
|
528
|
+
expect(
|
|
529
|
+
isMatching(
|
|
530
|
+
twoFilters,
|
|
531
|
+
{
|
|
532
|
+
[NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down",
|
|
533
|
+
[NotificationRuleConditionCheckOn.IncidentSeverity]: "low",
|
|
534
|
+
},
|
|
535
|
+
FilterCondition.All,
|
|
536
|
+
),
|
|
537
|
+
).toBe(false);
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
it("Any matches if a single filter matches", () => {
|
|
541
|
+
expect(
|
|
542
|
+
isMatching(
|
|
543
|
+
twoFilters,
|
|
544
|
+
{
|
|
545
|
+
[NotificationRuleConditionCheckOn.IncidentTitle]: "prod-down",
|
|
546
|
+
[NotificationRuleConditionCheckOn.IncidentSeverity]: "low",
|
|
547
|
+
},
|
|
548
|
+
FilterCondition.Any,
|
|
549
|
+
),
|
|
550
|
+
).toBe(true);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
it("Any fails only when no filter matches", () => {
|
|
554
|
+
expect(
|
|
555
|
+
isMatching(
|
|
556
|
+
twoFilters,
|
|
557
|
+
{
|
|
558
|
+
[NotificationRuleConditionCheckOn.IncidentTitle]: "healthy",
|
|
559
|
+
[NotificationRuleConditionCheckOn.IncidentSeverity]: "low",
|
|
560
|
+
},
|
|
561
|
+
FilterCondition.Any,
|
|
562
|
+
),
|
|
563
|
+
).toBe(false);
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
});
|