@oneuptime/common 12.0.33 → 12.0.34
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/RumSession.ts +117 -1
- package/Models/AnalyticsModels/RumSessionChunk.ts +13 -0
- package/Models/DatabaseModels/AlertCustomField.ts +77 -3
- package/Models/DatabaseModels/ApiKeyPermission.ts +3 -27
- package/Models/DatabaseModels/IncidentCustomField.ts +77 -3
- package/Models/DatabaseModels/InventoryItemCustomField.ts +77 -3
- package/Models/DatabaseModels/MonitorCustomField.ts +77 -3
- package/Models/DatabaseModels/OnCallDutyPolicyCustomField.ts +77 -3
- package/Models/DatabaseModels/RumApplication.ts +6 -6
- package/Models/DatabaseModels/ScheduledMaintenanceCustomField.ts +77 -3
- package/Models/DatabaseModels/StatusPageCustomField.ts +77 -3
- package/Models/DatabaseModels/TeamCustomField.ts +77 -3
- package/Models/DatabaseModels/TeamMember.ts +0 -9
- package/Models/DatabaseModels/TeamMemberCustomField.ts +77 -3
- package/Models/DatabaseModels/TeamPermission.ts +3 -24
- package/Models/DatabaseModels/TelemetryIngestionKey.ts +260 -0
- package/Models/DatabaseModels/UserTelegram.ts +0 -4
- package/Scripts/benchmark-fanin-capacity.js +181 -0
- package/Server/API/TelemetryAPI.ts +1284 -164
- package/Server/API/UserNotificationSettingAPI.ts +55 -0
- package/Server/API/UserTelegramAPI.ts +48 -4
- package/Server/EnvironmentConfig.ts +35 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791300000000-AddTelemetryIngestionKeyType.ts +91 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791400000000-SessionReplayRecordEverySessionByDefault.ts +67 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791500000000-WidenCustomFieldDropdownOptions.ts +139 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791600000000-AddCustomFieldValueMapping.ts +121 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Infrastructure/QueueWorker.ts +20 -14
- package/Server/Infrastructure/Semaphore.ts +2 -0
- package/Server/Middleware/TelemetryIngest.ts +453 -7
- package/Server/Services/AccessTokenService.ts +1 -0
- package/Server/Services/AlertCustomFieldService.ts +98 -0
- package/Server/Services/AlertService.ts +37 -0
- package/Server/Services/ApiKeyPermissionService.ts +461 -29
- package/Server/Services/CustomFieldMappingService.ts +879 -0
- package/Server/Services/GlobalConfigService.ts +194 -0
- package/Server/Services/IncidentCustomFieldService.ts +98 -0
- package/Server/Services/IncidentService.ts +35 -0
- package/Server/Services/MetricService.ts +194 -0
- package/Server/Services/MonitorService.ts +32 -0
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +78 -25
- package/Server/Services/ProjectService.ts +22 -0
- package/Server/Services/RoutineEmailSettingsService.ts +73 -0
- package/Server/Services/RumSessionReplayViewService.ts +104 -24
- package/Server/Services/ScheduledMaintenanceCustomFieldService.ts +98 -0
- package/Server/Services/ScheduledMaintenanceService.ts +32 -0
- package/Server/Services/TeamMemberService.ts +78 -0
- package/Server/Services/TeamPermissionService.ts +235 -3
- package/Server/Services/TelemetryIngestionKeyService.ts +722 -19
- package/Server/Services/UserNotificationSettingService.ts +34 -6
- package/Server/Services/UserTelegramService.ts +326 -5
- package/Server/Types/Database/QueryHelper.ts +2 -0
- package/Server/Utils/APIKey/AccessPermission.ts +5 -2
- package/Server/Utils/CustomField/CustomFieldDefinitionMappingHooks.ts +54 -0
- package/Server/Utils/CustomField/CustomFieldMappingRegistry.ts +415 -0
- package/Server/Utils/CustomField/CustomFieldMappingValidator.ts +335 -0
- package/Server/Utils/DataSource/EgressGuard.ts +177 -8
- package/Server/Utils/EmailRollup/EmailRollupConstants.ts +38 -5
- package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +57 -4
- package/Server/Utils/FrontendEnvironment.ts +40 -0
- package/Server/Utils/LogRedaction.ts +20 -0
- package/Server/Utils/Logger.ts +11 -0
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +338 -77
- package/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.ts +30 -4
- package/Server/Utils/Monitor/MonitorAlert.ts +29 -6
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +110 -15
- package/Server/Utils/Monitor/MonitorIncident.ts +22 -6
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +29 -0
- package/Server/Utils/Monitor/SeriesContextEnricher.ts +304 -0
- package/Server/Utils/SSRFProtection.ts +217 -10
- package/Server/Utils/SessionReplay/SessionReplayGateCache.ts +239 -138
- package/Server/Utils/SessionReplay/SessionReplayHealthCounters.ts +305 -0
- package/Server/Utils/SessionReplay/SessionReplayReadService.ts +1430 -289
- package/Server/Utils/StartServer.ts +2 -17
- package/Server/Utils/TelegramVerificationToken.ts +185 -0
- package/Server/Utils/Telemetry/PinServiceName.ts +197 -0
- package/Server/Utils/Telemetry/TelemetryFanInWriter.ts +38 -16
- package/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.ts +92 -0
- package/Server/Utils/Telemetry/TelemetryIngestionKeyRateLimiter.ts +217 -0
- package/Server/Utils/VM/VMAPI.ts +1 -0
- package/Server/Utils/VM/VMRunner.ts +975 -95
- package/Tests/App/AdminDashboard/AdminHeaderSmallScreens.test.tsx +202 -0
- package/Tests/App/Dashboard/DashboardHeaderSmallScreens.test.tsx +404 -0
- package/Tests/App/Dashboard/DiscoveryScanWizardValidation.test.tsx +468 -0
- package/Tests/App/Dashboard/NotificationEmailPreferences.test.tsx +399 -0
- package/Tests/App/StatusPage/StatusPageLastUpdated.test.tsx +263 -0
- package/Tests/App/StatusPage/StatusPageOverviewLiveAndSearch.test.tsx +753 -0
- package/Tests/App/StatusPage/StatusPageResourceSearchBox.test.tsx +224 -0
- package/Tests/Models/AnalyticsModels/RumSessionReplayColumns.test.ts +262 -0
- package/Tests/Models/CustomFieldMappingColumns.test.ts +166 -0
- package/Tests/Models/DatabaseModels/SessionReplayModels.test.ts +20 -6
- package/Tests/ResponsiveVisibility.test.ts +115 -0
- package/Tests/ResponsiveVisibility.ts +183 -0
- package/Tests/Server/API/SessionReplayAPI.test.ts +1940 -216
- package/Tests/Server/API/UserNotificationSettingAPI.test.ts +186 -0
- package/Tests/Server/API/UserTelegramAPISecurity.test.ts +231 -0
- package/Tests/Server/EnvironmentConfigFrontendSecurity.test.ts +234 -0
- package/Tests/Server/Infrastructure/Postgres/CustomFieldValueMappingMigration.test.ts +202 -0
- package/Tests/Server/Infrastructure/Postgres/InventoryItemArchiveMigration.test.ts +41 -0
- package/Tests/Server/Infrastructure/Postgres/SessionReplayRecordEverySessionByDefaultMigration.test.ts +169 -0
- package/Tests/Server/Infrastructure/QueueWorkerTimeout.test.ts +210 -0
- package/Tests/Server/Infrastructure/TelemetryExporterDeploymentConfig.test.ts +130 -0
- package/Tests/Server/Middleware/ProjectAuthorizationApiKeyMiddleware.test.ts +4 -1
- package/Tests/Server/Middleware/TelemetryIngestBrowserKey.test.ts +1163 -0
- package/Tests/Server/Middleware/TelemetryIngestTokenLog.test.ts +5 -3
- package/Tests/Server/Services/AddTelemetryIngestionKeyTypeMigration.test.ts +555 -0
- package/Tests/Server/Services/ApiKeyPermissionSecurity.test.ts +678 -0
- package/Tests/Server/Services/ApiKeyPermissionService.test.ts +276 -28
- package/Tests/Server/Services/CustomFieldDropdownOptionsColumnWidth.test.ts +431 -0
- package/Tests/Server/Services/CustomFieldMappingService.test.ts +850 -0
- package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +32 -0
- package/Tests/Server/Services/GlobalConfigService.test.ts +414 -1
- package/Tests/Server/Services/MetricRawEntityKeyPrune.test.ts +592 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +226 -1
- package/Tests/Server/Services/RoutineEmailSettingsPostgres.test.ts +329 -0
- package/Tests/Server/Services/RumSessionReplayViewService.test.ts +267 -0
- package/Tests/Server/Services/TeamMemberAutoAcceptInvitation.test.ts +9 -0
- package/Tests/Server/Services/TeamMemberInviteRegistrationToken.test.ts +9 -0
- package/Tests/Server/Services/TeamPrivilegeEscalation.test.ts +834 -0
- package/Tests/Server/Services/TelemetryIngestionKeyPolicyResolution.test.ts +814 -0
- package/Tests/Server/Services/TelemetryIngestionKeyValidation.test.ts +998 -0
- package/Tests/Server/Services/UserNotificationSettingRollupRouting.test.ts +141 -0
- package/Tests/Server/Services/UserNotificationSettingWorkspaceChannels.test.ts +18 -10
- package/Tests/Server/Services/UserTelegramVerificationSecurity.test.ts +688 -0
- package/Tests/Server/Utils/AI/SRE/Insights/FixRouting.test.ts +497 -0
- package/Tests/Server/Utils/AI/Toolbox/Serializer.test.ts +383 -0
- package/Tests/Server/Utils/APIKey/AccessPermission.test.ts +7 -3
- package/Tests/Server/Utils/AnalyticsDatabase/ClusterConfig.test.ts +315 -0
- package/Tests/Server/Utils/CustomField/CustomFieldMappingValidator.test.ts +437 -0
- package/Tests/Server/Utils/DataSource/EgressGuard.test.ts +300 -11
- package/Tests/Server/Utils/EmailRollup/EmailRollupBurstWindow.test.ts +83 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerBehaviour.test.ts +1 -1
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerPreferences.test.ts +362 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupTestHarness.ts +77 -1
- package/Tests/Server/Utils/FrontendEnvironment.test.ts +190 -0
- package/Tests/Server/Utils/LogRedaction.test.ts +26 -0
- package/Tests/Server/Utils/LoggerCredentialLeak.test.ts +23 -9
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteriaAggregation.test.ts +584 -0
- package/Tests/Server/Utils/Monitor/Criteria/IncomingRequestHeaderCriteria.test.ts +236 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +437 -0
- package/Tests/Server/Utils/Monitor/MonitorTemplateUtilSeriesContext.test.ts +176 -0
- package/Tests/Server/Utils/Monitor/SeriesContextEnricher.test.ts +356 -0
- package/Tests/Server/Utils/SSRFProtectionCloudServiceAddresses.test.ts +595 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayGateCachePolicy.test.ts +198 -1
- package/Tests/Server/Utils/SessionReplay/SessionReplayHealthCounters.test.ts +453 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayReadServiceQueries.test.ts +1378 -0
- package/Tests/Server/Utils/SessionReplayOriginAllowListRefactor.test.ts +420 -0
- package/Tests/Server/Utils/TelegramVerificationToken.test.ts +253 -0
- package/Tests/Server/Utils/Telemetry/PinServiceName.test.ts +666 -0
- package/Tests/Server/Utils/Telemetry/TelemetryFanInWriterCapacity.test.ts +458 -0
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.test.ts +424 -0
- package/Tests/Server/Utils/Telemetry/TelemetryIngestionKeyRateLimiter.test.ts +528 -0
- package/Tests/Server/Utils/TelemetryExporterEnvironment.test.ts +56 -0
- package/Tests/Server/Utils/VM/VMRunnerHostBridgeLatency.test.ts +74 -0
- package/Tests/Server/Utils/VM/VMRunnerPrivateNetworkWiring.test.ts +100 -7
- package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +1176 -6
- package/Tests/Types/CustomField/CustomFieldMappingCatalog.test.ts +220 -0
- package/Tests/Types/CustomField/CustomFieldValueMapping.test.ts +348 -0
- package/Tests/Types/JSONFunctions.test.ts +260 -0
- package/Tests/Types/Monitor/CephAlertTemplates.test.ts +422 -53
- package/Tests/Types/Monitor/DockerAlertTemplates.test.ts +495 -15
- package/Tests/Types/Monitor/DockerSwarmAlertTemplates.test.ts +191 -45
- package/Tests/Types/Monitor/HostAlertTemplates.test.ts +370 -42
- package/Tests/Types/Monitor/IotAlertTemplates.test.ts +375 -20
- package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +636 -42
- package/Tests/Types/Monitor/KubernetesMetricCatalog.test.ts +189 -0
- package/Tests/Types/Monitor/KubernetesTemplateGroupByKeys.test.ts +95 -14
- package/Tests/Types/Monitor/PodmanAlertTemplates.test.ts +190 -21
- package/Tests/Types/Monitor/ProxmoxAlertTemplates.test.ts +352 -22
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationAlertDebuggability.test.ts +363 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +93 -18
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.test.ts +259 -0
- package/Tests/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.test.ts +476 -0
- package/Tests/Types/Monitor/RumAlertTemplates.test.ts +136 -0
- package/Tests/Types/Monitor/SeriesContext/SeriesDebugHints.test.ts +661 -0
- package/Tests/Types/Monitor/SeriesContext/SeriesLabelDisplay.test.ts +507 -0
- package/Tests/Types/Monitor/ServiceAlertTemplates.test.ts +270 -0
- package/Tests/Types/Monitor/TemplateGroupByKeys.test.ts +38 -10
- package/Tests/Types/Monitor/Utils/RecommendationCriteriaAssertions.ts +102 -0
- package/Tests/Types/NotificationSetting/RoutineEmailEvents.test.ts +47 -0
- package/Tests/Types/Rum/SessionReplayApiContracts.test.ts +608 -0
- package/Tests/Types/Rum/SessionReplayCustomEvents.test.ts +434 -0
- package/Tests/Types/WebsiteRequest.test.ts +285 -3
- package/Tests/UI/Components/Charts/ChartBucketIdentity.test.ts +16 -3
- package/Tests/UI/Components/Charts/ChartTrailingBucketGap.test.ts +691 -0
- package/Tests/UI/Components/ComponentsModal.test.tsx +12 -4
- package/Tests/UI/Components/ComponentsModalUsability.test.tsx +518 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetailMapping.test.tsx +324 -0
- package/Tests/UI/Components/CustomFields/MapFromCustomFieldInput.test.tsx +176 -0
- package/Tests/UI/Components/Graphs/DayUptimeGraph.test.tsx +484 -0
- package/Tests/UI/Components/HeaderRightRail.test.tsx +157 -0
- package/Tests/UI/Components/IconDropdownItem.test.tsx +102 -0
- package/Tests/UI/Components/JSONTablePrototypePollution.test.tsx +117 -0
- package/Tests/UI/Components/KeyboardShortcutsModal.test.tsx +214 -0
- package/Tests/UI/Components/ModelTable/ModelTableWrapContent.test.tsx +561 -0
- package/Tests/UI/Components/MonitorGraphs/UptimeBarDayModal.test.tsx +302 -0
- package/Tests/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.test.ts +28 -12
- package/Tests/UI/Components/ShortcutDialogGuard.test.tsx +74 -0
- package/Tests/UI/Components/StatusPage/ResourceGroupSectionAutoExpand.test.tsx +248 -0
- package/Tests/UI/Components/TableCellWrapping.test.tsx +625 -0
- package/Tests/UI/Components/TableLoadingStates.test.tsx +205 -0
- package/Tests/UI/Components/Workflow/NodePlacement.test.ts +148 -0
- package/Tests/UI/Components/Workflow/Workflow.test.tsx +981 -0
- package/Tests/UI/ConfigBrowserTelemetry.test.ts +70 -0
- package/Tests/UI/Rum/ChunkLoader.test.ts +1036 -2
- package/Tests/UI/Rum/FidelityNotices.test.ts +187 -0
- package/Tests/UI/Rum/InactivityMap.test.ts +341 -0
- package/Tests/UI/Rum/PrivacySummaryCard.test.tsx +259 -0
- package/Tests/UI/Rum/RecordingHealthCard.test.tsx +855 -0
- package/Tests/UI/Rum/RecordingHealthStrip.test.tsx +594 -0
- package/Tests/UI/Rum/ReplayCard.test.tsx +451 -0
- package/Tests/UI/Rum/ReplayCorrelationPanel.test.tsx +536 -0
- package/Tests/UI/Rum/ReplayEngine.test.ts +2503 -0
- package/Tests/UI/Rum/ReplayEngineTypes.test.ts +171 -0
- package/Tests/UI/Rum/ReplayHeader.test.tsx +711 -0
- package/Tests/UI/Rum/ReplayLink.test.tsx +119 -0
- package/Tests/UI/Rum/ReplayPinControl.test.tsx +408 -0
- package/Tests/UI/Rum/ReplayPlaybackIntent.test.ts +152 -0
- package/Tests/UI/Rum/ReplayRail.test.tsx +1296 -0
- package/Tests/UI/Rum/ReplayRailDetail.test.tsx +900 -0
- package/Tests/UI/Rum/ReplayScrubber.test.tsx +763 -147
- package/Tests/UI/Rum/ReplaySignalTypes.test.ts +189 -0
- package/Tests/UI/Rum/ReplaySignals.test.ts +1579 -0
- package/Tests/UI/Rum/ReplayStage.test.tsx +396 -473
- package/Tests/UI/Rum/ReplayStageOverlays.test.tsx +918 -0
- package/Tests/UI/Rum/ReplayTimeline.test.tsx +696 -0
- package/Tests/UI/Rum/SessionReplayEmptyState.test.tsx +499 -0
- package/Tests/UI/Rum/SessionReplaySearchBar.test.tsx +346 -0
- package/Tests/UI/Rum/SessionReplaySetupGuide.test.tsx +545 -0
- package/Tests/UI/Rum/SessionReplayTable.test.tsx +991 -0
- package/Tests/UI/Rum/TargetedCapturePanel.test.tsx +254 -0
- package/Tests/UI/Telemetry/BrowserExporterIsolation.test.ts +71 -0
- package/Tests/UI/Utils/GlobalKeyboardShortcut.test.ts +344 -0
- package/Tests/Utils/API.test.ts +308 -0
- package/Tests/Utils/HTTPResponseBodyReader.test.ts +323 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveryScanStatus.test.ts +117 -0
- package/Tests/Utils/Rum/ChunkMath.test.ts +83 -0
- package/Tests/Utils/Rum/SessionReplayHealthDiagnosis.test.ts +993 -0
- package/Tests/Utils/Rum/SessionReplayStringMap.test.ts +245 -0
- package/Tests/Utils/StatusPage/ResourceSearch.test.ts +631 -0
- package/Tests/Utils/Telemetry/OriginAllowList.test.ts +633 -0
- package/Tests/Utils/Uptime/DayUptimeGraphUtil.test.ts +461 -0
- package/Tests/Utils/ValueFormatter.test.ts +148 -0
- package/Types/CustomField/CustomFieldMappingCatalog.ts +161 -0
- package/Types/CustomField/CustomFieldMappingSourceResource.ts +19 -0
- package/Types/CustomField/CustomFieldValueMapping.ts +288 -0
- package/Types/Icon/IconProp.ts +1 -0
- package/Types/JSONFunctions.ts +189 -43
- package/Types/Monitor/CephAlertTemplates.ts +157 -195
- package/Types/Monitor/DockerAlertTemplates.ts +338 -128
- package/Types/Monitor/DockerSwarmAlertTemplates.ts +95 -112
- package/Types/Monitor/HostAlertTemplates.ts +302 -130
- package/Types/Monitor/IotAlertTemplates.ts +112 -104
- package/Types/Monitor/KubernetesAlertTemplates.ts +415 -224
- package/Types/Monitor/KubernetesMetricCatalog.ts +23 -19
- package/Types/Monitor/PodmanAlertTemplates.ts +116 -163
- package/Types/Monitor/ProxmoxAlertTemplates.ts +217 -99
- package/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.ts +98 -6
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +44 -7
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.ts +383 -0
- package/Types/Monitor/RumAlertTemplates.ts +46 -7
- package/Types/Monitor/SeriesContext/SeriesDebugHints.ts +596 -0
- package/Types/Monitor/SeriesContext/SeriesLabelDisplay.ts +554 -0
- package/Types/Monitor/ServiceAlertTemplates.ts +98 -11
- package/Types/Monitor/UptimeHistoryLabels.ts +56 -0
- package/Types/NotificationSetting/RoutineEmailEvents.ts +30 -0
- package/Types/Rum/SessionReplay.ts +209 -0
- package/Types/Rum/SessionReplayApi.ts +722 -0
- package/Types/Rum/SessionReplayCaptureTrigger.ts +21 -12
- package/Types/Rum/SessionReplayConsentMode.ts +11 -7
- package/Types/Rum/SessionReplayCustomEvents.ts +549 -0
- package/Types/Rum/SessionReplayHealth.ts +238 -0
- package/Types/Telemetry/TelemetryIngestSurface.ts +95 -0
- package/Types/Telemetry/TelemetryIngestionKeyPolicy.ts +75 -0
- package/Types/Telemetry/TelemetryIngestionKeyType.ts +29 -0
- package/Types/WebsiteRequest.ts +85 -3
- package/UI/Components/Charts/Area/AreaChart.tsx +13 -2
- package/UI/Components/Charts/Bar/BarChart.tsx +6 -2
- package/UI/Components/Charts/Line/LineChart.tsx +13 -2
- package/UI/Components/Charts/Types/XAxis/XAxis.ts +29 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +22 -3
- package/UI/Components/Charts/Utils/TimeAnnotation.ts +76 -9
- package/UI/Components/Charts/Utils/XAxis.ts +217 -0
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +143 -25
- package/UI/Components/CustomFields/MapFromCustomFieldInput.tsx +216 -0
- package/UI/Components/Graphs/DayUptimeGraph.tsx +173 -8
- package/UI/Components/Graphs/UptimeBarTooltip.tsx +22 -278
- package/UI/Components/Graphs/UptimeDaySummary.tsx +327 -0
- package/UI/Components/Header/Header.tsx +25 -9
- package/UI/Components/Header/IconDropdown/IconDropdownItem.tsx +10 -1
- package/UI/Components/Header/IconDropdown/IconDropdownMenu.tsx +6 -1
- package/UI/Components/Header/ProjectPicker/ProjectPicker.tsx +6 -1
- package/UI/Components/HeaderAlert/NotificationBell/NotificationBellDropdown.tsx +6 -1
- package/UI/Components/Icon/Icon.tsx +11 -0
- package/UI/Components/JSONTable/JSONTable.tsx +2 -2
- package/UI/Components/KeyboardShortcut/KeyboardShortcutsModal.tsx +125 -0
- package/UI/Components/KeyboardShortcut/Screenshots/README.md +19 -0
- package/UI/Components/KeyboardShortcut/Screenshots/keyboard-shortcuts-command-palette.png +0 -0
- package/UI/Components/KeyboardShortcut/Screenshots/keyboard-shortcuts-dialog-dark.png +0 -0
- package/UI/Components/KeyboardShortcut/Screenshots/keyboard-shortcuts-dialog.png +0 -0
- package/UI/Components/KeyboardShortcut/Screenshots/keyboard-shortcuts-help-menu.png +0 -0
- package/UI/Components/KeyboardShortcut/Screenshots/keyboard-shortcuts-narrow.png +0 -0
- package/UI/Components/ModelTable/Column.ts +15 -0
- package/UI/Components/Monitor/SeriesDebugCommandsViewer.tsx +64 -0
- package/UI/Components/Monitor/SeriesLabelsViewer.tsx +93 -0
- package/UI/Components/MonitorGraphs/Uptime.tsx +14 -2
- package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +63 -10
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +44 -0
- package/UI/Components/StatusPage/ResourceGroupSection.tsx +40 -0
- package/UI/Components/Table/CellClassName.ts +81 -0
- package/UI/Components/Table/TableRow.tsx +20 -14
- package/UI/Components/Table/TableSkeletonRows.tsx +9 -9
- package/UI/Components/Table/Types/Column.ts +36 -0
- package/UI/Components/Tooltip/Tooltip.tsx +11 -1
- package/UI/Components/Workflow/ComponentsModal.tsx +60 -39
- package/UI/Components/Workflow/NodePlacement.ts +57 -0
- package/UI/Components/Workflow/Workflow.tsx +47 -18
- package/UI/Config.ts +15 -33
- package/UI/Utils/GlobalKeyboardShortcut.ts +208 -0
- package/UI/Utils/Telemetry/BrowserTelemetryConfig.ts +28 -0
- package/UI/Utils/Telemetry/Telemetry.ts +10 -8
- package/Utils/API.ts +129 -3
- package/Utils/HTTPResponseBodyReader.ts +221 -0
- package/Utils/NetworkDiscovery/DiscoveryScanStatus.ts +77 -0
- package/Utils/Rum/ChunkMath.ts +106 -0
- package/Utils/Rum/SessionReplayHealth.ts +732 -0
- package/Utils/Rum/SessionReplayStringMap.ts +226 -0
- package/Utils/Schema/ModelSchema.ts +1 -0
- package/Utils/StatusPage/ResourceSearch.ts +290 -0
- package/Utils/Telemetry/OriginAllowList.ts +355 -0
- package/Utils/Uptime/DayUptimeGraphUtil.ts +205 -0
- package/Utils/ValueFormatter.ts +35 -1
- package/build/dist/Models/AnalyticsModels/RumSession.js +102 -19
- package/build/dist/Models/AnalyticsModels/RumSession.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/RumSessionChunk.js +11 -9
- package/build/dist/Models/AnalyticsModels/RumSessionChunk.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/AlertCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ApiKeyPermission.js +3 -27
- package/build/dist/Models/DatabaseModels/ApiKeyPermission.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/IncidentCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/InventoryItemCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/InventoryItemCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/MonitorCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RumApplication.js +6 -6
- package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/StatusPageCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/TeamCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamMember.js +0 -9
- package/build/dist/Models/DatabaseModels/TeamMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamMemberCustomField.js +79 -3
- package/build/dist/Models/DatabaseModels/TeamMemberCustomField.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TeamPermission.js +3 -24
- package/build/dist/Models/DatabaseModels/TeamPermission.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryIngestionKey.js +267 -0
- package/build/dist/Models/DatabaseModels/TelemetryIngestionKey.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserTelegram.js +0 -4
- package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +769 -109
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/API/UserNotificationSettingAPI.js +35 -0
- package/build/dist/Server/API/UserNotificationSettingAPI.js.map +1 -0
- package/build/dist/Server/API/UserTelegramAPI.js +28 -6
- package/build/dist/Server/API/UserTelegramAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +29 -2
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791300000000-AddTelemetryIngestionKeyType.js +60 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791300000000-AddTelemetryIngestionKeyType.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791400000000-SessionReplayRecordEverySessionByDefault.js +53 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791400000000-SessionReplayRecordEverySessionByDefault.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791500000000-WidenCustomFieldDropdownOptions.js +82 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791500000000-WidenCustomFieldDropdownOptions.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791600000000-AddCustomFieldValueMapping.js +46 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791600000000-AddCustomFieldValueMapping.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/QueueWorker.js +19 -7
- package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
- package/build/dist/Server/Infrastructure/Semaphore.js +1 -0
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +315 -8
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AccessTokenService.js +1 -0
- package/build/dist/Server/Services/AccessTokenService.js.map +1 -1
- package/build/dist/Server/Services/AlertCustomFieldService.js +93 -0
- package/build/dist/Server/Services/AlertCustomFieldService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +34 -0
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/ApiKeyPermissionService.js +331 -28
- package/build/dist/Server/Services/ApiKeyPermissionService.js.map +1 -1
- package/build/dist/Server/Services/CustomFieldMappingService.js +614 -0
- package/build/dist/Server/Services/CustomFieldMappingService.js.map +1 -0
- package/build/dist/Server/Services/GlobalConfigService.js +133 -0
- package/build/dist/Server/Services/GlobalConfigService.js.map +1 -1
- package/build/dist/Server/Services/IncidentCustomFieldService.js +93 -0
- package/build/dist/Server/Services/IncidentCustomFieldService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +32 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +163 -0
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +29 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +79 -27
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +22 -0
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/RoutineEmailSettingsService.js +69 -0
- package/build/dist/Server/Services/RoutineEmailSettingsService.js.map +1 -0
- package/build/dist/Server/Services/RumSessionReplayViewService.js +86 -24
- package/build/dist/Server/Services/RumSessionReplayViewService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceCustomFieldService.js +93 -0
- package/build/dist/Server/Services/ScheduledMaintenanceCustomFieldService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +29 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +62 -2
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/TeamPermissionService.js +166 -3
- package/build/dist/Server/Services/TeamPermissionService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryIngestionKeyService.js +562 -18
- package/build/dist/Server/Services/TelemetryIngestionKeyService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +26 -6
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserTelegramService.js +257 -4
- package/build/dist/Server/Services/UserTelegramService.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Utils/APIKey/AccessPermission.js +2 -2
- package/build/dist/Server/Utils/APIKey/AccessPermission.js.map +1 -1
- package/build/dist/Server/Utils/CustomField/CustomFieldDefinitionMappingHooks.js +27 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldDefinitionMappingHooks.js.map +1 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldMappingRegistry.js +226 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldMappingRegistry.js.map +1 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldMappingValidator.js +189 -0
- package/build/dist/Server/Utils/CustomField/CustomFieldMappingValidator.js.map +1 -0
- package/build/dist/Server/Utils/DataSource/EgressGuard.js +121 -7
- package/build/dist/Server/Utils/DataSource/EgressGuard.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupConstants.js +38 -5
- package/build/dist/Server/Utils/EmailRollup/EmailRollupConstants.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +44 -2
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -1
- package/build/dist/Server/Utils/FrontendEnvironment.js +33 -0
- package/build/dist/Server/Utils/FrontendEnvironment.js.map +1 -0
- package/build/dist/Server/Utils/LogRedaction.js +20 -0
- package/build/dist/Server/Utils/LogRedaction.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +10 -0
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +287 -68
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.js +20 -4
- package/build/dist/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +29 -6
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +88 -13
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +22 -6
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +22 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesContextEnricher.js +237 -0
- package/build/dist/Server/Utils/Monitor/SeriesContextEnricher.js.map +1 -0
- package/build/dist/Server/Utils/SSRFProtection.js +136 -9
- package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCache.js +174 -89
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCache.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayHealthCounters.js +223 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayHealthCounters.js.map +1 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js +945 -164
- package/build/dist/Server/Utils/SessionReplay/SessionReplayReadService.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +3 -14
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/TelegramVerificationToken.js +129 -0
- package/build/dist/Server/Utils/TelegramVerificationToken.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/PinServiceName.js +163 -0
- package/build/dist/Server/Utils/Telemetry/PinServiceName.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryFanInWriter.js +28 -15
- package/build/dist/Server/Utils/Telemetry/TelemetryFanInWriter.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js +64 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyRateLimiter.js +171 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyRateLimiter.js.map +1 -0
- package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +780 -69
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js +60 -0
- package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldMappingSourceResource.js +20 -0
- package/build/dist/Types/CustomField/CustomFieldMappingSourceResource.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldValueMapping.js +141 -0
- package/build/dist/Types/CustomField/CustomFieldValueMapping.js.map +1 -0
- package/build/dist/Types/Icon/IconProp.js +1 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js +118 -37
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/Monitor/CephAlertTemplates.js +130 -171
- package/build/dist/Types/Monitor/CephAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/DockerAlertTemplates.js +286 -121
- package/build/dist/Types/Monitor/DockerAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/DockerSwarmAlertTemplates.js +84 -105
- package/build/dist/Types/Monitor/DockerSwarmAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/HostAlertTemplates.js +250 -122
- package/build/dist/Types/Monitor/HostAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/IotAlertTemplates.js +81 -81
- package/build/dist/Types/Monitor/IotAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +375 -215
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js +19 -19
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/PodmanAlertTemplates.js +104 -153
- package/build/dist/Types/Monitor/PodmanAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js +156 -91
- package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js +67 -6
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +38 -7
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js +261 -0
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js.map +1 -0
- package/build/dist/Types/Monitor/RumAlertTemplates.js +46 -7
- package/build/dist/Types/Monitor/RumAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/SeriesContext/SeriesDebugHints.js +422 -0
- package/build/dist/Types/Monitor/SeriesContext/SeriesDebugHints.js.map +1 -0
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js +441 -0
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js.map +1 -0
- package/build/dist/Types/Monitor/ServiceAlertTemplates.js +79 -15
- package/build/dist/Types/Monitor/ServiceAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/UptimeHistoryLabels.js +17 -0
- package/build/dist/Types/Monitor/UptimeHistoryLabels.js.map +1 -0
- package/build/dist/Types/NotificationSetting/RoutineEmailEvents.js +29 -0
- package/build/dist/Types/NotificationSetting/RoutineEmailEvents.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplay.js +117 -0
- package/build/dist/Types/Rum/SessionReplay.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplayApi.js +181 -0
- package/build/dist/Types/Rum/SessionReplayApi.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplayCaptureTrigger.js +21 -12
- package/build/dist/Types/Rum/SessionReplayCaptureTrigger.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplayConsentMode.js +11 -7
- package/build/dist/Types/Rum/SessionReplayConsentMode.js.map +1 -1
- package/build/dist/Types/Rum/SessionReplayCustomEvents.js +172 -0
- package/build/dist/Types/Rum/SessionReplayCustomEvents.js.map +1 -0
- package/build/dist/Types/Rum/SessionReplayHealth.js +37 -0
- package/build/dist/Types/Rum/SessionReplayHealth.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js +85 -0
- package/build/dist/Types/Telemetry/TelemetryIngestSurface.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetryIngestionKeyPolicy.js +15 -0
- package/build/dist/Types/Telemetry/TelemetryIngestionKeyPolicy.js.map +1 -0
- package/build/dist/Types/Telemetry/TelemetryIngestionKeyType.js +30 -0
- package/build/dist/Types/Telemetry/TelemetryIngestionKeyType.js.map +1 -0
- package/build/dist/Types/WebsiteRequest.js +55 -3
- package/build/dist/Types/WebsiteRequest.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +13 -2
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +6 -2
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +13 -2
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxis.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +15 -3
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js +40 -9
- package/build/dist/UI/Components/Charts/Utils/TimeAnnotation.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +186 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +80 -6
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/MapFromCustomFieldInput.js +118 -0
- package/build/dist/UI/Components/CustomFields/MapFromCustomFieldInput.js.map +1 -0
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +112 -7
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +5 -162
- package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -1
- package/build/dist/UI/Components/Graphs/UptimeDaySummary.js +181 -0
- package/build/dist/UI/Components/Graphs/UptimeDaySummary.js.map +1 -0
- package/build/dist/UI/Components/Header/Header.js +2 -3
- package/build/dist/UI/Components/Header/Header.js.map +1 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js +2 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js.map +1 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js +7 -1
- package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js.map +1 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js +7 -1
- package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js.map +1 -1
- package/build/dist/UI/Components/HeaderAlert/NotificationBell/NotificationBellDropdown.js +7 -1
- package/build/dist/UI/Components/HeaderAlert/NotificationBell/NotificationBellDropdown.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +5 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/JSONTable/JSONTable.js +2 -2
- package/build/dist/UI/Components/JSONTable/JSONTable.js.map +1 -1
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardShortcutsModal.js +35 -0
- package/build/dist/UI/Components/KeyboardShortcut/KeyboardShortcutsModal.js.map +1 -0
- package/build/dist/UI/Components/Monitor/SeriesDebugCommandsViewer.js +34 -0
- package/build/dist/UI/Components/Monitor/SeriesDebugCommandsViewer.js.map +1 -0
- package/build/dist/UI/Components/Monitor/SeriesLabelsViewer.js +49 -0
- package/build/dist/UI/Components/Monitor/SeriesLabelsViewer.js.map +1 -0
- package/build/dist/UI/Components/MonitorGraphs/Uptime.js +1 -1
- package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +32 -6
- package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +38 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js +22 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js.map +1 -1
- package/build/dist/UI/Components/Table/CellClassName.js +55 -0
- package/build/dist/UI/Components/Table/CellClassName.js.map +1 -0
- package/build/dist/UI/Components/Table/TableRow.js +16 -13
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Components/Table/TableSkeletonRows.js +9 -8
- package/build/dist/UI/Components/Table/TableSkeletonRows.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js +25 -1
- package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +47 -30
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/NodePlacement.js +37 -0
- package/build/dist/UI/Components/Workflow/NodePlacement.js.map +1 -0
- package/build/dist/UI/Components/Workflow/Workflow.js +35 -18
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Config.js +10 -20
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/UI/Utils/GlobalKeyboardShortcut.js +138 -0
- package/build/dist/UI/Utils/GlobalKeyboardShortcut.js.map +1 -0
- package/build/dist/UI/Utils/Telemetry/BrowserTelemetryConfig.js +14 -0
- package/build/dist/UI/Utils/Telemetry/BrowserTelemetryConfig.js.map +1 -0
- package/build/dist/UI/Utils/Telemetry/Telemetry.js +7 -5
- package/build/dist/UI/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Utils/API.js +67 -5
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/HTTPResponseBodyReader.js +157 -0
- package/build/dist/Utils/HTTPResponseBodyReader.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryScanStatus.js +69 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryScanStatus.js.map +1 -0
- package/build/dist/Utils/Rum/ChunkMath.js +76 -0
- package/build/dist/Utils/Rum/ChunkMath.js.map +1 -1
- package/build/dist/Utils/Rum/SessionReplayHealth.js +534 -0
- package/build/dist/Utils/Rum/SessionReplayHealth.js.map +1 -0
- package/build/dist/Utils/Rum/SessionReplayStringMap.js +165 -0
- package/build/dist/Utils/Rum/SessionReplayStringMap.js.map +1 -0
- package/build/dist/Utils/Schema/ModelSchema.js +1 -0
- package/build/dist/Utils/Schema/ModelSchema.js.map +1 -1
- package/build/dist/Utils/StatusPage/ResourceSearch.js +200 -0
- package/build/dist/Utils/StatusPage/ResourceSearch.js.map +1 -0
- package/build/dist/Utils/Telemetry/OriginAllowList.js +299 -0
- package/build/dist/Utils/Telemetry/OriginAllowList.js.map +1 -0
- package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js +147 -0
- package/build/dist/Utils/Uptime/DayUptimeGraphUtil.js.map +1 -0
- package/build/dist/Utils/ValueFormatter.js +32 -1
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ import QueryHelper from "../Types/Database/QueryHelper";
|
|
|
10
10
|
import UpdateBy from "../Types/Database/UpdateBy";
|
|
11
11
|
import { applyAlertSelfPrivacyFilter } from "../Utils/Alert/AlertPrivacyFilter";
|
|
12
12
|
import DatabaseService from "./DatabaseService";
|
|
13
|
+
import AlertCustomField from "../../Models/DatabaseModels/AlertCustomField";
|
|
14
|
+
import CustomFieldMappingService from "./CustomFieldMappingService";
|
|
13
15
|
import AlertOwnerTeamService from "./AlertOwnerTeamService";
|
|
14
16
|
import AlertOwnerUserService from "./AlertOwnerUserService";
|
|
15
17
|
import AlertStateService from "./AlertStateService";
|
|
@@ -270,6 +272,20 @@ export class Service extends DatabaseService<Model> {
|
|
|
270
272
|
|
|
271
273
|
await this.validateProjectScopedReferences(updateBy);
|
|
272
274
|
|
|
275
|
+
/*
|
|
276
|
+
* Two cases, one call. The Custom Fields modal saves the WHOLE bag back
|
|
277
|
+
* (it has no server-side merge), so a mapped value would be clobbered by
|
|
278
|
+
* any manual edit of a neighbouring field; and re-pointing the alert at
|
|
279
|
+
* another monitor changes what the mapped fields should hold. Both are
|
|
280
|
+
* folded into this payload so the row is written once, with an audit entry,
|
|
281
|
+
* workflow payload and realtime event that carry the value that was
|
|
282
|
+
* actually stored.
|
|
283
|
+
*/
|
|
284
|
+
await CustomFieldMappingService.applyMappingsToUpdate({
|
|
285
|
+
definitionModelType: AlertCustomField,
|
|
286
|
+
updateBy: updateBy,
|
|
287
|
+
});
|
|
288
|
+
|
|
273
289
|
return { updateBy, carryForward: null };
|
|
274
290
|
}
|
|
275
291
|
|
|
@@ -423,6 +439,21 @@ export class Service extends DatabaseService<Model> {
|
|
|
423
439
|
],
|
|
424
440
|
});
|
|
425
441
|
|
|
442
|
+
/*
|
|
443
|
+
* Custom fields configured to inherit from the alert's monitor are stamped
|
|
444
|
+
* here rather than in onCreateSuccess: `customFields` is a column on this
|
|
445
|
+
* very row, and the onCreateSuccess chain below is un-awaited and runs
|
|
446
|
+
* after the API response, so a value written there would be missing from
|
|
447
|
+
* the alert the caller is handed back. Before the counter increment, for
|
|
448
|
+
* the reason given above — although applyMappingsToCreate is written not
|
|
449
|
+
* to throw, because a custom field failing to inherit must never stop an
|
|
450
|
+
* alert from being opened.
|
|
451
|
+
*/
|
|
452
|
+
await CustomFieldMappingService.applyMappingsToCreate({
|
|
453
|
+
definitionModelType: AlertCustomField,
|
|
454
|
+
createBy: createBy,
|
|
455
|
+
});
|
|
456
|
+
|
|
426
457
|
const alertCounterResult: {
|
|
427
458
|
counter: number;
|
|
428
459
|
prefix: string | undefined;
|
|
@@ -1205,6 +1236,12 @@ ${alert.remediationNotes || "No remediation notes provided."}
|
|
|
1205
1236
|
onUpdate: OnUpdate<Model>,
|
|
1206
1237
|
updatedItemIds: ObjectID[],
|
|
1207
1238
|
): Promise<OnUpdate<Model>> {
|
|
1239
|
+
CustomFieldMappingService.restampAfterMultiRowUpdate({
|
|
1240
|
+
definitionModelType: AlertCustomField,
|
|
1241
|
+
updateBy: onUpdate.updateBy,
|
|
1242
|
+
updatedItemIds: updatedItemIds,
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1208
1245
|
/*
|
|
1209
1246
|
* Correcting a timestamp is the whole point of making these fields
|
|
1210
1247
|
* editable, so the numbers derived from them have to move. Without this
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import CreateBy from "../Types/Database/CreateBy";
|
|
2
2
|
import DeleteBy from "../Types/Database/DeleteBy";
|
|
3
3
|
import { OnCreate, OnDelete, OnUpdate } from "../Types/Database/Hooks";
|
|
4
|
+
import QueryHelper from "../Types/Database/QueryHelper";
|
|
4
5
|
import UpdateBy from "../Types/Database/UpdateBy";
|
|
6
|
+
import ApiKeyService from "./ApiKeyService";
|
|
5
7
|
import DatabaseService from "./DatabaseService";
|
|
8
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
9
|
+
import DatabaseCommonInteractionPropsUtil, {
|
|
10
|
+
PermissionType,
|
|
11
|
+
} from "../../Types/BaseDatabase/DatabaseCommonInteractionPropsUtil";
|
|
12
|
+
import PermissionScope from "../../Types/Database/AccessControl/PermissionScope";
|
|
6
13
|
import LIMIT_MAX, { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
|
|
7
14
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
15
|
+
import Exception from "../../Types/Exception/Exception";
|
|
16
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
8
17
|
import Model from "../../Models/DatabaseModels/ApiKeyPermission";
|
|
9
18
|
import Label from "../../Models/DatabaseModels/Label";
|
|
10
19
|
import ObjectID from "../../Types/ObjectID";
|
|
11
|
-
import Permission from "../../Types/Permission";
|
|
20
|
+
import Permission, { UserPermission } from "../../Types/Permission";
|
|
21
|
+
import RelationIdUtil from "../Utils/Database/RelationIdUtil";
|
|
12
22
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
13
23
|
import InMemoryTTLCache from "../Infrastructure/InMemoryTTLCache";
|
|
14
24
|
|
|
@@ -20,6 +30,9 @@ import InMemoryTTLCache from "../Infrastructure/InMemoryTTLCache";
|
|
|
20
30
|
*/
|
|
21
31
|
const PERMISSIONS_TTL_MS: number = 60 * 1000;
|
|
22
32
|
|
|
33
|
+
const API_KEY_REFERENCE_KEYS: Array<string> = ["apiKeyId", "apiKey"];
|
|
34
|
+
const PROJECT_REFERENCE_KEYS: Array<string> = ["projectId", "project"];
|
|
35
|
+
|
|
23
36
|
interface CachedApiKeyPermissionRow {
|
|
24
37
|
permission: Permission;
|
|
25
38
|
labelIds: Array<string>;
|
|
@@ -34,18 +47,21 @@ export interface ApiKeyPermissionRow {
|
|
|
34
47
|
|
|
35
48
|
export class Service extends DatabaseService<Model> {
|
|
36
49
|
/*
|
|
37
|
-
* Cache of `apiKeyId -> permission rows`.
|
|
38
|
-
*
|
|
39
|
-
* that's
|
|
50
|
+
* Cache of `(projectId, apiKeyId) -> permission rows`. Project is part of
|
|
51
|
+
* the key and the database query deliberately: even a malformed legacy row
|
|
52
|
+
* that points at another project's API key must never become authority in
|
|
53
|
+
* the project currently being authenticated.
|
|
40
54
|
*/
|
|
41
55
|
private permissionCache: InMemoryTTLCache<Array<CachedApiKeyPermissionRow>> =
|
|
42
56
|
new InMemoryTTLCache(10_000);
|
|
57
|
+
private permissionCacheGeneration: number = 0;
|
|
43
58
|
|
|
44
59
|
public constructor() {
|
|
45
60
|
super(Model);
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
public clearCache(): void {
|
|
64
|
+
this.permissionCacheGeneration++;
|
|
49
65
|
this.permissionCache.clear();
|
|
50
66
|
}
|
|
51
67
|
|
|
@@ -58,16 +74,19 @@ export class Service extends DatabaseService<Model> {
|
|
|
58
74
|
@CaptureSpan()
|
|
59
75
|
public async findPermissionsByApiKeyId(
|
|
60
76
|
apiKeyId: ObjectID,
|
|
77
|
+
projectId: ObjectID,
|
|
61
78
|
): Promise<Array<ApiKeyPermissionRow>> {
|
|
62
|
-
const cacheKey: string = apiKeyId.toString()
|
|
79
|
+
const cacheKey: string = `${projectId.toString()}:${apiKeyId.toString()}`;
|
|
63
80
|
|
|
64
81
|
let cachedRows: Array<CachedApiKeyPermissionRow> | undefined =
|
|
65
82
|
this.permissionCache.get(cacheKey);
|
|
66
83
|
|
|
67
84
|
if (cachedRows === undefined) {
|
|
85
|
+
const queryGeneration: number = this.permissionCacheGeneration;
|
|
68
86
|
const rows: Array<Model> = await this.findBy({
|
|
69
87
|
query: {
|
|
70
88
|
apiKeyId: apiKeyId,
|
|
89
|
+
projectId: projectId,
|
|
71
90
|
},
|
|
72
91
|
select: {
|
|
73
92
|
permission: true,
|
|
@@ -93,7 +112,14 @@ export class Service extends DatabaseService<Model> {
|
|
|
93
112
|
};
|
|
94
113
|
});
|
|
95
114
|
|
|
96
|
-
|
|
115
|
+
/*
|
|
116
|
+
* A permission mutation can commit while this database read is in
|
|
117
|
+
* flight. The success hook increments the generation after commit; do
|
|
118
|
+
* not let a pre-commit result repopulate the cache after that clear.
|
|
119
|
+
*/
|
|
120
|
+
if (queryGeneration === this.permissionCacheGeneration) {
|
|
121
|
+
this.permissionCache.set(cacheKey, cachedRows, PERMISSIONS_TTL_MS);
|
|
122
|
+
}
|
|
97
123
|
}
|
|
98
124
|
|
|
99
125
|
return cachedRows.map(
|
|
@@ -109,24 +135,293 @@ export class Service extends DatabaseService<Model> {
|
|
|
109
135
|
);
|
|
110
136
|
}
|
|
111
137
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
138
|
+
/**
|
|
139
|
+
* A request tenant is authoritative. Normalize both scalar and relation
|
|
140
|
+
* spellings before any lookup so the IDs we validate are exactly the IDs
|
|
141
|
+
* TypeORM can persist.
|
|
142
|
+
*/
|
|
143
|
+
private normalizeReferencesForCreate(createBy: CreateBy<Model>): {
|
|
144
|
+
apiKeyId: ObjectID;
|
|
145
|
+
projectId: ObjectID;
|
|
146
|
+
} {
|
|
147
|
+
const createData: Record<string, unknown> =
|
|
148
|
+
createBy.data as unknown as Record<string, unknown>;
|
|
149
|
+
const requestProjectId: ObjectID | undefined = createBy.props.tenantId;
|
|
150
|
+
const dataProjectId: ObjectID | null = RelationIdUtil.readConsistent(
|
|
151
|
+
createData,
|
|
152
|
+
PROJECT_REFERENCE_KEYS,
|
|
153
|
+
"Project",
|
|
154
|
+
);
|
|
155
|
+
const projectId: ObjectID | undefined =
|
|
156
|
+
requestProjectId || dataProjectId || undefined;
|
|
157
|
+
const apiKeyId: ObjectID | null = RelationIdUtil.readConsistent(
|
|
158
|
+
createData,
|
|
159
|
+
API_KEY_REFERENCE_KEYS,
|
|
160
|
+
"API Key",
|
|
161
|
+
);
|
|
117
162
|
|
|
118
|
-
if (!
|
|
163
|
+
if (!apiKeyId) {
|
|
119
164
|
throw new BadDataException("API Key ID is required to create permission");
|
|
120
165
|
}
|
|
121
166
|
|
|
122
|
-
if (!
|
|
167
|
+
if (!projectId) {
|
|
123
168
|
throw new BadDataException("Project Id is required to create permission");
|
|
124
169
|
}
|
|
125
170
|
|
|
171
|
+
if (
|
|
172
|
+
requestProjectId &&
|
|
173
|
+
dataProjectId &&
|
|
174
|
+
requestProjectId.toString() !== dataProjectId.toString()
|
|
175
|
+
) {
|
|
176
|
+
throw new BadDataException("Invalid API Key ID for this project");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Both relation properties map to the same database columns as their ID
|
|
181
|
+
* siblings. TypeORM gives the relation object persistence significance of
|
|
182
|
+
* its own, so validation of only the scalar IDs is not sufficient: two
|
|
183
|
+
* conflicting values can otherwise pass the hook and the relation can win
|
|
184
|
+
* during save. From here onward the validated scalar IDs are the only
|
|
185
|
+
* persistence source of truth.
|
|
186
|
+
*/
|
|
187
|
+
createBy.data.apiKeyId = apiKeyId;
|
|
188
|
+
createBy.data.projectId = projectId;
|
|
189
|
+
delete createBy.data.apiKey;
|
|
190
|
+
delete createBy.data.project;
|
|
191
|
+
|
|
192
|
+
return { apiKeyId, projectId };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Resolve the relation by both id and tenant in one root query. Looking up
|
|
197
|
+
* the id alone and trusting the permission row's projectId creates a
|
|
198
|
+
* cross-tenant foreign-key confused-deputy: the database FK proves the key
|
|
199
|
+
* exists, but not that the key belongs to this project.
|
|
200
|
+
*/
|
|
201
|
+
private async assertApiKeyBelongsToProject(
|
|
202
|
+
apiKeyId: ObjectID,
|
|
203
|
+
projectId: ObjectID,
|
|
204
|
+
): Promise<void> {
|
|
205
|
+
const apiKey: unknown = await ApiKeyService.findOneBy({
|
|
206
|
+
query: {
|
|
207
|
+
_id: apiKeyId,
|
|
208
|
+
projectId: projectId,
|
|
209
|
+
},
|
|
210
|
+
select: {
|
|
211
|
+
_id: true,
|
|
212
|
+
},
|
|
213
|
+
props: {
|
|
214
|
+
isRoot: true,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
if (!apiKey) {
|
|
219
|
+
throw new BadDataException("Invalid API Key ID for this project");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private getLabelIds(labels: Array<Label> | undefined): Array<ObjectID> {
|
|
224
|
+
const labelIds: Array<ObjectID> = [];
|
|
225
|
+
|
|
226
|
+
for (const label of labels || []) {
|
|
227
|
+
const labelReference: Label & {
|
|
228
|
+
_id?: string | ObjectID | undefined;
|
|
229
|
+
} = label;
|
|
230
|
+
const labelId: string | ObjectID | undefined =
|
|
231
|
+
labelReference.id || labelReference._id;
|
|
232
|
+
|
|
233
|
+
if (!labelId) {
|
|
234
|
+
throw new BadDataException(
|
|
235
|
+
"Every API key permission label must have an ID",
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
labelIds.push(
|
|
240
|
+
labelId instanceof ObjectID ? labelId : new ObjectID(labelId),
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return labelIds;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private hasUnrestrictedPermission(
|
|
248
|
+
permissions: Array<UserPermission>,
|
|
249
|
+
): boolean {
|
|
250
|
+
return permissions.some((permission: UserPermission): boolean => {
|
|
251
|
+
return (
|
|
252
|
+
permission.scope === PermissionScope.All ||
|
|
253
|
+
(permission.scope !== PermissionScope.Owned &&
|
|
254
|
+
permission.labelIds.length === 0)
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Return true only if the caller holds the requested permission over the
|
|
261
|
+
* entire scope they are trying to delegate. Label-scoped authority can be
|
|
262
|
+
* delegated only to a subset of those labels; an Owned scope cannot be
|
|
263
|
+
* transferred to an API key because API keys have no user/team ownership
|
|
264
|
+
* identity.
|
|
265
|
+
*/
|
|
266
|
+
private isPermissionWithinCallerAuthority(data: {
|
|
267
|
+
allowPermissions: Array<UserPermission>;
|
|
268
|
+
blockPermissions: Array<UserPermission>;
|
|
269
|
+
permission: Permission;
|
|
270
|
+
requestedLabelIds: Array<ObjectID>;
|
|
271
|
+
}): boolean {
|
|
272
|
+
const matchingAllows: Array<UserPermission> = data.allowPermissions.filter(
|
|
273
|
+
(permission: UserPermission): boolean => {
|
|
274
|
+
return (
|
|
275
|
+
permission.permission === data.permission &&
|
|
276
|
+
permission.scope !== PermissionScope.Owned
|
|
277
|
+
);
|
|
278
|
+
},
|
|
279
|
+
);
|
|
280
|
+
const matchingBlocks: Array<UserPermission> = data.blockPermissions.filter(
|
|
281
|
+
(permission: UserPermission): boolean => {
|
|
282
|
+
return permission.permission === data.permission;
|
|
283
|
+
},
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const requestedLabels: Array<string> = data.requestedLabelIds.map(
|
|
287
|
+
(labelId: ObjectID): string => {
|
|
288
|
+
return labelId.toString();
|
|
289
|
+
},
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
let isAllowed: boolean = this.hasUnrestrictedPermission(matchingAllows);
|
|
293
|
+
|
|
294
|
+
if (!isAllowed && requestedLabels.length > 0) {
|
|
295
|
+
const allowedLabelIds: Set<string> = new Set<string>();
|
|
296
|
+
for (const permission of matchingAllows) {
|
|
297
|
+
for (const labelId of permission.labelIds) {
|
|
298
|
+
allowedLabelIds.add(labelId.toString());
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
isAllowed = requestedLabels.every((labelId: string): boolean => {
|
|
302
|
+
return allowedLabelIds.has(labelId);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (!isAllowed) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (matchingBlocks.length === 0) {
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (
|
|
315
|
+
this.hasUnrestrictedPermission(matchingBlocks) ||
|
|
316
|
+
matchingBlocks.some((permission: UserPermission): boolean => {
|
|
317
|
+
return permission.scope === PermissionScope.Owned;
|
|
318
|
+
})
|
|
319
|
+
) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/*
|
|
324
|
+
* An unscoped API-key grant includes every label, including any scope the
|
|
325
|
+
* caller is blocked from, so even one scoped block makes it too broad.
|
|
326
|
+
*/
|
|
327
|
+
if (requestedLabels.length === 0) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const blockedLabelIds: Set<string> = new Set<string>();
|
|
332
|
+
for (const permission of matchingBlocks) {
|
|
333
|
+
for (const labelId of permission.labelIds) {
|
|
334
|
+
blockedLabelIds.add(labelId.toString());
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return requestedLabels.every((labelId: string): boolean => {
|
|
339
|
+
return !blockedLabelIds.has(labelId);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Permission-management is delegation, not a role minting primitive.
|
|
345
|
+
* Owners may delegate anything. Every other editor, including a project
|
|
346
|
+
* admin, must themselves hold the exact permission and every label scope
|
|
347
|
+
* they place on the API key. ProjectAdmin is not an implication of every
|
|
348
|
+
* permission: destructive and billing permissions intentionally exclude it
|
|
349
|
+
* in their model ACLs.
|
|
350
|
+
*/
|
|
351
|
+
private assertCallerCanGrantPermission(data: {
|
|
352
|
+
permission: Permission;
|
|
353
|
+
labels: Array<Label> | undefined;
|
|
354
|
+
projectId: ObjectID;
|
|
355
|
+
props: DatabaseCommonInteractionProps;
|
|
356
|
+
}): void {
|
|
357
|
+
if (data.props.isRoot || data.props.isMasterAdmin) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const scopedProps: DatabaseCommonInteractionProps = {
|
|
362
|
+
...data.props,
|
|
363
|
+
tenantId: data.projectId,
|
|
364
|
+
};
|
|
365
|
+
const allowPermissions: Array<UserPermission> =
|
|
366
|
+
DatabaseCommonInteractionPropsUtil.getUserPermissions(
|
|
367
|
+
scopedProps,
|
|
368
|
+
PermissionType.Allow,
|
|
369
|
+
);
|
|
370
|
+
const blockPermissions: Array<UserPermission> =
|
|
371
|
+
DatabaseCommonInteractionPropsUtil.getUserPermissions(
|
|
372
|
+
scopedProps,
|
|
373
|
+
PermissionType.Block,
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
const hasProjectOwner: boolean = this.isPermissionWithinCallerAuthority({
|
|
377
|
+
allowPermissions,
|
|
378
|
+
blockPermissions,
|
|
379
|
+
permission: Permission.ProjectOwner,
|
|
380
|
+
requestedLabelIds: [],
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
if (hasProjectOwner) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (
|
|
388
|
+
!this.isPermissionWithinCallerAuthority({
|
|
389
|
+
allowPermissions,
|
|
390
|
+
blockPermissions,
|
|
391
|
+
permission: data.permission,
|
|
392
|
+
requestedLabelIds: this.getLabelIds(data.labels),
|
|
393
|
+
})
|
|
394
|
+
) {
|
|
395
|
+
throw new NotAuthorizedException(
|
|
396
|
+
"You cannot grant an API key permission beyond your own authority",
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
@CaptureSpan()
|
|
402
|
+
protected override async onBeforeCreate(
|
|
403
|
+
createBy: CreateBy<Model>,
|
|
404
|
+
): Promise<OnCreate<Model>> {
|
|
405
|
+
this.clearCache();
|
|
406
|
+
|
|
126
407
|
if (!createBy.data.permission) {
|
|
127
408
|
throw new BadDataException("Permission is required to create permission");
|
|
128
409
|
}
|
|
129
410
|
|
|
411
|
+
const references: { apiKeyId: ObjectID; projectId: ObjectID } =
|
|
412
|
+
this.normalizeReferencesForCreate(createBy);
|
|
413
|
+
|
|
414
|
+
await this.assertApiKeyBelongsToProject(
|
|
415
|
+
references.apiKeyId,
|
|
416
|
+
references.projectId,
|
|
417
|
+
);
|
|
418
|
+
this.assertCallerCanGrantPermission({
|
|
419
|
+
permission: createBy.data.permission,
|
|
420
|
+
labels: createBy.data.labels,
|
|
421
|
+
projectId: references.projectId,
|
|
422
|
+
props: createBy.props,
|
|
423
|
+
});
|
|
424
|
+
|
|
130
425
|
// check if this permission is already assigned to this team and if yes then throw error.
|
|
131
426
|
|
|
132
427
|
const isBlockPermission: boolean = createBy.data.isBlockPermission || false;
|
|
@@ -198,24 +493,119 @@ export class Service extends DatabaseService<Model> {
|
|
|
198
493
|
*/
|
|
199
494
|
this.clearCache();
|
|
200
495
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
496
|
+
const existingPermissions: Array<Model> = await this.findBy({
|
|
497
|
+
query: updateBy.query,
|
|
498
|
+
select: {
|
|
499
|
+
_id: true,
|
|
500
|
+
labels: true,
|
|
501
|
+
isBlockPermission: true,
|
|
502
|
+
projectId: true,
|
|
503
|
+
apiKeyId: true,
|
|
504
|
+
permission: true,
|
|
505
|
+
},
|
|
506
|
+
limit: LIMIT_PER_PROJECT,
|
|
507
|
+
skip: 0,
|
|
508
|
+
props: {
|
|
509
|
+
isRoot: true,
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
const rawUpdatedPermission: unknown = updateBy.data.permission;
|
|
514
|
+
if (
|
|
515
|
+
rawUpdatedPermission !== undefined &&
|
|
516
|
+
typeof rawUpdatedPermission !== "string"
|
|
517
|
+
) {
|
|
518
|
+
throw new BadDataException("Invalid API Key permission");
|
|
519
|
+
}
|
|
520
|
+
const updatedPermission: Permission | undefined = rawUpdatedPermission as
|
|
521
|
+
| Permission
|
|
522
|
+
| undefined;
|
|
523
|
+
|
|
524
|
+
const isLabelsUpdateRequested: boolean = updateBy.data.labels !== undefined;
|
|
525
|
+
if (
|
|
526
|
+
isLabelsUpdateRequested &&
|
|
527
|
+
updateBy.data.labels !== null &&
|
|
528
|
+
!Array.isArray(updateBy.data.labels)
|
|
529
|
+
) {
|
|
530
|
+
throw new BadDataException("Invalid API Key permission labels");
|
|
531
|
+
}
|
|
532
|
+
const updatedLabels: Array<Label> | undefined =
|
|
533
|
+
updateBy.data.labels === null
|
|
534
|
+
? []
|
|
535
|
+
: Array.isArray(updateBy.data.labels)
|
|
536
|
+
? (updateBy.data.labels as unknown as Array<Label>)
|
|
537
|
+
: undefined;
|
|
538
|
+
|
|
539
|
+
const rawUpdatedIsBlockPermission: unknown =
|
|
540
|
+
updateBy.data.isBlockPermission;
|
|
541
|
+
if (
|
|
542
|
+
rawUpdatedIsBlockPermission !== undefined &&
|
|
543
|
+
typeof rawUpdatedIsBlockPermission !== "boolean"
|
|
544
|
+
) {
|
|
545
|
+
throw new BadDataException("Invalid API Key block permission value");
|
|
546
|
+
}
|
|
547
|
+
const updatedIsBlockPermission: boolean | undefined =
|
|
548
|
+
rawUpdatedIsBlockPermission as boolean | undefined;
|
|
549
|
+
|
|
550
|
+
for (const existingPermission of existingPermissions) {
|
|
551
|
+
const projectId: ObjectID | undefined = existingPermission.projectId;
|
|
552
|
+
const apiKeyId: ObjectID | undefined = existingPermission.apiKeyId;
|
|
553
|
+
const permission: Permission | undefined =
|
|
554
|
+
updatedPermission || existingPermission.permission;
|
|
555
|
+
|
|
556
|
+
if (!projectId || !apiKeyId || !permission) {
|
|
557
|
+
throw new BadDataException("Invalid API Key permission");
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (
|
|
561
|
+
updateBy.props.tenantId &&
|
|
562
|
+
updateBy.props.tenantId.toString() !== projectId.toString()
|
|
563
|
+
) {
|
|
564
|
+
throw new BadDataException("Invalid API Key ID for this project");
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
await this.assertApiKeyBelongsToProject(apiKeyId, projectId);
|
|
568
|
+
this.assertCallerCanGrantPermission({
|
|
569
|
+
permission,
|
|
570
|
+
labels: isLabelsUpdateRequested
|
|
571
|
+
? updatedLabels
|
|
572
|
+
: existingPermission.labels,
|
|
573
|
+
projectId,
|
|
574
|
+
props: updateBy.props,
|
|
217
575
|
});
|
|
218
576
|
|
|
577
|
+
if (
|
|
578
|
+
updatedPermission !== undefined ||
|
|
579
|
+
updatedIsBlockPermission !== undefined
|
|
580
|
+
) {
|
|
581
|
+
const duplicatePermission: Model | null = await this.findOneBy({
|
|
582
|
+
query: {
|
|
583
|
+
_id: QueryHelper.notEquals(existingPermission.id!),
|
|
584
|
+
apiKeyId,
|
|
585
|
+
projectId,
|
|
586
|
+
permission,
|
|
587
|
+
isBlockPermission:
|
|
588
|
+
updatedIsBlockPermission === undefined
|
|
589
|
+
? existingPermission.isBlockPermission || false
|
|
590
|
+
: updatedIsBlockPermission,
|
|
591
|
+
},
|
|
592
|
+
select: {
|
|
593
|
+
_id: true,
|
|
594
|
+
},
|
|
595
|
+
props: {
|
|
596
|
+
isRoot: true,
|
|
597
|
+
},
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
if (duplicatePermission) {
|
|
601
|
+
throw new BadDataException(
|
|
602
|
+
"This permission is already assigned to this API Key",
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (updateBy.data.labels && updateBy.data.labels.length > 0) {
|
|
219
609
|
for (const alreadySavedPermission of existingPermissions) {
|
|
220
610
|
// check if the
|
|
221
611
|
|
|
@@ -267,6 +657,48 @@ export class Service extends DatabaseService<Model> {
|
|
|
267
657
|
this.clearCache();
|
|
268
658
|
return { deleteBy, carryForward: null };
|
|
269
659
|
}
|
|
660
|
+
|
|
661
|
+
@CaptureSpan()
|
|
662
|
+
protected override async onCreateSuccess(
|
|
663
|
+
_onCreate: OnCreate<Model>,
|
|
664
|
+
createdItem: Model,
|
|
665
|
+
): Promise<Model> {
|
|
666
|
+
this.clearCache();
|
|
667
|
+
return createdItem;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
@CaptureSpan()
|
|
671
|
+
protected override async onUpdateSuccess(
|
|
672
|
+
onUpdate: OnUpdate<Model>,
|
|
673
|
+
_updatedItemIds: Array<ObjectID>,
|
|
674
|
+
): Promise<OnUpdate<Model>> {
|
|
675
|
+
this.clearCache();
|
|
676
|
+
return onUpdate;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
@CaptureSpan()
|
|
680
|
+
protected override async onDeleteSuccess(
|
|
681
|
+
onDelete: OnDelete<Model>,
|
|
682
|
+
_itemIdsBeforeDelete: Array<ObjectID>,
|
|
683
|
+
): Promise<OnDelete<Model>> {
|
|
684
|
+
this.clearCache();
|
|
685
|
+
return onDelete;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
protected override async onCreateError(error: Exception): Promise<Exception> {
|
|
689
|
+
this.clearCache();
|
|
690
|
+
return error;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
protected override async onUpdateError(error: Exception): Promise<Exception> {
|
|
694
|
+
this.clearCache();
|
|
695
|
+
return error;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
protected override async onDeleteError(error: Exception): Promise<Exception> {
|
|
699
|
+
this.clearCache();
|
|
700
|
+
return error;
|
|
701
|
+
}
|
|
270
702
|
}
|
|
271
703
|
|
|
272
704
|
export default new Service();
|