@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
package/Server/API/ProbeAPI.ts
CHANGED
|
@@ -2,6 +2,9 @@ import UserMiddleware from "../Middleware/UserAuthorization";
|
|
|
2
2
|
import ProbeService, {
|
|
3
3
|
Service as ProbeServiceType,
|
|
4
4
|
} from "../Services/ProbeService";
|
|
5
|
+
import Query from "../Types/Database/Query";
|
|
6
|
+
import Select from "../Types/Database/Select";
|
|
7
|
+
import Sort from "../Types/Database/Sort";
|
|
5
8
|
import {
|
|
6
9
|
ExpressRequest,
|
|
7
10
|
ExpressResponse,
|
|
@@ -9,10 +12,48 @@ import {
|
|
|
9
12
|
} from "../Utils/Express";
|
|
10
13
|
import Response from "../Utils/Response";
|
|
11
14
|
import BaseAPI from "./BaseAPI";
|
|
12
|
-
import
|
|
15
|
+
import MultiSearch from "../../Types/BaseDatabase/MultiSearch";
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_LIMIT,
|
|
18
|
+
LIMIT_PER_PROJECT,
|
|
19
|
+
} from "../../Types/Database/LimitMax";
|
|
20
|
+
import Dictionary from "../../Types/Dictionary";
|
|
21
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
22
|
+
import BadRequestException from "../../Types/Exception/BadRequestException";
|
|
23
|
+
import { JSONObject, JSONValue } from "../../Types/JSON";
|
|
24
|
+
import JSONFunctions from "../../Types/JSONFunctions";
|
|
13
25
|
import PositiveNumber from "../../Types/PositiveNumber";
|
|
14
26
|
import Probe from "../../Models/DatabaseModels/Probe";
|
|
15
27
|
|
|
28
|
+
// What a caller that asks for no fields in particular gets back.
|
|
29
|
+
const DEFAULT_GLOBAL_PROBE_SELECT: Select<Probe> = {
|
|
30
|
+
name: true,
|
|
31
|
+
description: true,
|
|
32
|
+
lastAlive: true,
|
|
33
|
+
iconFileId: true,
|
|
34
|
+
connectionStatus: true,
|
|
35
|
+
// The monitor create form pre-selects the auto-enabled probes.
|
|
36
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Global probes are not project rows, so this endpoint has to read them as
|
|
41
|
+
* root - which means none of the usual per-column permission checks run.
|
|
42
|
+
* Every field a caller may select, filter or sort on is therefore listed
|
|
43
|
+
* here, and nothing else is reachable: `key` in particular is a probe's
|
|
44
|
+
* shared secret, and a root-privileged query on it would be an oracle for
|
|
45
|
+
* reading it back one character at a time.
|
|
46
|
+
*/
|
|
47
|
+
const GLOBAL_PROBE_FIELDS: Array<string> = [
|
|
48
|
+
...Object.keys(DEFAULT_GLOBAL_PROBE_SELECT),
|
|
49
|
+
"_id",
|
|
50
|
+
/*
|
|
51
|
+
* Readable, but not something a caller can steer: the query below pins it
|
|
52
|
+
* to true whatever the caller sent.
|
|
53
|
+
*/
|
|
54
|
+
"isGlobalProbe",
|
|
55
|
+
];
|
|
56
|
+
|
|
16
57
|
export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
|
|
17
58
|
public constructor() {
|
|
18
59
|
super(Probe, ProbeService);
|
|
@@ -22,31 +63,72 @@ export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
|
|
|
22
63
|
UserMiddleware.getUserMiddleware,
|
|
23
64
|
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
24
65
|
try {
|
|
66
|
+
const body: JSONObject = (req.body as JSONObject) || {};
|
|
67
|
+
|
|
68
|
+
const skip: PositiveNumber = new PositiveNumber(
|
|
69
|
+
ProbeAPI.getPaginationValue(req, "skip", 0),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const limit: PositiveNumber = new PositiveNumber(
|
|
73
|
+
ProbeAPI.getPaginationValue(req, "limit", DEFAULT_LIMIT),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (limit.toNumber() > LIMIT_PER_PROJECT) {
|
|
77
|
+
throw new BadRequestException(
|
|
78
|
+
"Limit should be less than " + LIMIT_PER_PROJECT,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (skip.toNumber() < 0) {
|
|
83
|
+
throw new BadRequestException(
|
|
84
|
+
"Skip should be greater than or equal to 0",
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (limit.toNumber() <= 0) {
|
|
89
|
+
throw new BadRequestException("Limit should be greater than 0");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const query: Query<Probe> = {
|
|
93
|
+
...ProbeAPI.getQuery(body["query"] as JSONObject),
|
|
94
|
+
/*
|
|
95
|
+
* Last, so a caller cannot widen the read past the global probes
|
|
96
|
+
* by sending isGlobalProbe themselves.
|
|
97
|
+
*/
|
|
98
|
+
isGlobalProbe: true,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const select: Select<Probe> = ProbeAPI.getSelect(
|
|
102
|
+
body["select"] as JSONObject,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const sort: Sort<Probe> = ProbeAPI.getSort(
|
|
106
|
+
body["sort"] as JSONObject,
|
|
107
|
+
);
|
|
108
|
+
|
|
25
109
|
const probes: Array<Probe> = await ProbeService.findBy({
|
|
26
|
-
query
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
description: true,
|
|
32
|
-
lastAlive: true,
|
|
33
|
-
iconFileId: true,
|
|
34
|
-
connectionStatus: true,
|
|
35
|
-
// The monitor create form pre-selects the auto-enabled probes.
|
|
36
|
-
shouldAutoEnableProbeOnNewMonitors: true,
|
|
110
|
+
query,
|
|
111
|
+
select,
|
|
112
|
+
sort,
|
|
113
|
+
props: {
|
|
114
|
+
isRoot: true,
|
|
37
115
|
},
|
|
116
|
+
skip,
|
|
117
|
+
limit,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const count: PositiveNumber = await ProbeService.countBy({
|
|
121
|
+
query,
|
|
38
122
|
props: {
|
|
39
123
|
isRoot: true,
|
|
40
124
|
},
|
|
41
|
-
skip: 0,
|
|
42
|
-
limit: LIMIT_MAX,
|
|
43
125
|
});
|
|
44
126
|
|
|
45
127
|
return Response.sendEntityArrayResponse(
|
|
46
128
|
req,
|
|
47
129
|
res,
|
|
48
130
|
probes,
|
|
49
|
-
|
|
131
|
+
count,
|
|
50
132
|
Probe,
|
|
51
133
|
);
|
|
52
134
|
} catch (err) {
|
|
@@ -55,4 +137,103 @@ export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
|
|
|
55
137
|
},
|
|
56
138
|
);
|
|
57
139
|
}
|
|
140
|
+
|
|
141
|
+
/*
|
|
142
|
+
* skip/limit arrive as query params from ModelAPI.getList and in the body
|
|
143
|
+
* from anything hand-rolled, so both are read - same precedence as
|
|
144
|
+
* BaseAPI.getList.
|
|
145
|
+
*/
|
|
146
|
+
private static getPaginationValue(
|
|
147
|
+
req: ExpressRequest,
|
|
148
|
+
key: "skip" | "limit",
|
|
149
|
+
defaultValue: number,
|
|
150
|
+
): number {
|
|
151
|
+
if (req.query && req.query[key]) {
|
|
152
|
+
return parseInt(req.query[key] as string, 10) || defaultValue;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (req.body && (req.body as JSONObject)[key] !== undefined) {
|
|
156
|
+
return (
|
|
157
|
+
parseInt((req.body as JSONObject)[key] as string, 10) || defaultValue
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return defaultValue;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private static getQuery(query: JSONObject | undefined): Query<Probe> {
|
|
165
|
+
const deserialized: JSONObject = JSONFunctions.deserialize(
|
|
166
|
+
query as JSONObject,
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
for (const key in deserialized) {
|
|
170
|
+
const value: JSONValue = deserialized[key] as JSONValue;
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
* MultiSearch is the free-text search operator. Its key is synthetic -
|
|
174
|
+
* the columns it reads are the ones it carries - so those are what get
|
|
175
|
+
* checked against the allow-list.
|
|
176
|
+
*/
|
|
177
|
+
if (value instanceof MultiSearch) {
|
|
178
|
+
for (const field of value.fields) {
|
|
179
|
+
if (!GLOBAL_PROBE_FIELDS.includes(field)) {
|
|
180
|
+
throw new BadDataException(
|
|
181
|
+
`Global probes cannot be searched on ${field}.`,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!GLOBAL_PROBE_FIELDS.includes(key)) {
|
|
190
|
+
throw new BadDataException(
|
|
191
|
+
`Global probes cannot be filtered on ${key}.`,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return deserialized as Query<Probe>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private static getSelect(select: JSONObject | undefined): Select<Probe> {
|
|
200
|
+
const requested: Dictionary<boolean> = {};
|
|
201
|
+
|
|
202
|
+
for (const key in select) {
|
|
203
|
+
if (!GLOBAL_PROBE_FIELDS.includes(key) || !select[key]) {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/*
|
|
208
|
+
* Coerced rather than copied: every selectable field here is a scalar,
|
|
209
|
+
* so a nested (relation) select on one of them is not something the
|
|
210
|
+
* caller gets to ask for.
|
|
211
|
+
*/
|
|
212
|
+
requested[key] = true;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/*
|
|
216
|
+
* A caller that asks for nothing gets what this endpoint returned before
|
|
217
|
+
* it honoured select at all.
|
|
218
|
+
*/
|
|
219
|
+
if (Object.keys(requested).length === 0) {
|
|
220
|
+
return { ...DEFAULT_GLOBAL_PROBE_SELECT };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return requested as Select<Probe>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
private static getSort(sort: JSONObject | undefined): Sort<Probe> {
|
|
227
|
+
const deserialized: JSONObject = JSONFunctions.deserialize(
|
|
228
|
+
sort as JSONObject,
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
for (const key in deserialized) {
|
|
232
|
+
if (!GLOBAL_PROBE_FIELDS.includes(key)) {
|
|
233
|
+
throw new BadDataException(`Global probes cannot be sorted on ${key}.`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return deserialized as Sort<Probe>;
|
|
238
|
+
}
|
|
58
239
|
}
|
package/Server/API/ProjectAPI.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
2
|
+
import MasterAdminAuthorization from "../Middleware/MasterAdminAuthorization";
|
|
2
3
|
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
3
4
|
import ProjectService, {
|
|
4
5
|
ProjectService as ProjectServiceType,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
NextFunction,
|
|
14
15
|
OneUptimeRequest,
|
|
15
16
|
} from "../Utils/Express";
|
|
17
|
+
import JSONWebToken from "../Utils/JsonWebToken";
|
|
16
18
|
import Response from "../Utils/Response";
|
|
17
19
|
import BaseAPI from "./BaseAPI";
|
|
18
20
|
import BillingService from "../Services/BillingService";
|
|
@@ -24,9 +26,10 @@ import Project from "../../Models/DatabaseModels/Project";
|
|
|
24
26
|
import Reseller from "../../Models/DatabaseModels/Reseller";
|
|
25
27
|
import TeamMember from "../../Models/DatabaseModels/TeamMember";
|
|
26
28
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
29
|
+
import OneUptimeDate from "../../Types/Date";
|
|
27
30
|
import Permission, { UserPermission } from "../../Types/Permission";
|
|
28
31
|
import ObjectID from "../../Types/ObjectID";
|
|
29
|
-
import { JSONObject } from "../../Types/JSON";
|
|
32
|
+
import { JSONObject, JSONValue } from "../../Types/JSON";
|
|
30
33
|
|
|
31
34
|
export default class ProjectAPI extends BaseAPI<Project, ProjectServiceType> {
|
|
32
35
|
public constructor() {
|
|
@@ -134,6 +137,81 @@ export default class ProjectAPI extends BaseAPI<Project, ProjectServiceType> {
|
|
|
134
137
|
},
|
|
135
138
|
);
|
|
136
139
|
|
|
140
|
+
/*
|
|
141
|
+
* Extends a project's trial. Master-admin only: this hands out free
|
|
142
|
+
* service and moves the customer's next invoice, so it is deliberately not
|
|
143
|
+
* reachable with project-level billing permissions - only OneUptime staff
|
|
144
|
+
* acting from the Admin Dashboard can call it.
|
|
145
|
+
*/
|
|
146
|
+
this.router.put(
|
|
147
|
+
`${new this.entityType().getCrudApiPath()?.toString()}/:id/extend-trial`,
|
|
148
|
+
MasterAdminAuthorization.isAuthorizedMasterAdminMiddleware,
|
|
149
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
150
|
+
try {
|
|
151
|
+
if (!IsBillingEnabled) {
|
|
152
|
+
throw new BadDataException(
|
|
153
|
+
"Billing is not enabled for this server",
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const projectId: ObjectID = new ObjectID(req.params["id"] as string);
|
|
158
|
+
|
|
159
|
+
const body: JSONObject = (req.body as JSONObject) || {};
|
|
160
|
+
const data: JSONObject = (body["data"] as JSONObject) || {};
|
|
161
|
+
const trialEndsAtValue: JSONValue = data["trialEndsAt"];
|
|
162
|
+
|
|
163
|
+
if (!trialEndsAtValue) {
|
|
164
|
+
throw new BadDataException(
|
|
165
|
+
"Trial end date is required to extend the trial",
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/*
|
|
170
|
+
* OneUptimeDate.fromString only parses strings and Dates - anything
|
|
171
|
+
* else comes back as its own error text, not a Date - so reject a
|
|
172
|
+
* non-string body value here rather than letting it through.
|
|
173
|
+
*/
|
|
174
|
+
if (typeof trialEndsAtValue !== "string") {
|
|
175
|
+
throw new BadDataException("Trial end date is not a valid date");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const trialEndsAt: Date = OneUptimeDate.fromString(trialEndsAtValue);
|
|
179
|
+
|
|
180
|
+
if (isNaN(trialEndsAt.getTime())) {
|
|
181
|
+
throw new BadDataException("Trial end date is not a valid date");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
* The master admin middleware verifies the token but does not put
|
|
186
|
+
* the decoded payload on the request, so read it again here - who
|
|
187
|
+
* granted the extension is the only audit trail this action has.
|
|
188
|
+
*/
|
|
189
|
+
let extendedByUserId: ObjectID | undefined = undefined;
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
const accessToken: string | undefined =
|
|
193
|
+
UserMiddleware.getAccessTokenFromExpressRequest(req);
|
|
194
|
+
|
|
195
|
+
if (accessToken) {
|
|
196
|
+
extendedByUserId = JSONWebToken.decode(accessToken).userId;
|
|
197
|
+
}
|
|
198
|
+
} catch {
|
|
199
|
+
// Only used for the log line - never block the extension on it.
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
await ProjectService.extendTrial({
|
|
203
|
+
projectId: projectId,
|
|
204
|
+
trialEndsAt: trialEndsAt,
|
|
205
|
+
extendedByUserId: extendedByUserId,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
return Response.sendEmptySuccessResponse(req, res);
|
|
209
|
+
} catch (err) {
|
|
210
|
+
next(err);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
);
|
|
214
|
+
|
|
137
215
|
/*
|
|
138
216
|
* This API lists all the projects where user is its team member.
|
|
139
217
|
* This API is usually used to show project selector dropdown in the UI
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import ScheduledMaintenance from "../../Models/DatabaseModels/ScheduledMaintenance";
|
|
2
2
|
import NotFoundException from "../../Types/Exception/NotFoundException";
|
|
3
3
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
4
|
+
import DatabaseCommonInteractionPropsUtil, {
|
|
5
|
+
PermissionType,
|
|
6
|
+
} from "../../Types/BaseDatabase/DatabaseCommonInteractionPropsUtil";
|
|
4
7
|
import ObjectID from "../../Types/ObjectID";
|
|
5
8
|
import ScheduledMaintenanceService, {
|
|
6
9
|
Service as ScheduledMaintenanceServiceType,
|
|
@@ -21,7 +24,7 @@ import ScheduledMaintenanceAIContextBuilder, {
|
|
|
21
24
|
ScheduledMaintenanceContextData,
|
|
22
25
|
} from "../Utils/AI/ScheduledMaintenanceAIContextBuilder";
|
|
23
26
|
import JSONFunctions from "../../Types/JSONFunctions";
|
|
24
|
-
import Permission from "../../Types/Permission";
|
|
27
|
+
import Permission, { UserPermission } from "../../Types/Permission";
|
|
25
28
|
|
|
26
29
|
export default class ScheduledMaintenanceAPI extends BaseAPI<
|
|
27
30
|
ScheduledMaintenance,
|
|
@@ -68,23 +71,35 @@ export default class ScheduledMaintenanceAPI extends BaseAPI<
|
|
|
68
71
|
const props: DatabaseCommonInteractionProps =
|
|
69
72
|
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
:
|
|
74
|
+
CommonAPI.assertTenantScoped(props);
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
* Read through getUserPermissions(Allow) rather than off
|
|
78
|
+
* userTenantAccessPermission directly. That dictionary is keyed by project
|
|
79
|
+
* id and its entries hold GRANTS AND DENIALS together, discriminated only
|
|
80
|
+
* by isBlockPermission, so the previous
|
|
81
|
+
* `userTenantAccessPermission["permissions"]` read was always undefined
|
|
82
|
+
* and denied every caller who was not a master admin. Mapping the array
|
|
83
|
+
* raw would swing the other way and count a team's explicit block
|
|
84
|
+
* entry for one of these permissions as a grant of it.
|
|
85
|
+
*/
|
|
86
|
+
const permissions: Array<Permission> =
|
|
87
|
+
DatabaseCommonInteractionPropsUtil.getUserPermissions(
|
|
88
|
+
props,
|
|
89
|
+
PermissionType.Allow,
|
|
90
|
+
).map((userPermission: UserPermission) => {
|
|
91
|
+
return userPermission.permission;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const hasPermission: boolean = permissions.some((p: Permission) => {
|
|
95
|
+
return (
|
|
96
|
+
p === Permission.ProjectOwner ||
|
|
97
|
+
p === Permission.ProjectAdmin ||
|
|
98
|
+
p === Permission.EditProjectScheduledMaintenance ||
|
|
99
|
+
p === Permission.CreateScheduledMaintenanceInternalNote ||
|
|
100
|
+
p === Permission.CreateScheduledMaintenancePublicNote
|
|
101
|
+
);
|
|
102
|
+
});
|
|
88
103
|
|
|
89
104
|
if (!hasPermission && !props.isMasterAdmin) {
|
|
90
105
|
throw new BadDataException(
|
|
@@ -85,6 +85,7 @@ import StatusPageOIDC from "../../Models/DatabaseModels/StatusPageOidc";
|
|
|
85
85
|
import StatusPageSubscriber from "../../Models/DatabaseModels/StatusPageSubscriber";
|
|
86
86
|
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
87
87
|
import StatusPageResourceUptimeUtil from "../../Utils/StatusPage/ResourceUptime";
|
|
88
|
+
import StatusPageGroupTreeUtil from "../../Utils/StatusPage/GroupTree";
|
|
88
89
|
import UptimePrecision from "../../Types/StatusPage/UptimePrecision";
|
|
89
90
|
import { Green } from "../../Types/BrandColors";
|
|
90
91
|
import UptimeUtil, { UptimeWindow } from "../../Utils/Uptime/UptimeUtil";
|
|
@@ -1225,6 +1226,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1225
1226
|
|
|
1226
1227
|
type StatusPageGroupUptime = {
|
|
1227
1228
|
statusPageGroupId: ObjectID | null;
|
|
1229
|
+
parentStatusPageGroupId: ObjectID | null;
|
|
1228
1230
|
uptimePercent: number | null;
|
|
1229
1231
|
statusPageResourceUptimes: Array<ResourceUptime>;
|
|
1230
1232
|
statusPageGroupName: string | null;
|
|
@@ -1244,6 +1246,8 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1244
1246
|
data && data.statusPageGroup
|
|
1245
1247
|
? data.statusPageGroup?.id
|
|
1246
1248
|
: null,
|
|
1249
|
+
parentStatusPageGroupId:
|
|
1250
|
+
data.statusPageGroup?.parentStatusPageGroupId || null,
|
|
1247
1251
|
uptimePercent: null,
|
|
1248
1252
|
statusPageResourceUptimes: [],
|
|
1249
1253
|
statusPageGroupName: data.statusPageGroup?.name || null,
|
|
@@ -1382,43 +1386,6 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1382
1386
|
}
|
|
1383
1387
|
}
|
|
1384
1388
|
|
|
1385
|
-
if (group?.showUptimePercent) {
|
|
1386
|
-
// calculate uptime percent for the group.
|
|
1387
|
-
const avgUptimePercent: number =
|
|
1388
|
-
UptimeUtil.calculateAvgUptimePercentage({
|
|
1389
|
-
uptimePercentages: groupUptime.statusPageResourceUptimes
|
|
1390
|
-
.filter((resource: ResourceUptime) => {
|
|
1391
|
-
return resource.uptimePercent !== null;
|
|
1392
|
-
})
|
|
1393
|
-
.map((resource: ResourceUptime) => {
|
|
1394
|
-
return resource.uptimePercent || 0;
|
|
1395
|
-
}),
|
|
1396
|
-
precision:
|
|
1397
|
-
group.uptimePercentPrecision ||
|
|
1398
|
-
UptimePrecision.ONE_DECIMAL,
|
|
1399
|
-
});
|
|
1400
|
-
|
|
1401
|
-
groupUptime.uptimePercent = avgUptimePercent;
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
if (group?.showCurrentStatus) {
|
|
1405
|
-
const currentStatuses: Array<MonitorStatus> =
|
|
1406
|
-
groupUptime.statusPageResourceUptimes
|
|
1407
|
-
.filter((resourceUptime: ResourceUptime) => {
|
|
1408
|
-
return resourceUptime.currentStatus !== null;
|
|
1409
|
-
})
|
|
1410
|
-
.map((resourceUptime: ResourceUptime) => {
|
|
1411
|
-
return resourceUptime.currentStatus!;
|
|
1412
|
-
});
|
|
1413
|
-
|
|
1414
|
-
const worstStatus: MonitorStatus | null =
|
|
1415
|
-
StatusPageResourceUptimeUtil.getWorstMonitorStatus({
|
|
1416
|
-
monitorStatuses: currentStatuses,
|
|
1417
|
-
});
|
|
1418
|
-
|
|
1419
|
-
groupUptime.currentStatus = worstStatus;
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1389
|
return groupUptime;
|
|
1423
1390
|
};
|
|
1424
1391
|
|
|
@@ -1430,6 +1397,75 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1430
1397
|
);
|
|
1431
1398
|
}
|
|
1432
1399
|
|
|
1400
|
+
/*
|
|
1401
|
+
* Groups nest, so a group's own uptime % / current status has to
|
|
1402
|
+
* cover every resource in its subtree, not just the resources
|
|
1403
|
+
* attached directly to it. statusPageResourceUptimes stays the
|
|
1404
|
+
* group's own resources - the nesting is reported through
|
|
1405
|
+
* parentStatusPageGroupId so callers can rebuild the tree.
|
|
1406
|
+
*/
|
|
1407
|
+
const resourceUptimesByGroupId: Dictionary<Array<ResourceUptime>> =
|
|
1408
|
+
{};
|
|
1409
|
+
|
|
1410
|
+
for (const groupUptime of groupUptimes) {
|
|
1411
|
+
resourceUptimesByGroupId[
|
|
1412
|
+
groupUptime.statusPageGroupId?.toString() || ""
|
|
1413
|
+
] = groupUptime.statusPageResourceUptimes;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
for (const group of statusPageGroups) {
|
|
1417
|
+
const groupUptime: StatusPageGroupUptime | undefined =
|
|
1418
|
+
groupUptimes.find((item: StatusPageGroupUptime) => {
|
|
1419
|
+
return (
|
|
1420
|
+
item.statusPageGroupId?.toString() === group.id?.toString()
|
|
1421
|
+
);
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
if (!groupUptime) {
|
|
1425
|
+
continue;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
const resourceUptimesInSubtree: Array<ResourceUptime> =
|
|
1429
|
+
StatusPageGroupTreeUtil.getGroupAndDescendants({
|
|
1430
|
+
statusPageGroup: group,
|
|
1431
|
+
statusPageGroups: statusPageGroups,
|
|
1432
|
+
}).flatMap((groupInSubtree: StatusPageGroup) => {
|
|
1433
|
+
return (
|
|
1434
|
+
resourceUptimesByGroupId[
|
|
1435
|
+
groupInSubtree.id?.toString() || ""
|
|
1436
|
+
] || []
|
|
1437
|
+
);
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
if (group.showUptimePercent) {
|
|
1441
|
+
groupUptime.uptimePercent =
|
|
1442
|
+
UptimeUtil.calculateAvgUptimePercentage({
|
|
1443
|
+
uptimePercentages: resourceUptimesInSubtree
|
|
1444
|
+
.filter((resource: ResourceUptime) => {
|
|
1445
|
+
return resource.uptimePercent !== null;
|
|
1446
|
+
})
|
|
1447
|
+
.map((resource: ResourceUptime) => {
|
|
1448
|
+
return resource.uptimePercent || 0;
|
|
1449
|
+
}),
|
|
1450
|
+
precision:
|
|
1451
|
+
group.uptimePercentPrecision || UptimePrecision.ONE_DECIMAL,
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (group.showCurrentStatus) {
|
|
1456
|
+
groupUptime.currentStatus =
|
|
1457
|
+
StatusPageResourceUptimeUtil.getWorstMonitorStatus({
|
|
1458
|
+
monitorStatuses: resourceUptimesInSubtree
|
|
1459
|
+
.filter((resourceUptime: ResourceUptime) => {
|
|
1460
|
+
return resourceUptime.currentStatus !== null;
|
|
1461
|
+
})
|
|
1462
|
+
.map((resourceUptime: ResourceUptime) => {
|
|
1463
|
+
return resourceUptime.currentStatus!;
|
|
1464
|
+
}),
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1433
1469
|
return Response.sendJsonObjectResponse(req, res, {
|
|
1434
1470
|
statusPageResourceUptimes: [
|
|
1435
1471
|
...getUptimeByStatusPageGroup({ statusPageGroup: null })
|
|
@@ -4920,6 +4956,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
4920
4956
|
columnAxisLabel: true,
|
|
4921
4957
|
rowAxisValues: true,
|
|
4922
4958
|
columnAxisValues: true,
|
|
4959
|
+
parentStatusPageGroupId: true,
|
|
4923
4960
|
},
|
|
4924
4961
|
sort: {
|
|
4925
4962
|
order: SortOrder.Ascending,
|
|
@@ -29,12 +29,42 @@ export default class WorkspaceNotificationRuleAPI extends BaseAPI<
|
|
|
29
29
|
const databaseProps: DatabaseCommonInteractionProps =
|
|
30
30
|
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
31
31
|
|
|
32
|
+
/*
|
|
33
|
+
* getUserMiddleware lets unauthenticated requests through as
|
|
34
|
+
* "public", and testRule loads the rule as root and then posts a
|
|
35
|
+
* test message into that project's Slack / Teams channels — it can
|
|
36
|
+
* even create channels. Require an authenticated member of the
|
|
37
|
+
* project, and of the rule's own project at that: testRule takes
|
|
38
|
+
* the project from the rule it loaded, so the caller-supplied
|
|
39
|
+
* tenant alone proves nothing about the rule id in the path.
|
|
40
|
+
*/
|
|
41
|
+
const projectId: ObjectID =
|
|
42
|
+
CommonAPI.assertAuthenticatedProjectMember(databaseProps);
|
|
43
|
+
|
|
44
|
+
const ruleId: ObjectID = new ObjectID(
|
|
45
|
+
req.params["workspaceNotifcationRuleId"] as string,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const rule: WorkspaceNotificationRule | null =
|
|
49
|
+
await this.service.findOneById({
|
|
50
|
+
id: ruleId,
|
|
51
|
+
select: {
|
|
52
|
+
projectId: true,
|
|
53
|
+
},
|
|
54
|
+
props: {
|
|
55
|
+
isRoot: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
CommonAPI.assertResourceBelongsToProject({
|
|
60
|
+
resourceProjectId: rule?.projectId,
|
|
61
|
+
projectId: projectId,
|
|
62
|
+
});
|
|
63
|
+
|
|
32
64
|
await this.service.testRule({
|
|
33
|
-
ruleId:
|
|
34
|
-
req.params["workspaceNotifcationRuleId"] as string,
|
|
35
|
-
),
|
|
65
|
+
ruleId: ruleId,
|
|
36
66
|
props: databaseProps,
|
|
37
|
-
projectId:
|
|
67
|
+
projectId: projectId,
|
|
38
68
|
testByUserId: databaseProps.userId!,
|
|
39
69
|
});
|
|
40
70
|
|
package/Server/Infrastructure/Postgres/SchemaMigrations/1785241000000-AddColumnsToTableView.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddColumnsToTableView1785241000000 implements MigrationInterface {
|
|
4
|
+
public name: string = "AddColumnsToTableView1785241000000";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "TableView" ADD "columns" jsonb`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "TableView" DROP COLUMN "columns"`);
|
|
12
|
+
}
|
|
13
|
+
}
|