@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
|
@@ -315,3 +315,167 @@ describe("CommonAPI.assertAuthenticatedProjectMember", () => {
|
|
|
315
315
|
});
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
|
+
|
|
319
|
+
/*
|
|
320
|
+
* Tests for CommonAPI.assertResourceBelongsToProject — the companion guard
|
|
321
|
+
* for custom routes whose path carries a resource id.
|
|
322
|
+
* assertAuthenticatedProjectMember only proves the caller belongs to the
|
|
323
|
+
* project it claimed in the `tenantid` header; without this second check a
|
|
324
|
+
* member of project A could hand the route project B's resource id and have
|
|
325
|
+
* it acted on as root.
|
|
326
|
+
*/
|
|
327
|
+
describe("CommonAPI.assertResourceBelongsToProject", () => {
|
|
328
|
+
test("does not throw when the resource belongs to the authorized project", () => {
|
|
329
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
330
|
+
|
|
331
|
+
expect(() => {
|
|
332
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
333
|
+
resourceProjectId: projectId,
|
|
334
|
+
projectId: projectId,
|
|
335
|
+
});
|
|
336
|
+
}).not.toThrow();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
test("compares by string value, not by ObjectID instance", () => {
|
|
340
|
+
const projectIdString: string = ObjectID.generate().toString();
|
|
341
|
+
|
|
342
|
+
expect(() => {
|
|
343
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
344
|
+
resourceProjectId: new ObjectID(projectIdString),
|
|
345
|
+
projectId: new ObjectID(projectIdString),
|
|
346
|
+
});
|
|
347
|
+
}).not.toThrow();
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
test("throws NotAuthorizedException when the resource belongs to another project", () => {
|
|
351
|
+
const thrown: unknown = captureThrown(() => {
|
|
352
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
353
|
+
resourceProjectId: ObjectID.generate(),
|
|
354
|
+
projectId: ObjectID.generate(),
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
expect(thrown).toBeInstanceOf(NotAuthorizedException);
|
|
359
|
+
expect((thrown as Exception).message).toBe(
|
|
360
|
+
"You are not authorized to access this project's data.",
|
|
361
|
+
);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
/*
|
|
365
|
+
* A row that was not found reaches the guard as undefined. It must be
|
|
366
|
+
* rejected exactly like a cross-project row, so the endpoint cannot be
|
|
367
|
+
* used to tell "id exists in another project" apart from "id does not
|
|
368
|
+
* exist".
|
|
369
|
+
*/
|
|
370
|
+
test("throws NotAuthorizedException when the resource was not found", () => {
|
|
371
|
+
const thrown: unknown = captureThrown(() => {
|
|
372
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
373
|
+
resourceProjectId: undefined,
|
|
374
|
+
projectId: ObjectID.generate(),
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
expect(thrown).toBeInstanceOf(NotAuthorizedException);
|
|
379
|
+
expect((thrown as Exception).message).toBe(
|
|
380
|
+
"You are not authorized to access this project's data.",
|
|
381
|
+
);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test("throws NotAuthorizedException when the resource carries a null projectId", () => {
|
|
385
|
+
expect(() => {
|
|
386
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
387
|
+
resourceProjectId: null,
|
|
388
|
+
projectId: ObjectID.generate(),
|
|
389
|
+
});
|
|
390
|
+
}).toThrow(NotAuthorizedException);
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
/*
|
|
395
|
+
* Tests for CommonAPI.assertTenantScoped — the lighter guard for custom
|
|
396
|
+
* endpoints whose path carries only a resource id, so the project can only
|
|
397
|
+
* come from the `tenantid` header. Without it the request still reaches the
|
|
398
|
+
* handler, just with no tenant permissions, and the eventual tenant-scoped
|
|
399
|
+
* read fails as "You do not have permissions to read <model>" — a message
|
|
400
|
+
* that sends project owners hunting for a role they already hold. The guard
|
|
401
|
+
* exists to surface the real cause (a missing header) instead.
|
|
402
|
+
*/
|
|
403
|
+
describe("CommonAPI.assertTenantScoped", () => {
|
|
404
|
+
test("throws BadDataException naming the tenantid header when tenantId is missing", () => {
|
|
405
|
+
const props: DatabaseCommonInteractionProps = buildProps({
|
|
406
|
+
tenantId: undefined,
|
|
407
|
+
userId: ObjectID.generate(),
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
const thrown: unknown = captureThrown(() => {
|
|
411
|
+
CommonAPI.assertTenantScoped(props);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
expect(thrown).toBeInstanceOf(BadDataException);
|
|
415
|
+
expect((thrown as Exception).message).toContain("Project ID is required");
|
|
416
|
+
expect((thrown as Exception).message).toContain("tenantid");
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
test("the message points at the header rather than at permissions", () => {
|
|
420
|
+
const thrown: unknown = captureThrown(() => {
|
|
421
|
+
CommonAPI.assertTenantScoped({});
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
/*
|
|
425
|
+
* The whole point of the guard: whatever it says must not look like the
|
|
426
|
+
* permissions error it replaces.
|
|
427
|
+
*/
|
|
428
|
+
expect((thrown as Exception).message).toContain("tenantid");
|
|
429
|
+
expect((thrown as Exception).message).not.toContain("permission");
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
test("returns the tenant id when the request is project scoped", () => {
|
|
433
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
434
|
+
const props: DatabaseCommonInteractionProps = buildProps({
|
|
435
|
+
tenantId: projectId,
|
|
436
|
+
userId: ObjectID.generate(),
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
expect(CommonAPI.assertTenantScoped(props)).toBe(projectId);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
/*
|
|
443
|
+
* API-key callers are authenticated by ProjectMiddleware, which sets
|
|
444
|
+
* userType/tenantId and the tenant permission map but never userId. This
|
|
445
|
+
* guard must not lock them out — that is what separates it from
|
|
446
|
+
* assertAuthenticatedProjectMember.
|
|
447
|
+
*/
|
|
448
|
+
test("accepts an API-key caller that has a tenant but no userId", () => {
|
|
449
|
+
const projectId: ObjectID = ObjectID.generate();
|
|
450
|
+
const permissions: Dictionary<UserTenantAccessPermission> = {};
|
|
451
|
+
permissions[projectId.toString()] = buildTenantPermission(projectId);
|
|
452
|
+
|
|
453
|
+
const props: DatabaseCommonInteractionProps = buildProps({
|
|
454
|
+
tenantId: projectId,
|
|
455
|
+
userId: undefined,
|
|
456
|
+
userTenantAccessPermission: permissions,
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
expect(() => {
|
|
460
|
+
CommonAPI.assertTenantScoped(props);
|
|
461
|
+
}).not.toThrow();
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
test("does not require membership — that stays with the tenant-scoped read", () => {
|
|
465
|
+
/*
|
|
466
|
+
* assertTenantScoped is a diagnostic for a missing header, not an
|
|
467
|
+
* authorization check. A caller who sends a tenant id for a project they
|
|
468
|
+
* are not a member of passes here and is rejected by the read itself, so
|
|
469
|
+
* adding this guard cannot loosen or tighten access.
|
|
470
|
+
*/
|
|
471
|
+
const props: DatabaseCommonInteractionProps = buildProps({
|
|
472
|
+
tenantId: ObjectID.generate(),
|
|
473
|
+
userId: undefined,
|
|
474
|
+
userTenantAccessPermission: undefined,
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
expect(() => {
|
|
478
|
+
CommonAPI.assertTenantScoped(props);
|
|
479
|
+
}).not.toThrow();
|
|
480
|
+
});
|
|
481
|
+
});
|
|
@@ -8,9 +8,14 @@ import {
|
|
|
8
8
|
import Response from "../../../Server/Utils/Response";
|
|
9
9
|
import { mockRouter } from "./Helpers";
|
|
10
10
|
import { describe, expect, it } from "@jest/globals";
|
|
11
|
-
import
|
|
11
|
+
import MultiSearch from "../../../Types/BaseDatabase/MultiSearch";
|
|
12
|
+
import { DEFAULT_LIMIT } from "../../../Types/Database/LimitMax";
|
|
13
|
+
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
14
|
+
import BadRequestException from "../../../Types/Exception/BadRequestException";
|
|
15
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
12
16
|
import PositiveNumber from "../../../Types/PositiveNumber";
|
|
13
17
|
import Probe from "../../../Models/DatabaseModels/Probe";
|
|
18
|
+
import SortOrder from "../../../Types/BaseDatabase/SortOrder";
|
|
14
19
|
|
|
15
20
|
jest.mock("../../../Server/Utils/Express", () => {
|
|
16
21
|
return {
|
|
@@ -37,77 +42,441 @@ jest.mock("../../../Server/Utils/Response", () => {
|
|
|
37
42
|
|
|
38
43
|
jest.mock("../../../Server/Services/ProbeService");
|
|
39
44
|
|
|
45
|
+
type RequestOverrides = {
|
|
46
|
+
body?: JSONObject | undefined;
|
|
47
|
+
query?: JSONObject | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
40
50
|
describe("ProbeAPI", () => {
|
|
41
|
-
let mockRequest: ExpressRequest;
|
|
42
51
|
let mockResponse: ExpressResponse;
|
|
43
52
|
let nextFunction: NextFunction;
|
|
44
53
|
|
|
54
|
+
const buildRequest: (overrides?: RequestOverrides) => ExpressRequest = (
|
|
55
|
+
overrides: RequestOverrides = {},
|
|
56
|
+
): ExpressRequest => {
|
|
57
|
+
return {
|
|
58
|
+
body: overrides.body || {},
|
|
59
|
+
query: overrides.query || {},
|
|
60
|
+
} as unknown as ExpressRequest;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type CallGlobalProbesFunction = (
|
|
64
|
+
overrides?: RequestOverrides,
|
|
65
|
+
) => Promise<ExpressRequest>;
|
|
66
|
+
|
|
67
|
+
const callGlobalProbes: CallGlobalProbesFunction = async (
|
|
68
|
+
overrides: RequestOverrides = {},
|
|
69
|
+
): Promise<ExpressRequest> => {
|
|
70
|
+
const request: ExpressRequest = buildRequest(overrides);
|
|
71
|
+
|
|
72
|
+
await mockRouter
|
|
73
|
+
.match("post", "/probe/global-probes")
|
|
74
|
+
.handlerFunction(request, mockResponse, nextFunction);
|
|
75
|
+
|
|
76
|
+
return request;
|
|
77
|
+
};
|
|
78
|
+
|
|
45
79
|
beforeEach(() => {
|
|
46
80
|
new ProbeAPI();
|
|
47
|
-
mockRequest = {} as ExpressRequest;
|
|
48
81
|
mockResponse = {
|
|
49
82
|
send: jest.fn(),
|
|
50
83
|
json: jest.fn(),
|
|
51
84
|
status: jest.fn().mockReturnThis(),
|
|
52
85
|
} as unknown as ExpressResponse;
|
|
53
86
|
nextFunction = jest.fn();
|
|
87
|
+
|
|
88
|
+
ProbeService.findBy = jest.fn().mockResolvedValue([]);
|
|
89
|
+
ProbeService.countBy = jest.fn().mockResolvedValue(new PositiveNumber(0));
|
|
54
90
|
});
|
|
55
91
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
);
|
|
92
|
+
afterEach(() => {
|
|
93
|
+
jest.restoreAllMocks();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("defaults", () => {
|
|
97
|
+
it("should read the full select list when the caller asks for no fields", async () => {
|
|
98
|
+
const mockProbes: Array<Probe> = [{ id: "probe" } as unknown as Probe];
|
|
99
|
+
ProbeService.findBy = jest.fn().mockResolvedValue(mockProbes);
|
|
100
|
+
|
|
101
|
+
const request: ExpressRequest = await callGlobalProbes();
|
|
102
|
+
|
|
103
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith({
|
|
104
|
+
query: {
|
|
105
|
+
isGlobalProbe: true,
|
|
106
|
+
},
|
|
107
|
+
select: {
|
|
108
|
+
name: true,
|
|
109
|
+
description: true,
|
|
110
|
+
lastAlive: true,
|
|
111
|
+
iconFileId: true,
|
|
112
|
+
connectionStatus: true,
|
|
113
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
114
|
+
},
|
|
115
|
+
sort: {},
|
|
116
|
+
props: {
|
|
117
|
+
isRoot: true,
|
|
118
|
+
},
|
|
119
|
+
skip: new PositiveNumber(0),
|
|
120
|
+
limit: new PositiveNumber(DEFAULT_LIMIT),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const response: jest.SpyInstance = jest.spyOn(
|
|
124
|
+
Response,
|
|
125
|
+
"sendEntityArrayResponse",
|
|
126
|
+
);
|
|
127
|
+
expect(response).toHaveBeenCalledWith(
|
|
128
|
+
request,
|
|
129
|
+
mockResponse,
|
|
130
|
+
mockProbes,
|
|
131
|
+
expect.any(PositiveNumber),
|
|
132
|
+
Probe,
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
describe("query", () => {
|
|
138
|
+
it("should pass the caller's query through alongside isGlobalProbe", async () => {
|
|
139
|
+
await callGlobalProbes({
|
|
140
|
+
body: {
|
|
141
|
+
query: {
|
|
142
|
+
name: "probe-1",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
148
|
+
expect.objectContaining({
|
|
149
|
+
query: {
|
|
150
|
+
name: "probe-1",
|
|
151
|
+
isGlobalProbe: true,
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("should not let the caller widen the read past global probes", async () => {
|
|
158
|
+
await callGlobalProbes({
|
|
159
|
+
body: {
|
|
160
|
+
query: {
|
|
161
|
+
isGlobalProbe: false,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
167
|
+
expect.objectContaining({
|
|
168
|
+
query: {
|
|
169
|
+
isGlobalProbe: true,
|
|
170
|
+
},
|
|
171
|
+
}),
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("should reject a filter on a field outside the select list", async () => {
|
|
176
|
+
await callGlobalProbes({
|
|
177
|
+
body: {
|
|
178
|
+
query: {
|
|
179
|
+
key: "secret-probe-key",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(ProbeService.findBy).not.toHaveBeenCalled();
|
|
185
|
+
expect(nextFunction).toHaveBeenCalledWith(expect.any(BadDataException));
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("should allow a multi field search over allowed fields", async () => {
|
|
189
|
+
const search: MultiSearch = new MultiSearch({
|
|
190
|
+
fields: ["name", "description"],
|
|
191
|
+
value: "probe",
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
await callGlobalProbes({
|
|
195
|
+
body: {
|
|
196
|
+
query: {
|
|
197
|
+
_multiFieldSearch: search.toJSON(),
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
expect(nextFunction).not.toHaveBeenCalled();
|
|
203
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
204
|
+
expect.objectContaining({
|
|
205
|
+
query: expect.objectContaining({
|
|
206
|
+
_multiFieldSearch: expect.any(MultiSearch),
|
|
207
|
+
isGlobalProbe: true,
|
|
208
|
+
}),
|
|
209
|
+
}),
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("should reject a multi field search that reaches a field outside the select list", async () => {
|
|
214
|
+
const search: MultiSearch = new MultiSearch({
|
|
215
|
+
fields: ["name", "key"],
|
|
216
|
+
value: "a",
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
await callGlobalProbes({
|
|
220
|
+
body: {
|
|
221
|
+
query: {
|
|
222
|
+
_multiFieldSearch: search.toJSON(),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
expect(ProbeService.findBy).not.toHaveBeenCalled();
|
|
228
|
+
expect(nextFunction).toHaveBeenCalledWith(expect.any(BadDataException));
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe("select", () => {
|
|
233
|
+
it("should honour the caller's select", async () => {
|
|
234
|
+
await callGlobalProbes({
|
|
235
|
+
body: {
|
|
236
|
+
select: {
|
|
237
|
+
name: true,
|
|
238
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
244
|
+
expect.objectContaining({
|
|
245
|
+
select: {
|
|
246
|
+
name: true,
|
|
247
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
248
|
+
},
|
|
249
|
+
}),
|
|
250
|
+
);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("should drop selected fields outside the select list", async () => {
|
|
254
|
+
await callGlobalProbes({
|
|
255
|
+
body: {
|
|
256
|
+
select: {
|
|
257
|
+
name: true,
|
|
258
|
+
key: true,
|
|
259
|
+
slug: true,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
265
|
+
expect.objectContaining({
|
|
266
|
+
select: {
|
|
267
|
+
name: true,
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("should not let an allowed field be turned into a relation select", async () => {
|
|
274
|
+
await callGlobalProbes({
|
|
275
|
+
body: {
|
|
276
|
+
select: {
|
|
277
|
+
name: {
|
|
278
|
+
key: true,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
285
|
+
expect.objectContaining({
|
|
286
|
+
select: {
|
|
287
|
+
name: true,
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("should fall back to the default select when nothing selectable is asked for", async () => {
|
|
294
|
+
await callGlobalProbes({
|
|
295
|
+
body: {
|
|
296
|
+
select: {
|
|
297
|
+
key: true,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
303
|
+
expect.objectContaining({
|
|
304
|
+
select: {
|
|
305
|
+
name: true,
|
|
306
|
+
description: true,
|
|
307
|
+
lastAlive: true,
|
|
308
|
+
iconFileId: true,
|
|
309
|
+
connectionStatus: true,
|
|
310
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
311
|
+
},
|
|
312
|
+
}),
|
|
313
|
+
);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
describe("sort", () => {
|
|
318
|
+
it("should honour the caller's sort", async () => {
|
|
319
|
+
await callGlobalProbes({
|
|
320
|
+
body: {
|
|
321
|
+
sort: {
|
|
322
|
+
name: SortOrder.Descending,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
328
|
+
expect.objectContaining({
|
|
329
|
+
sort: {
|
|
330
|
+
name: SortOrder.Descending,
|
|
331
|
+
},
|
|
332
|
+
}),
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it("should reject a sort on a field outside the select list", async () => {
|
|
337
|
+
await callGlobalProbes({
|
|
338
|
+
body: {
|
|
339
|
+
sort: {
|
|
340
|
+
key: SortOrder.Ascending,
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
expect(ProbeService.findBy).not.toHaveBeenCalled();
|
|
346
|
+
expect(nextFunction).toHaveBeenCalledWith(expect.any(BadDataException));
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
describe("pagination", () => {
|
|
351
|
+
it("should read skip and limit from the query string", async () => {
|
|
352
|
+
await callGlobalProbes({
|
|
353
|
+
query: {
|
|
354
|
+
skip: "20",
|
|
355
|
+
limit: "5",
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
360
|
+
expect.objectContaining({
|
|
361
|
+
skip: new PositiveNumber(20),
|
|
362
|
+
limit: new PositiveNumber(5),
|
|
363
|
+
}),
|
|
364
|
+
);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
it("should read skip and limit from the body", async () => {
|
|
368
|
+
await callGlobalProbes({
|
|
369
|
+
body: {
|
|
370
|
+
skip: 10,
|
|
371
|
+
limit: 25,
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
376
|
+
expect.objectContaining({
|
|
377
|
+
skip: new PositiveNumber(10),
|
|
378
|
+
limit: new PositiveNumber(25),
|
|
379
|
+
}),
|
|
380
|
+
);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it("should prefer the query string over the body", async () => {
|
|
384
|
+
await callGlobalProbes({
|
|
385
|
+
body: {
|
|
386
|
+
skip: 10,
|
|
387
|
+
limit: 25,
|
|
388
|
+
},
|
|
389
|
+
query: {
|
|
390
|
+
skip: "30",
|
|
391
|
+
limit: "40",
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
expect(ProbeService.findBy).toHaveBeenCalledWith(
|
|
396
|
+
expect.objectContaining({
|
|
397
|
+
skip: new PositiveNumber(30),
|
|
398
|
+
limit: new PositiveNumber(40),
|
|
399
|
+
}),
|
|
400
|
+
);
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
it("should reject a limit above the per project maximum", async () => {
|
|
404
|
+
await callGlobalProbes({
|
|
405
|
+
body: {
|
|
406
|
+
limit: 10001,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
expect(ProbeService.findBy).not.toHaveBeenCalled();
|
|
411
|
+
expect(nextFunction).toHaveBeenCalledWith(
|
|
412
|
+
expect.any(BadRequestException),
|
|
413
|
+
);
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
describe("count", () => {
|
|
418
|
+
it("should return the real count rather than the size of the page", async () => {
|
|
419
|
+
const mockProbes: Array<Probe> = [{ id: "probe" } as unknown as Probe];
|
|
420
|
+
ProbeService.findBy = jest.fn().mockResolvedValue(mockProbes);
|
|
421
|
+
ProbeService.countBy = jest
|
|
422
|
+
.fn()
|
|
423
|
+
.mockResolvedValue(new PositiveNumber(137));
|
|
424
|
+
|
|
425
|
+
const request: ExpressRequest = await callGlobalProbes({
|
|
426
|
+
query: {
|
|
427
|
+
limit: "1",
|
|
428
|
+
},
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
expect(ProbeService.countBy).toHaveBeenCalledWith({
|
|
432
|
+
query: {
|
|
433
|
+
isGlobalProbe: true,
|
|
434
|
+
},
|
|
435
|
+
props: {
|
|
436
|
+
isRoot: true,
|
|
437
|
+
},
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
const response: jest.SpyInstance = jest.spyOn(
|
|
441
|
+
Response,
|
|
442
|
+
"sendEntityArrayResponse",
|
|
443
|
+
);
|
|
444
|
+
expect(response).toHaveBeenCalledWith(
|
|
445
|
+
request,
|
|
446
|
+
mockResponse,
|
|
447
|
+
mockProbes,
|
|
448
|
+
new PositiveNumber(137),
|
|
449
|
+
Probe,
|
|
450
|
+
);
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it("should count against the same filtered query the list used", async () => {
|
|
454
|
+
await callGlobalProbes({
|
|
455
|
+
body: {
|
|
456
|
+
query: {
|
|
457
|
+
name: "probe-1",
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
expect(ProbeService.countBy).toHaveBeenCalledWith({
|
|
463
|
+
query: {
|
|
464
|
+
name: "probe-1",
|
|
465
|
+
isGlobalProbe: true,
|
|
466
|
+
},
|
|
467
|
+
props: {
|
|
468
|
+
isRoot: true,
|
|
469
|
+
},
|
|
470
|
+
});
|
|
471
|
+
});
|
|
99
472
|
});
|
|
100
473
|
|
|
101
474
|
it("should call next with an error if findBy throws", async () => {
|
|
102
475
|
const testError: Error = new Error("Test error");
|
|
103
476
|
ProbeService.findBy = jest.fn().mockRejectedValue(testError);
|
|
104
|
-
await mockRouter
|
|
105
|
-
.match("post", "/probe/global-probes")
|
|
106
|
-
.handlerFunction(mockRequest, mockResponse, nextFunction);
|
|
107
|
-
expect(nextFunction).toHaveBeenCalledWith(testError);
|
|
108
|
-
});
|
|
109
477
|
|
|
110
|
-
|
|
111
|
-
|
|
478
|
+
await callGlobalProbes();
|
|
479
|
+
|
|
480
|
+
expect(nextFunction).toHaveBeenCalledWith(testError);
|
|
112
481
|
});
|
|
113
482
|
});
|