@oneuptime/common 12.0.32 → 12.0.33
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/Span.ts +14 -0
- package/Models/DatabaseModels/EnterpriseLicense.ts +56 -0
- package/Models/DatabaseModels/Index.ts +10 -0
- package/Models/DatabaseModels/Monitor.ts +76 -0
- package/Models/DatabaseModels/NetworkAlertPolicy.ts +690 -0
- package/Models/DatabaseModels/NetworkDevice.ts +176 -1
- package/Models/DatabaseModels/NetworkSite.ts +201 -2
- package/Models/DatabaseModels/NetworkSiteType.ts +102 -3
- package/Models/DatabaseModels/NetworkSnmpCredentialProfile.ts +841 -0
- package/Models/DatabaseModels/TelemetryException.ts +119 -0
- package/Models/DatabaseModels/UserNotificationEmailRollupBatch.ts +334 -0
- package/Models/DatabaseModels/UserNotificationEmailRollupItem.ts +370 -0
- package/Models/DatabaseModels/UserNotificationEmailRollupSetting.ts +282 -0
- package/Server/API/EnterpriseLicenseAPI.ts +391 -64
- package/Server/API/LlmProviderAPI.ts +137 -22
- package/Server/EnvironmentConfig.ts +14 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790700000000-AddNetworkSiteTypeParentHierarchy.ts +55 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddEnterpriseLicenseUsageProvenance.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddTelemetryExceptionErrorClass.ts +124 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791000000000-AddUserNotificationEmailRollup.ts +132 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791100000000-AddUserNotificationEmailRollupSetting.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791200000000-AddNetworkSnmpCredentialProfilesAndAlertPolicies.ts +191 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
- package/Server/Infrastructure/QueueWorker.ts +38 -8
- package/Server/Middleware/BearerTokenAuthorization.ts +12 -0
- package/Server/Middleware/ProjectAuthorization.ts +11 -0
- package/Server/Middleware/SCIMAuthorization.ts +12 -0
- package/Server/Middleware/TelemetryIngest.ts +11 -0
- package/Server/Services/AIBillingService.ts +101 -27
- package/Server/Services/EnterpriseLicenseInstanceService.ts +197 -0
- package/Server/Services/EnterpriseLicenseService.ts +55 -0
- package/Server/Services/Index.ts +10 -0
- package/Server/Services/MonitorService.ts +143 -21
- package/Server/Services/MonitorStatusTimelineService.ts +150 -8
- package/Server/Services/MonitorTemplateService.ts +217 -1
- package/Server/Services/NetworkAlertPolicyEngineService.ts +2159 -0
- package/Server/Services/NetworkAlertPolicyService.ts +944 -0
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +9 -10
- package/Server/Services/NetworkDeviceAutoImportRuleService.ts +60 -15
- package/Server/Services/NetworkDeviceService.ts +1032 -73
- package/Server/Services/NetworkSiteService.ts +1502 -129
- package/Server/Services/NetworkSiteTypeService.ts +1216 -0
- package/Server/Services/NetworkSnmpCredentialProfileService.ts +238 -0
- package/Server/Services/NotificationService.ts +118 -28
- package/Server/Services/ProjectService.ts +105 -48
- package/Server/Services/StatusPagePrivateUserService.ts +103 -3
- package/Server/Services/UserNotificationEmailRollupBatchService.ts +78 -0
- package/Server/Services/UserNotificationEmailRollupItemService.ts +79 -0
- package/Server/Services/UserNotificationEmailRollupSettingService.ts +113 -0
- package/Server/Services/UserNotificationSettingService.ts +62 -25
- package/Server/Services/UserService.ts +95 -0
- package/Server/Types/Database/QueryHelper.ts +2 -2
- package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +14 -3
- package/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.ts +10 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.ts +10 -0
- package/Server/Utils/AI/SRE/Insights/InsightTriageRunner.ts +62 -1
- package/Server/Utils/AI/Toolbox/AlertTools.ts +15 -1
- package/Server/Utils/Billing/BillingFailureNoticeThrottle.ts +80 -0
- package/Server/Utils/DataSource/HttpFetch.ts +9 -2
- package/Server/Utils/EmailRollup/EmailRollupConstants.ts +98 -0
- package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +872 -0
- package/Server/Utils/EmailRollup/EmailRollupRenderer.ts +781 -0
- package/Server/Utils/EmailRollup/EmailRollupWriter.ts +368 -0
- package/Server/Utils/LLM/LLMService.ts +78 -0
- package/Server/Utils/LogRedaction.ts +8 -0
- package/Server/Utils/Logger.ts +79 -1
- package/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.ts +190 -0
- package/Server/Utils/Monitor/Criteria/EvaluateOverTime.ts +9 -2
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +61 -1
- package/Server/Utils/Monitor/MonitorCriteriaDataExtractor.ts +14 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +49 -0
- package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +255 -4
- package/Server/Utils/Monitor/MonitorMetricUtil.ts +41 -0
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +43 -0
- package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +499 -19
- package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +66 -10
- package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +238 -44
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +146 -39
- package/Server/Utils/NetworkDevice/DeviceHealthAggregation.ts +31 -18
- package/Server/Utils/NetworkSite/NetworkSiteHierarchyLock.ts +213 -0
- package/Server/Utils/OutboundUserAgent.ts +152 -0
- package/Server/Utils/StartServer.ts +51 -19
- package/Server/Utils/Telemetry/CaptureSpan.ts +32 -8
- package/Server/Utils/Telemetry/ErrorClassResolver.ts +120 -0
- package/Server/Utils/Telemetry/SpanUtil.ts +33 -0
- package/Server/Utils/Telemetry.ts +198 -51
- package/Server/Views/Partials/SensitiveUrlToken.ejs +140 -0
- package/Tests/App/Dashboard/AddNeighborToMonitoringModal.test.tsx +134 -33
- package/Tests/App/Dashboard/AskAiSuggestedPrompts.test.ts +279 -0
- package/Tests/App/Dashboard/DashboardEditPermissions.test.tsx +517 -0
- package/Tests/App/Dashboard/DashboardVariablesDiscard.test.tsx +26 -0
- package/Tests/App/Dashboard/DeviceStatusHero.test.tsx +588 -0
- package/Tests/App/Dashboard/DiscoveryScanWizardValidation.test.tsx +18 -9
- package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +632 -0
- package/Tests/App/Dashboard/MonitorRecommendationCreateProgress.test.tsx +682 -0
- package/Tests/App/Dashboard/MonitorTypePicker.test.tsx +4 -2
- package/Tests/App/Dashboard/NetworkDeviceCreateFormMonitorBinding.test.tsx +676 -0
- package/Tests/App/Dashboard/NetworkDeviceCreateFormPingMonitor.test.tsx +791 -0
- package/Tests/App/Dashboard/NetworkDeviceCreateFormProbeAndSnmp.test.tsx +833 -0
- package/Tests/App/Dashboard/NetworkDeviceCriteriaFilter.test.ts +161 -0
- package/Tests/App/Dashboard/NetworkDeviceSettingsMonitoringSection.test.tsx +458 -0
- package/Tests/App/Dashboard/NetworkSideMenu.test.tsx +41 -5
- package/Tests/App/Dashboard/PingMonitorProvisioning.test.ts +368 -0
- package/Tests/App/Dashboard/RecommendationCard.test.tsx +796 -0
- package/Tests/App/Dashboard/RecommendationToolbar.test.tsx +519 -0
- package/Tests/App/Dashboard/RecommendationsList.test.tsx +661 -0
- package/Tests/App/Dashboard/UseBulkCreatePingMonitors.test.tsx +899 -0
- package/Tests/App/Dashboard/UseBulkSnmpCredentialProfileActions.test.tsx +732 -0
- package/Tests/App/SensitiveUrlTokenBootstrap.test.ts +256 -0
- package/Tests/App/StatusPage/StatusPageIndexPageRobotsMeta.test.ts +11 -1
- package/Tests/App/StatusPage/StatusPageLoginCodeBootstrap.test.ts +9 -4
- package/Tests/Models/NetworkSiteHierarchy.test.ts +41 -4
- package/Tests/Server/API/EnterpriseLicenseReportUserCount.test.ts +951 -7
- package/Tests/Server/API/LlmProviderConnectionTest.test.ts +522 -0
- package/Tests/Server/Infrastructure/Postgres/NetworkSnmpCredentialProfilesAndAlertPoliciesMigration.test.ts +854 -0
- package/Tests/Server/Infrastructure/Postgres/SchemaMigrationsOrdering.test.ts +18 -0
- package/Tests/Server/Infrastructure/Postgres/UserNotificationEmailRollupTableMigration.test.ts +535 -0
- package/Tests/Server/Services/AIChatPrivacyPin.test.ts +560 -0
- package/Tests/Server/Services/BillingRechargeOwnerEmailGuards.test.ts +783 -0
- package/Tests/Server/Services/EnterpriseLicenseInstanceServiceDeletionUsage.test.ts +707 -0
- package/Tests/Server/Services/EnterpriseLicenseServiceUsageAggregationLock.test.ts +329 -0
- package/Tests/Server/Services/MonitorServiceDeleteNetworkDeviceCleanup.test.ts +294 -0
- package/Tests/Server/Services/MonitorStatusBridgeProbePath.test.ts +802 -0
- package/Tests/Server/Services/MonitorStatusTimelineService.test.ts +72 -2
- package/Tests/Server/Services/NetworkAlertPolicyEngineHooks.test.ts +752 -0
- package/Tests/Server/Services/NetworkAlertPolicyEngineService.test.ts +1849 -0
- package/Tests/Server/Services/NetworkAlertPolicyModel.test.ts +1793 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +47 -4
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleService.test.ts +97 -12
- package/Tests/Server/Services/NetworkDeviceAutoMonitorLifecycle.test.ts +148 -3
- package/Tests/Server/Services/NetworkDeviceMonitorBindingUpdateGuard.test.ts +514 -0
- package/Tests/Server/Services/NetworkDeviceMonitorStatusStamp.test.ts +447 -58
- package/Tests/Server/Services/NetworkDeviceMonitoringMethodTransition.test.ts +739 -0
- package/Tests/Server/Services/NetworkDevicePollingTenancy.test.ts +501 -0
- package/Tests/Server/Services/NetworkDeviceSiteDefaultProbe.test.ts +432 -0
- package/Tests/Server/Services/NetworkSiteMonitoringDefaults.test.ts +498 -0
- package/Tests/Server/Services/NetworkSiteRollupPolicyAndMaintenance.test.ts +337 -55
- package/Tests/Server/Services/NetworkSiteService.test.ts +1868 -131
- package/Tests/Server/Services/NetworkSiteTypeService.test.ts +1109 -0
- package/Tests/Server/Services/NetworkSnmpCredentialProfileModel.test.ts +926 -0
- package/Tests/Server/Services/NetworkSnmpCredentialProfileService.test.ts +796 -0
- package/Tests/Server/Services/ProjectServiceNetworkSiteTypeDefaults.test.ts +214 -0
- package/Tests/Server/Services/StatusPagePrivateUserEmailChangePasswordResetExpiry.test.ts +269 -0
- package/Tests/Server/Services/UserEmailChangePasswordResetExpiry.test.ts +472 -0
- package/Tests/Server/Services/UserNotificationEmailRollupModels.test.ts +569 -0
- package/Tests/Server/Services/UserNotificationEmailRollupSettingModel.test.ts +314 -0
- package/Tests/Server/Services/UserNotificationEmailRollupSettingService.test.ts +409 -0
- package/Tests/Server/Services/UserNotificationSettingRollupRouting.test.ts +856 -0
- package/Tests/Server/Services/UserNotificationSettingWorkspaceChannels.test.ts +102 -1
- package/Tests/Server/Types/Database/Permissions/DashboardAccessPermission.test.ts +321 -0
- package/Tests/Server/Types/Database/QueryHelperOperators.test.ts +17 -0
- package/Tests/Server/Utils/AI/AlertMonitorFilters.test.ts +124 -0
- package/Tests/Server/Utils/AI/Insights/InsightTriageRunner.test.ts +208 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +235 -0
- package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +253 -0
- package/Tests/Server/Utils/Captcha.test.ts +422 -0
- package/Tests/Server/Utils/DataSource/HttpFetch.test.ts +96 -2
- package/Tests/Server/Utils/Database/MigrationFailureLog.test.ts +466 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerBehaviour.test.ts +1096 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerClaim.test.ts +466 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupRenderer.test.ts +1428 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupTestHarness.ts +752 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupWriter.test.ts +864 -0
- package/Tests/Server/Utils/LoggerFaultDemotion.test.ts +346 -0
- package/Tests/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.test.ts +633 -0
- package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +196 -0
- package/Tests/Server/Utils/Monitor/DatabaseMetricWrite.test.ts +367 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaObservationBuilderUnits.test.ts +100 -0
- package/Tests/Server/Utils/Monitor/MonitorStepResourceIdentity.test.ts +5 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +512 -31
- package/Tests/Server/Utils/Monitor/NetworkDeviceMetricUtil.test.ts +252 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +479 -42
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +351 -5
- package/Tests/Server/Utils/NetworkDevice/DeviceHealthAggregation.test.ts +136 -12
- package/Tests/Server/Utils/NetworkSite/NetworkSiteHierarchyLock.test.ts +306 -0
- package/Tests/Server/Utils/OutboundUserAgent.test.ts +266 -0
- package/Tests/Server/Utils/SecurityEvent/ThreatIntel/TaxiiClientUserAgent.test.ts +141 -0
- package/Tests/Server/Utils/Telemetry/ErrorClassResolver.test.ts +298 -0
- package/Tests/Server/Utils/Telemetry.test.ts +456 -66
- package/Tests/Types/Monitor/DatabaseMetricCatalog.test.ts +388 -0
- package/Tests/Types/Monitor/MonitorStepDatabaseMonitor.test.ts +243 -0
- package/Tests/Types/Monitor/MonitorStepDefaultTelemetryConfig.test.ts +1 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +1 -0
- package/Tests/Types/Monitor/MonitorTypeKeywords.test.ts +16 -7
- package/Tests/Types/Monitor/NetworkDeviceAlertPack.test.ts +60 -0
- package/Tests/Types/NetworkDevice/NetworkAlertPolicyScope.test.ts +655 -0
- package/Tests/Types/NetworkDevice/NetworkDeviceMonitoringMethod.test.ts +115 -26
- package/Tests/Types/NetworkSite/DefaultNetworkSiteType.test.ts +39 -0
- package/Tests/Types/NotificationSetting/NotificationEmailRollupPolicy.test.ts +299 -0
- package/Tests/Types/Telemetry/ErrorClass.test.ts +483 -0
- package/Tests/UI/Components/BasicRadioButtons.test.tsx +336 -0
- package/Tests/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.test.ts +15 -0
- package/Tests/UI/Components/ProgressBar.test.tsx +38 -2
- package/Tests/UI/Components/SideMenuItem.test.tsx +226 -4
- package/Tests/UI/Components/SideMenuSection.test.tsx +310 -0
- package/Tests/UI/Components/SideOverSubmitState.test.tsx +335 -0
- package/Tests/UI/Utils/PageScrollLock.test.tsx +377 -0
- package/Tests/UI/Utils/PermissionGate.test.ts +78 -0
- package/Tests/UI/Utils/SensitiveUrlToken.test.ts +140 -0
- package/Tests/Utils/EnterpriseLicenseSeats.test.ts +69 -0
- package/Tests/Utils/EnterpriseLicenseSync.test.ts +7 -1
- package/Tests/Utils/EnterpriseLicenseUsage.test.ts +433 -2
- package/Tests/Utils/Monitor/MonitorMetricType.test.ts +280 -1
- package/Tests/Utils/Monitor/MonitorSummarySnapshotUtil.test.ts +1 -0
- package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +38 -0
- package/Tests/Utils/NetworkDevice/DeviceHealthStateUtil.test.ts +284 -23
- package/Tests/Utils/NetworkDevice/DeviceReachabilityUtil.test.ts +177 -0
- package/Tests/Utils/NetworkDevice/MonitoringMethodThreadedClassifiers.test.ts +992 -0
- package/Tests/Utils/NetworkDevice/NetworkAlertPolicyBootstrapUtil.test.ts +427 -0
- package/Tests/Utils/NetworkDevice/ReachabilityStampConsistency.test.ts +185 -0
- package/Tests/Utils/NetworkDevice/SnmpCredentialUtil.test.ts +268 -0
- package/Tests/Utils/NetworkDiscovery/AutoImportRuleMatcher.test.ts +55 -5
- package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +98 -21
- package/Tests/Utils/NetworkDiscovery/DiscoveryImportEligibility.test.ts +98 -20
- package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +8 -7
- package/Tests/Utils/NetworkDiscovery/PingMonitorBuilderForAddress.test.ts +274 -0
- package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +230 -51
- package/Tests/Utils/NetworkSite/TypeHierarchyUtil.test.ts +209 -0
- package/Tests/Utils/Telemetry/CaptureSpanExportGating.test.ts +145 -0
- package/Types/AI/ExceptionAIClassification.ts +10 -24
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/EnterpriseLicense/EnterpriseLicenseInstanceSummary.ts +5 -0
- package/Types/EnterpriseLicense/EnterpriseLicenseUsageSnapshot.ts +13 -0
- package/Types/EnterpriseLicense/EnterpriseLicenseUserCountSource.ts +6 -0
- package/Types/Exception/ApiException.ts +10 -0
- package/Types/Exception/BadDataException.ts +11 -0
- package/Types/Exception/BadRequestException.ts +11 -0
- package/Types/Exception/Exception.ts +65 -0
- package/Types/Exception/ForbiddenException.ts +10 -0
- package/Types/Exception/NotAuthenticatedException.ts +10 -0
- package/Types/Exception/NotAuthorizedException.ts +10 -0
- package/Types/Exception/NotFoundException.ts +11 -0
- package/Types/Exception/PayloadTooLargeException.ts +11 -0
- package/Types/Exception/PaymentRequiredException.ts +10 -0
- package/Types/Exception/ServiceUnavailableException.ts +10 -0
- package/Types/Exception/SsoAuthorizationException.ts +10 -0
- package/Types/Exception/TenantNotFoundException.ts +11 -0
- package/Types/Exception/TimeoutException.ts +10 -0
- package/Types/Exception/TooManyRequestsException.ts +10 -0
- package/Types/Exception/UnableToReachServer.ts +10 -0
- package/Types/Exception/WebsiteRequestException.ts +10 -0
- package/Types/Monitor/CriteriaFilter.ts +60 -2
- package/Types/Monitor/DatabaseMetricCatalog.ts +693 -0
- package/Types/Monitor/DatabaseMonitor/DatabaseMonitorResponse.ts +83 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +76 -0
- package/Types/Monitor/MonitorMetricType.ts +71 -0
- package/Types/Monitor/MonitorStep.ts +76 -0
- package/Types/Monitor/MonitorStepDatabaseMonitor.ts +171 -0
- package/Types/Monitor/MonitorStepSqlMonitor.ts +2 -20
- package/Types/Monitor/MonitorType.ts +47 -1
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +22 -1
- package/Types/Monitor/SqlConnectionConfig.ts +31 -0
- package/Types/NetworkDevice/NetworkAlertPolicyScope.ts +343 -0
- package/Types/NetworkDevice/NetworkDeviceMonitoringMethod.ts +42 -22
- package/Types/NetworkSite/DefaultNetworkSiteTypeHierarchy.ts +30 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.ts +255 -0
- package/Types/NotificationSetting/NotificationEmailRollupPolicy.ts +104 -0
- package/Types/Permission.ts +90 -0
- package/Types/Probe/ProbeMonitorResponse.ts +16 -0
- package/Types/Telemetry/ErrorClass.ts +274 -0
- package/Types/Telemetry/UnitOfWork.ts +59 -0
- package/UI/Components/CommandPalette/CommandPalette.tsx +2 -8
- package/UI/Components/EditionLabel/EditionLabel.tsx +4 -0
- package/UI/Components/Modal/Modal.tsx +2 -8
- package/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.ts +44 -0
- package/UI/Components/ProgressBar/ProgressBar.tsx +12 -1
- package/UI/Components/RadioButtons/BasicRadioButtons.tsx +37 -7
- package/UI/Components/SideMenu/SideMenu.tsx +123 -5
- package/UI/Components/SideMenu/SideMenuItem.tsx +76 -84
- package/UI/Components/SideMenu/SideMenuSection.tsx +55 -23
- package/UI/Components/SideOver/SideOver.tsx +21 -20
- package/UI/Utils/PageScrollLock.ts +79 -3
- package/UI/Utils/PermissionGate.ts +61 -0
- package/UI/Utils/SensitiveUrlToken.ts +112 -0
- package/UI/Utils/TestLLMProvider.ts +11 -0
- package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +16 -0
- package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +191 -11
- package/Utils/Monitor/MonitorMetricType.ts +153 -1
- package/Utils/Monitor/NetworkTopologyUtil.ts +23 -3
- package/Utils/NetworkDevice/DeviceHealthStateUtil.ts +65 -14
- package/Utils/NetworkDevice/DeviceReachabilityUtil.ts +43 -14
- package/Utils/NetworkDevice/NetworkAlertPolicyBootstrapUtil.ts +247 -0
- package/Utils/NetworkDevice/SnmpCredentialUtil.ts +68 -0
- package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +15 -7
- package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +52 -17
- package/Utils/NetworkDiscovery/DiscoveryImportEligibility.ts +55 -23
- package/Utils/NetworkDiscovery/PingMonitorBuilder.ts +115 -13
- package/Utils/NetworkSite/SiteStatusRollupUtil.ts +66 -20
- package/Utils/NetworkSite/TypeHierarchyUtil.ts +313 -0
- package/build/dist/Models/AnalyticsModels/Span.js +14 -0
- package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
- package/build/dist/Models/DatabaseModels/EnterpriseLicense.js +59 -0
- package/build/dist/Models/DatabaseModels/EnterpriseLicense.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +10 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +75 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkAlertPolicy.js +713 -0
- package/build/dist/Models/DatabaseModels/NetworkAlertPolicy.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +180 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkSite.js +200 -2
- package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js +102 -3
- package/build/dist/Models/DatabaseModels/NetworkSiteType.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkSnmpCredentialProfile.js +878 -0
- package/build/dist/Models/DatabaseModels/NetworkSnmpCredentialProfile.js.map +1 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js +123 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupBatch.js +363 -0
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupBatch.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupItem.js +402 -0
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupItem.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupSetting.js +296 -0
- package/build/dist/Models/DatabaseModels/UserNotificationEmailRollupSetting.js.map +1 -0
- package/build/dist/Server/API/EnterpriseLicenseAPI.js +273 -60
- package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +108 -13
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +12 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790700000000-AddNetworkSiteTypeParentHierarchy.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790700000000-AddNetworkSiteTypeParentHierarchy.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddEnterpriseLicenseUsageProvenance.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddEnterpriseLicenseUsageProvenance.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddTelemetryExceptionErrorClass.js +111 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1790900000000-AddTelemetryExceptionErrorClass.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791000000000-AddUserNotificationEmailRollup.js +77 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791000000000-AddUserNotificationEmailRollup.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791100000000-AddUserNotificationEmailRollupSetting.js +50 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791100000000-AddUserNotificationEmailRollupSetting.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791200000000-AddNetworkSnmpCredentialProfilesAndAlertPolicies.js +83 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791200000000-AddNetworkSnmpCredentialProfilesAndAlertPolicies.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/QueueWorker.js +33 -5
- package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
- package/build/dist/Server/Middleware/BearerTokenAuthorization.js +12 -0
- package/build/dist/Server/Middleware/BearerTokenAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +11 -0
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SCIMAuthorization.js +12 -0
- package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +11 -0
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AIBillingService.js +70 -16
- package/build/dist/Server/Services/AIBillingService.js.map +1 -1
- package/build/dist/Server/Services/EnterpriseLicenseInstanceService.js +167 -0
- package/build/dist/Server/Services/EnterpriseLicenseInstanceService.js.map +1 -1
- package/build/dist/Server/Services/EnterpriseLicenseService.js +39 -0
- package/build/dist/Server/Services/EnterpriseLicenseService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +10 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +119 -21
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +127 -8
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +162 -0
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/NetworkAlertPolicyEngineService.js +1683 -0
- package/build/dist/Server/Services/NetworkAlertPolicyEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkAlertPolicyService.js +732 -0
- package/build/dist/Server/Services/NetworkAlertPolicyService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +10 -9
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +54 -11
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +841 -70
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/NetworkSiteService.js +1145 -107
- package/build/dist/Server/Services/NetworkSiteService.js.map +1 -1
- package/build/dist/Server/Services/NetworkSiteTypeService.js +863 -0
- package/build/dist/Server/Services/NetworkSiteTypeService.js.map +1 -1
- package/build/dist/Server/Services/NetworkSnmpCredentialProfileService.js +217 -0
- package/build/dist/Server/Services/NetworkSnmpCredentialProfileService.js.map +1 -0
- package/build/dist/Server/Services/NotificationService.js +80 -17
- package/build/dist/Server/Services/NotificationService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +66 -30
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/StatusPagePrivateUserService.js +92 -2
- package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationEmailRollupBatchService.js +76 -0
- package/build/dist/Server/Services/UserNotificationEmailRollupBatchService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationEmailRollupItemService.js +77 -0
- package/build/dist/Server/Services/UserNotificationEmailRollupItemService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationEmailRollupSettingService.js +111 -0
- package/build/dist/Server/Services/UserNotificationEmailRollupSettingService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js +46 -20
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +90 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +14 -3
- package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js +10 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js +10 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js +54 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js +18 -4
- package/build/dist/Server/Utils/AI/Toolbox/AlertTools.js.map +1 -1
- package/build/dist/Server/Utils/Billing/BillingFailureNoticeThrottle.js +59 -0
- package/build/dist/Server/Utils/Billing/BillingFailureNoticeThrottle.js.map +1 -0
- package/build/dist/Server/Utils/DataSource/HttpFetch.js +2 -1
- package/build/dist/Server/Utils/DataSource/HttpFetch.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupConstants.js +91 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupConstants.js.map +1 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +691 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js +497 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js.map +1 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupWriter.js +257 -0
- package/build/dist/Server/Utils/EmailRollup/EmailRollupWriter.js.map +1 -0
- package/build/dist/Server/Utils/LLM/LLMService.js +64 -1
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/LogRedaction.js +8 -0
- package/build/dist/Server/Utils/LogRedaction.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +63 -1
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.js +141 -0
- package/build/dist/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js +8 -1
- package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +51 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaDataExtractor.js +7 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaDataExtractor.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +37 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +158 -6
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +33 -0
- package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +32 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +330 -21
- package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +55 -10
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +178 -49
- package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +119 -29
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/NetworkDevice/DeviceHealthAggregation.js +30 -17
- package/build/dist/Server/Utils/NetworkDevice/DeviceHealthAggregation.js.map +1 -1
- package/build/dist/Server/Utils/NetworkSite/NetworkSiteHierarchyLock.js +158 -0
- package/build/dist/Server/Utils/NetworkSite/NetworkSiteHierarchyLock.js.map +1 -0
- package/build/dist/Server/Utils/OutboundUserAgent.js +123 -0
- package/build/dist/Server/Utils/OutboundUserAgent.js.map +1 -0
- package/build/dist/Server/Utils/StartServer.js +38 -14
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/CaptureSpan.js +28 -8
- package/build/dist/Server/Utils/Telemetry/CaptureSpan.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ErrorClassResolver.js +95 -0
- package/build/dist/Server/Utils/Telemetry/ErrorClassResolver.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js +29 -0
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry.js +162 -46
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Types/AI/ExceptionAIClassification.js +10 -24
- package/build/dist/Types/AI/ExceptionAIClassification.js.map +1 -1
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicenseUsageSnapshot.js +2 -0
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicenseUsageSnapshot.js.map +1 -0
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicenseUserCountSource.js +7 -0
- package/build/dist/Types/EnterpriseLicense/EnterpriseLicenseUserCountSource.js.map +1 -0
- package/build/dist/Types/Exception/ApiException.js +9 -0
- package/build/dist/Types/Exception/ApiException.js.map +1 -1
- package/build/dist/Types/Exception/BadDataException.js +10 -0
- package/build/dist/Types/Exception/BadDataException.js.map +1 -1
- package/build/dist/Types/Exception/BadRequestException.js +10 -0
- package/build/dist/Types/Exception/BadRequestException.js.map +1 -1
- package/build/dist/Types/Exception/Exception.js +56 -0
- package/build/dist/Types/Exception/Exception.js.map +1 -1
- package/build/dist/Types/Exception/ForbiddenException.js +9 -0
- package/build/dist/Types/Exception/ForbiddenException.js.map +1 -1
- package/build/dist/Types/Exception/NotAuthenticatedException.js +9 -0
- package/build/dist/Types/Exception/NotAuthenticatedException.js.map +1 -1
- package/build/dist/Types/Exception/NotAuthorizedException.js +9 -0
- package/build/dist/Types/Exception/NotAuthorizedException.js.map +1 -1
- package/build/dist/Types/Exception/NotFoundException.js +10 -0
- package/build/dist/Types/Exception/NotFoundException.js.map +1 -1
- package/build/dist/Types/Exception/PayloadTooLargeException.js +10 -0
- package/build/dist/Types/Exception/PayloadTooLargeException.js.map +1 -1
- package/build/dist/Types/Exception/PaymentRequiredException.js +9 -0
- package/build/dist/Types/Exception/PaymentRequiredException.js.map +1 -1
- package/build/dist/Types/Exception/ServiceUnavailableException.js +9 -0
- package/build/dist/Types/Exception/ServiceUnavailableException.js.map +1 -1
- package/build/dist/Types/Exception/SsoAuthorizationException.js +9 -0
- package/build/dist/Types/Exception/SsoAuthorizationException.js.map +1 -1
- package/build/dist/Types/Exception/TenantNotFoundException.js +10 -0
- package/build/dist/Types/Exception/TenantNotFoundException.js.map +1 -1
- package/build/dist/Types/Exception/TimeoutException.js +9 -0
- package/build/dist/Types/Exception/TimeoutException.js.map +1 -1
- package/build/dist/Types/Exception/TooManyRequestsException.js +9 -0
- package/build/dist/Types/Exception/TooManyRequestsException.js.map +1 -1
- package/build/dist/Types/Exception/UnableToReachServer.js +9 -0
- package/build/dist/Types/Exception/UnableToReachServer.js.map +1 -1
- package/build/dist/Types/Exception/WebsiteRequestException.js +9 -0
- package/build/dist/Types/Exception/WebsiteRequestException.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +45 -2
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/DatabaseMetricCatalog.js +594 -0
- package/build/dist/Types/Monitor/DatabaseMetricCatalog.js.map +1 -0
- package/build/dist/Types/Monitor/DatabaseMonitor/DatabaseMonitorResponse.js +21 -0
- package/build/dist/Types/Monitor/DatabaseMonitor/DatabaseMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +70 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorMetricType.js +61 -0
- package/build/dist/Types/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +54 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepDatabaseMonitor.js +122 -0
- package/build/dist/Types/Monitor/MonitorStepDatabaseMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +45 -1
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +21 -1
- package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -1
- package/build/dist/Types/Monitor/SqlConnectionConfig.js +2 -0
- package/build/dist/Types/Monitor/SqlConnectionConfig.js.map +1 -0
- package/build/dist/Types/NetworkDevice/NetworkAlertPolicyScope.js +172 -0
- package/build/dist/Types/NetworkDevice/NetworkAlertPolicyScope.js.map +1 -0
- package/build/dist/Types/NetworkDevice/NetworkDeviceMonitoringMethod.js +40 -22
- package/build/dist/Types/NetworkDevice/NetworkDeviceMonitoringMethod.js.map +1 -1
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteTypeHierarchy.js +26 -0
- package/build/dist/Types/NetworkSite/DefaultNetworkSiteTypeHierarchy.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationEmailRollupCategory.js +186 -0
- package/build/dist/Types/NotificationSetting/NotificationEmailRollupCategory.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationEmailRollupPolicy.js +87 -0
- package/build/dist/Types/NotificationSetting/NotificationEmailRollupPolicy.js.map +1 -0
- package/build/dist/Types/Permission.js +80 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Telemetry/ErrorClass.js +216 -0
- package/build/dist/Types/Telemetry/ErrorClass.js.map +1 -0
- package/build/dist/Types/Telemetry/UnitOfWork.js +59 -0
- package/build/dist/Types/Telemetry/UnitOfWork.js.map +1 -0
- package/build/dist/UI/Components/CommandPalette/CommandPalette.js +2 -7
- package/build/dist/UI/Components/CommandPalette/CommandPalette.js.map +1 -1
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js +3 -0
- package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +2 -7
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js +39 -0
- package/build/dist/UI/Components/MonitorTemplateVariables/TemplateVariablesCatalog.js.map +1 -1
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js +12 -1
- package/build/dist/UI/Components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js +6 -6
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js +67 -5
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js +49 -53
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenuSection.js +25 -7
- package/build/dist/UI/Components/SideMenu/SideMenuSection.js.map +1 -1
- package/build/dist/UI/Components/SideOver/SideOver.js +5 -20
- package/build/dist/UI/Components/SideOver/SideOver.js.map +1 -1
- package/build/dist/UI/Utils/PageScrollLock.js +31 -3
- package/build/dist/UI/Utils/PageScrollLock.js.map +1 -1
- package/build/dist/UI/Utils/PermissionGate.js +42 -1
- package/build/dist/UI/Utils/PermissionGate.js.map +1 -1
- package/build/dist/UI/Utils/SensitiveUrlToken.js +97 -0
- package/build/dist/UI/Utils/SensitiveUrlToken.js.map +1 -0
- package/build/dist/UI/Utils/TestLLMProvider.js +4 -5
- package/build/dist/UI/Utils/TestLLMProvider.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +15 -0
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +1 -1
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +111 -9
- package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js +109 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +8 -3
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js +27 -7
- package/build/dist/Utils/NetworkDevice/DeviceHealthStateUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDevice/DeviceReachabilityUtil.js +7 -5
- package/build/dist/Utils/NetworkDevice/DeviceReachabilityUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDevice/NetworkAlertPolicyBootstrapUtil.js +180 -0
- package/build/dist/Utils/NetworkDevice/NetworkAlertPolicyBootstrapUtil.js.map +1 -0
- package/build/dist/Utils/NetworkDevice/SnmpCredentialUtil.js +12 -0
- package/build/dist/Utils/NetworkDevice/SnmpCredentialUtil.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js +15 -5
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +44 -15
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js +52 -23
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/PingMonitorBuilder.js +85 -13
- package/build/dist/Utils/NetworkDiscovery/PingMonitorBuilder.js.map +1 -1
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +30 -15
- package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -1
- package/build/dist/Utils/NetworkSite/TypeHierarchyUtil.js +191 -0
- package/build/dist/Utils/NetworkSite/TypeHierarchyUtil.js.map +1 -0
- package/package.json +2 -2
|
@@ -81,6 +81,24 @@ const SHIPPED_DUPLICATE_MIGRATIONS: ReadonlyArray<{
|
|
|
81
81
|
"AddUserTwoFactorBackupCode1789100000000",
|
|
82
82
|
],
|
|
83
83
|
},
|
|
84
|
+
/*
|
|
85
|
+
* And it happened again, the same way: these two were authored on separate
|
|
86
|
+
* branches, both reached for the next round slot, and both merged to master
|
|
87
|
+
* before either author saw the other. They are on master now, so the
|
|
88
|
+
* paragraph above applies to them unchanged — renaming either re-runs it,
|
|
89
|
+
* and AddTelemetryExceptionErrorClass adds NOT NULL columns whose re-run
|
|
90
|
+
* fails against a database that already has them.
|
|
91
|
+
*
|
|
92
|
+
* The recurrence is the argument for picking the next slot by looking at
|
|
93
|
+
* the directory immediately before committing, not when you start work.
|
|
94
|
+
*/
|
|
95
|
+
{
|
|
96
|
+
timestamp: 1790900000000,
|
|
97
|
+
classNames: [
|
|
98
|
+
"AddEnterpriseLicenseUsageProvenance1790900000000",
|
|
99
|
+
"AddTelemetryExceptionErrorClass1790900000000",
|
|
100
|
+
],
|
|
101
|
+
},
|
|
84
102
|
];
|
|
85
103
|
|
|
86
104
|
/*
|
package/Tests/Server/Infrastructure/Postgres/UserNotificationEmailRollupTableMigration.test.ts
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import { describe, expect, test } from "@jest/globals";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import SchemaMigrations from "../../../../Server/Infrastructure/Postgres/SchemaMigrations/Index";
|
|
5
|
+
import { AddUserNotificationEmailRollup1791000000000 } from "../../../../Server/Infrastructure/Postgres/SchemaMigrations/1791000000000-AddUserNotificationEmailRollup";
|
|
6
|
+
import UserNotificationEmailRollupBatch from "../../../../Models/DatabaseModels/UserNotificationEmailRollupBatch";
|
|
7
|
+
import UserNotificationEmailRollupItem from "../../../../Models/DatabaseModels/UserNotificationEmailRollupItem";
|
|
8
|
+
import Columns from "../../../../Types/Database/Columns";
|
|
9
|
+
import TableColumnType from "../../../../Types/Database/TableColumnType";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* The migration that creates the two tables behind owner email burst
|
|
13
|
+
* coalescing.
|
|
14
|
+
*
|
|
15
|
+
* The SQL is generated, and the schema-drift job already proves it matches the
|
|
16
|
+
* entities, so this file does not re-check TypeORM's spelling — that would only
|
|
17
|
+
* break on every unrelated regeneration. What it pins is the small set of
|
|
18
|
+
* decisions a regeneration would silently reverse, each of which is a
|
|
19
|
+
* correctness or data-loss change that no functional test would notice:
|
|
20
|
+
*
|
|
21
|
+
* 1. THE UNIQUE INDEX ON THE BATCH TABLE IS THE EXACTLY-ONCE MECHANISM.
|
|
22
|
+
* (projectId, userId, toEmail, claimEpochStartsAt) being UNIQUE is what
|
|
23
|
+
* stops two worker replicas both flushing the same recipient's queue and
|
|
24
|
+
* mailing them twice, and it is what makes "at most twelve rollups an hour"
|
|
25
|
+
* a database guarantee rather than an aspiration. A conditional UPDATE
|
|
26
|
+
* cannot replace it: DatabaseService._updateBy resolves its predicate in a
|
|
27
|
+
* separate find and then writes per row by _id, so it is check-then-act.
|
|
28
|
+
* Drop the UNIQUE and the feature still appears to work, right up until two
|
|
29
|
+
* replicas race.
|
|
30
|
+
*
|
|
31
|
+
* 2. EVERY projectId / userId FOREIGN KEY CASCADES. Queued mail about a
|
|
32
|
+
* deleted project, addressed to a deleted user, must go with them. SET NULL
|
|
33
|
+
* — the shape a hand adds by reflex, and what the audit-tail columns on
|
|
34
|
+
* most other models use — would leave orphan rows whose NOT NULL tenant
|
|
35
|
+
* column cannot be satisfied.
|
|
36
|
+
*
|
|
37
|
+
* 3. rollupBatchId HAS NO FOREIGN KEY AT ALL. It is a stamp, not a relation. A
|
|
38
|
+
* CASCADE would delete items when their batch is pruned at thirty days
|
|
39
|
+
* while the items are kept for seven; a SET NULL would un-stamp already
|
|
40
|
+
* sent items and re-send a month-old rollup to a real inbox.
|
|
41
|
+
*
|
|
42
|
+
* 4. sentAt IS NULLABLE WITH NO DEFAULT, because NULL means "still pending".
|
|
43
|
+
* That is what makes the tables correct on an upgraded install with no data
|
|
44
|
+
* migration and no backfill.
|
|
45
|
+
*
|
|
46
|
+
* 5. eventType IS varchar(500), NOT varchar(100). The stored
|
|
47
|
+
* NotificationSettingEventType values are English prose sentences; at 100
|
|
48
|
+
* characters DatabaseService.checkMaxLengthOfFields would throw, and on
|
|
49
|
+
* this code path that throw is swallowed by the write path's fail-open
|
|
50
|
+
* catch — so the symptom would be "the rollup silently never engages",
|
|
51
|
+
* which is exactly the kind of bug that ships.
|
|
52
|
+
*
|
|
53
|
+
* The registry-wide ordering guard lives in SchemaMigrationsOrdering.test.ts.
|
|
54
|
+
* What is asserted here is only this migration's own registration and its
|
|
55
|
+
* file/class pairing.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
const MIGRATION_FILE_NAME: string =
|
|
59
|
+
"1791000000000-AddUserNotificationEmailRollup.ts";
|
|
60
|
+
|
|
61
|
+
const MIGRATION_CLASS_NAME: string =
|
|
62
|
+
"AddUserNotificationEmailRollup1791000000000";
|
|
63
|
+
|
|
64
|
+
const MIGRATION_PATH: string = path.join(
|
|
65
|
+
__dirname,
|
|
66
|
+
`../../../../Server/Infrastructure/Postgres/SchemaMigrations/${MIGRATION_FILE_NAME}`,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const SOURCE: string = fs.readFileSync(MIGRATION_PATH, "utf8");
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* The SQL is split into the two halves before anything is asserted about
|
|
73
|
+
* ordering, because "created then dropped" only means something if the drop
|
|
74
|
+
* really is in down() rather than a second statement in up().
|
|
75
|
+
*/
|
|
76
|
+
function bodyOf(method: "up" | "down"): string {
|
|
77
|
+
const start: number = SOURCE.indexOf(`public async ${method}(`);
|
|
78
|
+
|
|
79
|
+
expect(start).toBeGreaterThan(-1);
|
|
80
|
+
|
|
81
|
+
const end: number =
|
|
82
|
+
method === "up" ? SOURCE.indexOf("public async down(") : SOURCE.length;
|
|
83
|
+
|
|
84
|
+
return SOURCE.slice(start, end);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const UP: string = bodyOf("up");
|
|
88
|
+
const DOWN: string = bodyOf("down");
|
|
89
|
+
|
|
90
|
+
function statementsIn(body: string): Array<string> {
|
|
91
|
+
return [...body.matchAll(/`([^`]+)`/g)].map(
|
|
92
|
+
(match: RegExpMatchArray): string => {
|
|
93
|
+
return match[1] as string;
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const UP_STATEMENTS: Array<string> = statementsIn(UP);
|
|
99
|
+
const DOWN_STATEMENTS: Array<string> = statementsIn(DOWN);
|
|
100
|
+
|
|
101
|
+
function createTableStatement(tableName: string): string {
|
|
102
|
+
const statement: string | undefined = UP_STATEMENTS.find(
|
|
103
|
+
(candidate: string): boolean => {
|
|
104
|
+
return candidate.startsWith(`CREATE TABLE "${tableName}"`);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
expect(statement).toBeDefined();
|
|
109
|
+
|
|
110
|
+
return statement as string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* The column definitions out of a CREATE TABLE, keyed by column name and with
|
|
115
|
+
* the definition kept verbatim so NOT NULL and DEFAULT can both be read off it.
|
|
116
|
+
* The split is on a comma followed by a quoted name or by CONSTRAINT, which is
|
|
117
|
+
* every separator in a generated CREATE TABLE and none of the commas that could
|
|
118
|
+
* appear inside one definition.
|
|
119
|
+
*/
|
|
120
|
+
function columnDefinitions(createTableSql: string): Map<string, string> {
|
|
121
|
+
const body: string = createTableSql.slice(
|
|
122
|
+
createTableSql.indexOf("(") + 1,
|
|
123
|
+
createTableSql.lastIndexOf(")"),
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const definitions: Map<string, string> = new Map<string, string>();
|
|
127
|
+
|
|
128
|
+
for (const part of body.split(/,\s(?=(?:"|CONSTRAINT\s))/)) {
|
|
129
|
+
const match: RegExpMatchArray | null = part.match(/^"(\w+)"\s([\s\S]+)$/);
|
|
130
|
+
|
|
131
|
+
if (match) {
|
|
132
|
+
definitions.set(match[1] as string, match[2] as string);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return definitions;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const ITEM_COLUMNS: Map<string, string> = columnDefinitions(
|
|
140
|
+
createTableStatement("UserNotificationEmailRollupItem"),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const BATCH_COLUMNS: Map<string, string> = columnDefinitions(
|
|
144
|
+
createTableStatement("UserNotificationEmailRollupBatch"),
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
function definitionOf(
|
|
148
|
+
columns: Map<string, string>,
|
|
149
|
+
columnName: string,
|
|
150
|
+
): string {
|
|
151
|
+
const definition: string | undefined = columns.get(columnName);
|
|
152
|
+
|
|
153
|
+
expect(definition).toBeDefined();
|
|
154
|
+
|
|
155
|
+
return definition as string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function persistedColumnsOf(
|
|
159
|
+
model: UserNotificationEmailRollupItem | UserNotificationEmailRollupBatch,
|
|
160
|
+
): Array<string> {
|
|
161
|
+
const declared: Columns = model.getTableColumns();
|
|
162
|
+
|
|
163
|
+
return declared.columns.filter((columnName: string): boolean => {
|
|
164
|
+
const type: TableColumnType = model.getTableColumnMetadata(columnName).type;
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
type !== TableColumnType.Entity && type !== TableColumnType.EntityArray
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
describe("registration", () => {
|
|
173
|
+
/*
|
|
174
|
+
* An imported-but-unappended migration is exactly as inert as an unimported
|
|
175
|
+
* one, and the failure mode is silent: the app boots, the tables are simply
|
|
176
|
+
* missing, and the first rollup insert fails into the fail-open catch. The
|
|
177
|
+
* exported array is the only thing the runner reads, so it is the only thing
|
|
178
|
+
* worth asserting.
|
|
179
|
+
*/
|
|
180
|
+
test("the migration is in the exported array, not merely imported", () => {
|
|
181
|
+
/*
|
|
182
|
+
* Membership, not position. It was the last entry when it landed and is
|
|
183
|
+
* not any more, because the rollup escape hatch added one after it — and
|
|
184
|
+
* "is it last" is not this file's property to assert in the first place:
|
|
185
|
+
* SchemaMigrationsOrdering.test.ts owns the registry-wide ordering rules
|
|
186
|
+
* for every migration at once. What matters here is only that this one
|
|
187
|
+
* runs at all, which the exported array decides and the imports do not.
|
|
188
|
+
*/
|
|
189
|
+
expect(SchemaMigrations).toContain(
|
|
190
|
+
AddUserNotificationEmailRollup1791000000000,
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* TypeORM records an applied migration by the value of its `name` field, not
|
|
196
|
+
* by its file name or its class name. If the three ever disagree, the
|
|
197
|
+
* migration re-runs on an already-migrated database and the CREATE TABLE
|
|
198
|
+
* fails the deploy.
|
|
199
|
+
*/
|
|
200
|
+
test("the file name, class name and name field all agree", () => {
|
|
201
|
+
expect(AddUserNotificationEmailRollup1791000000000.name).toBe(
|
|
202
|
+
MIGRATION_CLASS_NAME,
|
|
203
|
+
);
|
|
204
|
+
expect(SOURCE).toContain(
|
|
205
|
+
`public name: string = "${MIGRATION_CLASS_NAME}";`,
|
|
206
|
+
);
|
|
207
|
+
expect(MIGRATION_FILE_NAME).toBe(
|
|
208
|
+
`${MIGRATION_CLASS_NAME.replace(
|
|
209
|
+
"AddUserNotificationEmailRollup",
|
|
210
|
+
"",
|
|
211
|
+
)}-AddUserNotificationEmailRollup.ts`,
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe("the queue table it creates", () => {
|
|
217
|
+
/*
|
|
218
|
+
* Written out as a literal rather than derived from the model, so that adding
|
|
219
|
+
* a column to the entity without a migration for it fails here rather than
|
|
220
|
+
* passing because both sides moved together.
|
|
221
|
+
*/
|
|
222
|
+
test("it declares exactly the columns a queued notification is made of", () => {
|
|
223
|
+
expect([...ITEM_COLUMNS.keys()].sort()).toEqual([
|
|
224
|
+
"_id",
|
|
225
|
+
"createdAt",
|
|
226
|
+
"deletedAt",
|
|
227
|
+
"eventType",
|
|
228
|
+
"projectId",
|
|
229
|
+
"rollupBatchId",
|
|
230
|
+
"rollupCategory",
|
|
231
|
+
"sentAt",
|
|
232
|
+
"subject",
|
|
233
|
+
"toEmail",
|
|
234
|
+
"updatedAt",
|
|
235
|
+
"userId",
|
|
236
|
+
"version",
|
|
237
|
+
"viewLink",
|
|
238
|
+
]);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
* ...and the other direction. A column the entity persists but the table has
|
|
243
|
+
* no room for is a runtime error on the first insert, not a compile error, so
|
|
244
|
+
* the model is the authority the SQL is held to.
|
|
245
|
+
*/
|
|
246
|
+
test("every column the model persists exists in the table", () => {
|
|
247
|
+
const persisted: Array<string> = persistedColumnsOf(
|
|
248
|
+
new UserNotificationEmailRollupItem(),
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
expect(persisted.length).toBeGreaterThan(0);
|
|
252
|
+
|
|
253
|
+
for (const columnName of persisted) {
|
|
254
|
+
expect(ITEM_COLUMNS.has(columnName)).toBe(true);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
* The bucket key plus the two fields the rollup email is rendered from. A row
|
|
260
|
+
* missing any of these cannot be counted, cannot be grouped and cannot be
|
|
261
|
+
* turned into a line in an email, so none of them may be nullable.
|
|
262
|
+
*/
|
|
263
|
+
test("the bucket key and the renderable fields are all required", () => {
|
|
264
|
+
for (const columnName of [
|
|
265
|
+
"projectId",
|
|
266
|
+
"userId",
|
|
267
|
+
"toEmail",
|
|
268
|
+
"eventType",
|
|
269
|
+
"rollupCategory",
|
|
270
|
+
"subject",
|
|
271
|
+
]) {
|
|
272
|
+
expect(definitionOf(ITEM_COLUMNS, columnName)).toContain("NOT NULL");
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
/*
|
|
277
|
+
* sentAt NULL means "still pending" and viewLink NULL means "this producer
|
|
278
|
+
* set no link var we recognise". Both are correct states, both are the state
|
|
279
|
+
* of a row on the day the table is created, and that is precisely why this
|
|
280
|
+
* migration needs no backfill. A DEFAULT on sentAt would mark every queued
|
|
281
|
+
* row as already delivered.
|
|
282
|
+
*/
|
|
283
|
+
test("sentAt, rollupBatchId and viewLink are nullable with no default", () => {
|
|
284
|
+
for (const columnName of ["sentAt", "rollupBatchId", "viewLink"]) {
|
|
285
|
+
const definition: string = definitionOf(ITEM_COLUMNS, columnName);
|
|
286
|
+
|
|
287
|
+
expect(definition).not.toContain("NOT NULL");
|
|
288
|
+
expect(definition).not.toContain("DEFAULT");
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
/*
|
|
293
|
+
* See note 5 at the top. At varchar(100) the length check throws, the throw
|
|
294
|
+
* is swallowed by the write path's fail-open catch, and the rollup silently
|
|
295
|
+
* never engages while every email still gets delivered — a bug with no
|
|
296
|
+
* symptom other than the feature not existing.
|
|
297
|
+
*/
|
|
298
|
+
test("eventType has room for the prose sentences it stores", () => {
|
|
299
|
+
expect(definitionOf(ITEM_COLUMNS, "eventType")).toContain(
|
|
300
|
+
"character varying(500)",
|
|
301
|
+
);
|
|
302
|
+
expect(definitionOf(ITEM_COLUMNS, "eventType")).not.toContain(
|
|
303
|
+
"character varying(100)",
|
|
304
|
+
);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
/*
|
|
308
|
+
* The burst counter reads (projectId, userId, toEmail, rollupCategory) over a
|
|
309
|
+
* ten-minute createdAt window on the hot path of every owner notification,
|
|
310
|
+
* and the sweep reads pending rows oldest-first. Without these two composite
|
|
311
|
+
* indexes both degrade to sequential scans of a table that holds a week of
|
|
312
|
+
* every owner email the install sends.
|
|
313
|
+
*/
|
|
314
|
+
test("it indexes the burst counter and the pending sweep", () => {
|
|
315
|
+
const indexes: Array<string> = UP_STATEMENTS.filter(
|
|
316
|
+
(statement: string): boolean => {
|
|
317
|
+
return statement.includes('ON "UserNotificationEmailRollupItem"');
|
|
318
|
+
},
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
expect(
|
|
322
|
+
indexes.some((statement: string): boolean => {
|
|
323
|
+
return statement.includes(
|
|
324
|
+
'("projectId", "userId", "toEmail", "rollupCategory", "createdAt")',
|
|
325
|
+
);
|
|
326
|
+
}),
|
|
327
|
+
).toBe(true);
|
|
328
|
+
|
|
329
|
+
expect(
|
|
330
|
+
indexes.some((statement: string): boolean => {
|
|
331
|
+
return statement.includes('("sentAt", "createdAt")');
|
|
332
|
+
}),
|
|
333
|
+
).toBe(true);
|
|
334
|
+
|
|
335
|
+
expect(
|
|
336
|
+
indexes.some((statement: string): boolean => {
|
|
337
|
+
return statement.includes('("rollupBatchId")');
|
|
338
|
+
}),
|
|
339
|
+
).toBe(true);
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
describe("the batch ledger it creates", () => {
|
|
344
|
+
test("it declares exactly the columns a flush attempt is made of", () => {
|
|
345
|
+
expect([...BATCH_COLUMNS.keys()].sort()).toEqual([
|
|
346
|
+
"_id",
|
|
347
|
+
"claimEpochStartsAt",
|
|
348
|
+
"claimedAt",
|
|
349
|
+
"createdAt",
|
|
350
|
+
"deletedAt",
|
|
351
|
+
"itemCount",
|
|
352
|
+
"projectId",
|
|
353
|
+
"sentAt",
|
|
354
|
+
"status",
|
|
355
|
+
"statusMessage",
|
|
356
|
+
"toEmail",
|
|
357
|
+
"updatedAt",
|
|
358
|
+
"userId",
|
|
359
|
+
"version",
|
|
360
|
+
]);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
test("every column the model persists exists in the table", () => {
|
|
364
|
+
const persisted: Array<string> = persistedColumnsOf(
|
|
365
|
+
new UserNotificationEmailRollupBatch(),
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
expect(persisted.length).toBeGreaterThan(0);
|
|
369
|
+
|
|
370
|
+
for (const columnName of persisted) {
|
|
371
|
+
expect(BATCH_COLUMNS.has(columnName)).toBe(true);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
/*
|
|
376
|
+
* See note 1 at the top. This is the single most important assertion in the
|
|
377
|
+
* file: without UNIQUE, two replicas both insert a claim and the recipient
|
|
378
|
+
* gets two copies of the same rollup.
|
|
379
|
+
*/
|
|
380
|
+
test("the claim index is UNIQUE over the full four-column key", () => {
|
|
381
|
+
const claimIndex: string | undefined = UP_STATEMENTS.find(
|
|
382
|
+
(statement: string): boolean => {
|
|
383
|
+
return (
|
|
384
|
+
statement.includes('ON "UserNotificationEmailRollupBatch"') &&
|
|
385
|
+
statement.includes('"claimEpochStartsAt"')
|
|
386
|
+
);
|
|
387
|
+
},
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
expect(claimIndex).toBeDefined();
|
|
391
|
+
expect(claimIndex as string).toContain("CREATE UNIQUE INDEX");
|
|
392
|
+
expect(claimIndex as string).toContain(
|
|
393
|
+
'("projectId", "userId", "toEmail", "claimEpochStartsAt")',
|
|
394
|
+
);
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
test("the claim fields and the status are all required", () => {
|
|
398
|
+
for (const columnName of [
|
|
399
|
+
"projectId",
|
|
400
|
+
"userId",
|
|
401
|
+
"toEmail",
|
|
402
|
+
"claimEpochStartsAt",
|
|
403
|
+
"claimedAt",
|
|
404
|
+
"status",
|
|
405
|
+
]) {
|
|
406
|
+
expect(definitionOf(BATCH_COLUMNS, columnName)).toContain("NOT NULL");
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
/*
|
|
411
|
+
* A batch row exists from the moment it is claimed, before anything is known
|
|
412
|
+
* about how many items it will carry or whether the send will succeed. All
|
|
413
|
+
* three of these are written later, or never.
|
|
414
|
+
*/
|
|
415
|
+
test("sentAt, itemCount and statusMessage are nullable with no default", () => {
|
|
416
|
+
for (const columnName of ["sentAt", "itemCount", "statusMessage"]) {
|
|
417
|
+
const definition: string = definitionOf(BATCH_COLUMNS, columnName);
|
|
418
|
+
|
|
419
|
+
expect(definition).not.toContain("NOT NULL");
|
|
420
|
+
expect(definition).not.toContain("DEFAULT");
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
describe("foreign keys", () => {
|
|
426
|
+
/*
|
|
427
|
+
* See note 2. Four keys, all cascading; the reflex alternative leaves orphan
|
|
428
|
+
* rows whose NOT NULL tenant column cannot be satisfied.
|
|
429
|
+
*/
|
|
430
|
+
test("every tenant and recipient key cascades", () => {
|
|
431
|
+
const foreignKeys: Array<string> = UP_STATEMENTS.filter(
|
|
432
|
+
(statement: string): boolean => {
|
|
433
|
+
return (
|
|
434
|
+
statement.includes("ADD CONSTRAINT") &&
|
|
435
|
+
statement.includes("FOREIGN KEY")
|
|
436
|
+
);
|
|
437
|
+
},
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
expect(foreignKeys).toHaveLength(4);
|
|
441
|
+
|
|
442
|
+
for (const statement of foreignKeys) {
|
|
443
|
+
expect(statement).toContain("ON DELETE CASCADE");
|
|
444
|
+
expect(statement).not.toContain("ON DELETE SET NULL");
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
for (const table of [
|
|
448
|
+
"UserNotificationEmailRollupItem",
|
|
449
|
+
"UserNotificationEmailRollupBatch",
|
|
450
|
+
]) {
|
|
451
|
+
for (const column of ["projectId", "userId"]) {
|
|
452
|
+
expect(
|
|
453
|
+
foreignKeys.some((statement: string): boolean => {
|
|
454
|
+
return (
|
|
455
|
+
statement.includes(`ALTER TABLE "${table}"`) &&
|
|
456
|
+
statement.includes(`FOREIGN KEY ("${column}")`)
|
|
457
|
+
);
|
|
458
|
+
}),
|
|
459
|
+
).toBe(true);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
/*
|
|
465
|
+
* See note 3. rollupBatchId is indexed so the flush can read back exactly the
|
|
466
|
+
* rows it stamped, but it is deliberately not a relation — neither CASCADE
|
|
467
|
+
* nor SET NULL has an acceptable meaning once batch rows start being pruned
|
|
468
|
+
* ahead of the items they explain.
|
|
469
|
+
*/
|
|
470
|
+
test("rollupBatchId is a bare stamp with no foreign key", () => {
|
|
471
|
+
for (const statement of UP_STATEMENTS) {
|
|
472
|
+
if (statement.includes("FOREIGN KEY")) {
|
|
473
|
+
expect(statement).not.toContain('"rollupBatchId"');
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
describe("down()", () => {
|
|
480
|
+
/*
|
|
481
|
+
* A migration that cannot be rolled back is a migration nobody dares deploy
|
|
482
|
+
* on a Friday. Reverse order matters: dropping a table before the constraint
|
|
483
|
+
* that references it fails, and leaving an index behind makes the re-run of
|
|
484
|
+
* up() fail on a name collision.
|
|
485
|
+
*/
|
|
486
|
+
test("it undoes everything up() created, in reverse", () => {
|
|
487
|
+
const created: Array<string> = UP_STATEMENTS.filter(
|
|
488
|
+
(statement: string): boolean => {
|
|
489
|
+
return (
|
|
490
|
+
statement.startsWith("CREATE TABLE") ||
|
|
491
|
+
statement.startsWith("CREATE INDEX") ||
|
|
492
|
+
statement.startsWith("CREATE UNIQUE INDEX") ||
|
|
493
|
+
statement.includes("ADD CONSTRAINT")
|
|
494
|
+
);
|
|
495
|
+
},
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
const dropped: Array<string> = DOWN_STATEMENTS.filter(
|
|
499
|
+
(statement: string): boolean => {
|
|
500
|
+
return (
|
|
501
|
+
statement.startsWith("DROP TABLE") ||
|
|
502
|
+
statement.startsWith("DROP INDEX") ||
|
|
503
|
+
statement.includes("DROP CONSTRAINT")
|
|
504
|
+
);
|
|
505
|
+
},
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
expect(dropped).toHaveLength(created.length);
|
|
509
|
+
|
|
510
|
+
function nameIn(statement: string): string {
|
|
511
|
+
const quoted: Array<string> = [
|
|
512
|
+
...statement.matchAll(/"([A-Za-z0-9_.]+)"/g),
|
|
513
|
+
].map((match: RegExpMatchArray): string => {
|
|
514
|
+
return match[1] as string;
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
/*
|
|
518
|
+
* Every statement of interest names the object it acts on either first
|
|
519
|
+
* (CREATE TABLE "X", CREATE INDEX "IDX_x", DROP TABLE "X") or, for the
|
|
520
|
+
* constraint pair, second after the table (ALTER TABLE "X" ADD/DROP
|
|
521
|
+
* CONSTRAINT "FK_x"). Taking the FK/IDX/table name is enough to pair them
|
|
522
|
+
* without re-parsing the SQL.
|
|
523
|
+
*/
|
|
524
|
+
const constraintOrIndex: string | undefined = quoted.find(
|
|
525
|
+
(candidate: string): boolean => {
|
|
526
|
+
return candidate.startsWith("FK_") || candidate.startsWith("IDX_");
|
|
527
|
+
},
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
return constraintOrIndex ?? (quoted[0] as string);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
expect(dropped.map(nameIn)).toEqual([...created].reverse().map(nameIn));
|
|
534
|
+
});
|
|
535
|
+
});
|