@oneuptime/common 14.0.109 → 14.1.0
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/SecurityEvent.js +1 -1
- package/Models/DatabaseModels/AIInsight.js +2 -2
- package/Models/DatabaseModels/AIRunRecording.d.mts +12 -0
- package/Models/DatabaseModels/AIRunRecording.d.ts +12 -0
- package/Models/DatabaseModels/AIRunRecording.js +181 -0
- package/Models/DatabaseModels/AIRunRecording.mjs +2 -0
- package/Models/DatabaseModels/Alert.js +20 -4
- package/Models/DatabaseModels/AlertEpisode.js +2 -2
- package/Models/DatabaseModels/AlertEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.js +48 -2
- package/Models/DatabaseModels/AlertOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertSeverity.js +13 -4
- package/Models/DatabaseModels/AlertState.js +1 -1
- package/Models/DatabaseModels/CallLog.js +12 -12
- package/Models/DatabaseModels/DataStore.js +9 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.mts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.ts +2 -0
- package/Models/DatabaseModels/EmailLog.js +14 -14
- package/Models/DatabaseModels/Form.js +3 -3
- package/Models/DatabaseModels/FormSubmission.js +6 -6
- package/Models/DatabaseModels/GlobalConfig.d.mts +1 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +1 -0
- package/Models/DatabaseModels/GlobalConfig.js +74 -45
- package/Models/DatabaseModels/Incident.js +20 -4
- package/Models/DatabaseModels/IncidentEpisode.js +2 -2
- package/Models/DatabaseModels/IncidentEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.js +48 -2
- package/Models/DatabaseModels/IncidentOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentSeverity.js +13 -4
- package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/IncidentState.js +1 -1
- package/Models/DatabaseModels/IncidentTemplate.js +2 -2
- package/Models/DatabaseModels/Index.js +4 -0
- package/Models/DatabaseModels/InventoryItem.js +11 -0
- package/Models/DatabaseModels/Monitor.js +54 -20
- package/Models/DatabaseModels/MonitorNetworkDevice.d.mts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.d.ts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.js +189 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.mjs +2 -0
- package/Models/DatabaseModels/MonitorProbe.js +22 -5
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +64 -7
- package/Models/DatabaseModels/NetworkEndpoint.d.mts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.d.ts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.js +39 -7
- package/Models/DatabaseModels/NetworkInterface.js +5 -5
- package/Models/DatabaseModels/OnCallDutyPolicy.js +4 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRule.js +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleSchedule.js +8 -5
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleTeam.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleUser.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +28 -11
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +10 -7
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +16 -11
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerTeam.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerUser.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.js +6 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +4 -4
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +3 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -6
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +9 -6
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
- package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
- package/Models/DatabaseModels/Project.d.mts +3 -0
- package/Models/DatabaseModels/Project.d.ts +3 -0
- package/Models/DatabaseModels/Project.js +142 -5
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
- package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.mts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.ts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.js +52 -3
- package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
- package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
- package/Models/DatabaseModels/PushNotificationLog.js +12 -12
- package/Models/DatabaseModels/Reseller.js +8 -2
- package/Models/DatabaseModels/ResellerPlan.js +8 -2
- package/Models/DatabaseModels/RunbookExecution.js +2 -2
- package/Models/DatabaseModels/RunbookRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenance.js +9 -6
- package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerTeam.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerUser.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +10 -7
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
- package/Models/DatabaseModels/Service.js +1 -1
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +4 -4
- package/Models/DatabaseModels/ServiceLevelObjectiveErrorBudgetPolicyTier.js +4 -4
- package/Models/DatabaseModels/SmsLog.js +12 -12
- package/Models/DatabaseModels/StatusPage.js +5 -5
- package/Models/DatabaseModels/StatusPageSubscriber.js +2 -2
- package/Models/DatabaseModels/TeamMember.js +10 -1
- package/Models/DatabaseModels/TelegramLog.js +12 -12
- package/Models/DatabaseModels/TelemetryIngestionKey.js +8 -5
- package/Models/DatabaseModels/TelemetryIngestionKeyRefusal.js +7 -4
- package/Models/DatabaseModels/User.d.mts +4 -0
- package/Models/DatabaseModels/User.d.ts +4 -0
- package/Models/DatabaseModels/User.js +100 -0
- package/Models/DatabaseModels/UserOnCallLog.js +6 -6
- package/Models/DatabaseModels/UserOnCallLogTimeline.js +3 -3
- package/Models/DatabaseModels/UserOnCallShiftReminderLog.js +2 -2
- package/Models/DatabaseModels/WebhookLog.js +12 -12
- package/Models/DatabaseModels/WhatsAppLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationRule.js +36 -1
- package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
- package/Models/DatabaseModels/WorkspacePublicNoteApprovalMessage.js +3 -3
- package/Server/Services/DatabaseService.d.mts +4 -1
- package/Server/Services/DatabaseService.d.ts +4 -1
- package/Server/Types/Database/CountBy.d.mts +1 -0
- package/Server/Types/Database/CountBy.d.ts +1 -0
- package/Server/Types/Database/UpdateLimit.d.mts +6 -0
- package/Server/Types/Database/UpdateLimit.d.ts +6 -0
- package/Types/AI/AIActionWords.d.mts +25 -1
- package/Types/AI/AIActionWords.d.ts +25 -1
- package/Types/AI/AIActionWords.js +166 -3
- package/Types/AI/AIActionWords.mjs +6 -0
- package/Types/AI/AIChatTypes.d.mts +4 -2
- package/Types/AI/AIChatTypes.d.ts +4 -2
- package/Types/AI/AIChatTypes.js +5 -0
- package/Types/AI/AiOutcomes.d.mts +57 -0
- package/Types/AI/AiOutcomes.d.ts +57 -0
- package/Types/AI/AiOutcomes.js +67 -0
- package/Types/AI/AiOutcomes.mjs +10 -0
- package/Types/AI/AiRunRefusal.d.mts +45 -0
- package/Types/AI/AiRunRefusal.d.ts +45 -0
- package/Types/AI/AiRunRefusal.js +187 -0
- package/Types/AI/AiRunRefusal.mjs +12 -0
- package/Types/AI/InvestigationRecording.d.mts +46 -0
- package/Types/AI/InvestigationRecording.d.ts +46 -0
- package/Types/AI/InvestigationRecording.js +42 -0
- package/Types/AI/InvestigationRecording.mjs +7 -0
- package/Types/API/HTTPResponse.d.mts +3 -0
- package/Types/API/HTTPResponse.d.ts +3 -0
- package/Types/API/HTTPResponse.js +15 -0
- package/Types/Analytics/ProductEvent.d.mts +6 -1
- package/Types/Analytics/ProductEvent.d.ts +6 -1
- package/Types/Analytics/ProductEvent.js +41 -0
- package/Types/AuditLog/AuditLogCoverage.d.mts +1 -0
- package/Types/AuditLog/AuditLogCoverage.d.ts +1 -0
- package/Types/AuditLog/AuditLogCoverage.js +4 -2
- package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
- package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.js +92 -2
- package/Types/BaseDatabase/ListResult.d.mts +1 -0
- package/Types/BaseDatabase/ListResult.d.ts +1 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.mts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.ts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.js +282 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.mjs +7 -0
- package/Types/Cloud/CloudResourceCatalog.d.mts +2 -0
- package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
- package/Types/Cloud/CloudResourceCatalog.js +33 -3
- package/Types/Cloud/CloudResourceCatalog.mjs +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.mts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.ts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.js +21 -0
- package/Types/Dashboard/DashboardAutoRefresh.mjs +1 -0
- package/Types/DataObservability/DataCheckSuggestions.d.mts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.d.ts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.js +102 -65
- package/Types/DataObservability/DataCheckSuggestions.mjs +1 -0
- package/Types/Database/TableMetadata.d.mts +2 -0
- package/Types/Database/TableMetadata.d.ts +2 -0
- package/Types/Database/TableMetadata.js +6 -0
- package/Types/Date.d.mts +26 -2
- package/Types/Date.d.ts +26 -2
- package/Types/Date.js +81 -9
- package/Types/Date.mjs +1 -0
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +44 -2
- package/Types/DateLanguage.mjs +2 -0
- package/Types/DirectionArrow.d.mts +7 -0
- package/Types/DirectionArrow.d.ts +7 -0
- package/Types/DirectionArrow.js +88 -0
- package/Types/DirectionArrow.mjs +7 -0
- package/Types/Docs/GlossaryTerm.d.mts +1 -0
- package/Types/Docs/GlossaryTerm.d.ts +1 -0
- package/Types/Docs/GlossaryTerm.js +2 -0
- package/Types/Docs/RetiredNames.d.mts +11 -0
- package/Types/Docs/RetiredNames.d.ts +11 -0
- package/Types/Docs/RetiredNames.js +139 -0
- package/Types/Docs/RetiredNames.mjs +3 -0
- package/Types/Email/ServerEmailEnvironment.d.mts +85 -0
- package/Types/Email/ServerEmailEnvironment.d.ts +85 -0
- package/Types/Email/ServerEmailEnvironment.js +793 -0
- package/Types/Email/ServerEmailEnvironment.mjs +14 -0
- package/Types/Exception/AiRunRefusalException.d.mts +6 -0
- package/Types/Exception/AiRunRefusalException.d.ts +6 -0
- package/Types/Exception/AiRunRefusalException.js +23 -0
- package/Types/Exception/AiRunRefusalException.mjs +2 -0
- package/Types/Exception/RefusalWithValues.d.mts +7 -0
- package/Types/Exception/RefusalWithValues.d.ts +7 -0
- package/Types/Exception/RefusalWithValues.js +76 -0
- package/Types/Exception/RefusalWithValues.mjs +3 -0
- package/Types/Exception/UnexplainedError.d.mts +13 -0
- package/Types/Exception/UnexplainedError.d.ts +13 -0
- package/Types/Exception/UnexplainedError.js +53 -1
- package/Types/Exception/UnexplainedError.mjs +1 -0
- package/Types/File/FileSize.d.mts +4 -1
- package/Types/File/FileSize.d.ts +4 -1
- package/Types/File/FileSize.js +18 -17
- package/Types/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- package/Types/HostCollector/HostCollector.d.mts +1 -0
- package/Types/HostCollector/HostCollector.d.ts +1 -0
- package/Types/HostCollector/HostCollector.js +26 -10
- package/Types/HostCollector/HostCollector.mjs +1 -0
- package/Types/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -0
- package/Types/Monitor/MonitorCriteria.js +2 -2
- package/Types/Monitor/MonitorCriteriaInstance.js +9 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.mts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.ts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.js +36 -0
- package/Types/Monitor/MonitorNotCheckedReason.mjs +4 -0
- package/Types/Monitor/MonitorStep.js +1 -1
- package/Types/Monitor/MonitorTemplateSyncField.d.mts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.d.ts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.js +106 -64
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.mts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.ts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.js +11 -3
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.mts +6 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.ts +6 -0
- package/Types/Monitor/UptimeHistoryLabels.js +2 -2
- package/Types/Monitor/WhoIsTold.d.mts +3 -1
- package/Types/Monitor/WhoIsTold.d.ts +3 -1
- package/Types/Monitor/WhoIsTold.js +2 -1
- package/Types/NotificationRule/PagingLadder.d.mts +137 -0
- package/Types/NotificationRule/PagingLadder.d.ts +137 -0
- package/Types/NotificationRule/PagingLadder.js +682 -0
- package/Types/NotificationRule/PagingLadder.mjs +28 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +1 -1
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.mts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.ts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.js +12 -9
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +24 -6
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.mts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.ts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.js +136 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.mjs +18 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.mts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.ts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.mts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.ts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.js +38 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.mjs +3 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +96 -5
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.mts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.ts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.js +222 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.mjs +6 -0
- package/Types/OnCallDutyPolicy/ScheduleLayerDefaults.js +5 -2
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.mts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.ts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.js +512 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.mjs +7 -0
- package/Types/OnCallDutyPolicy/UserOverrideCoverRequest.js +9 -1
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.mts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.ts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.js +105 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.mjs +6 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.mts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.ts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.js +237 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.mjs +14 -0
- package/Types/Permission.d.mts +2 -2
- package/Types/Permission.d.ts +2 -2
- package/Types/Permission.js +196 -195
- package/Types/Probe/ProbeCapability.d.mts +2 -1
- package/Types/Probe/ProbeCapability.d.ts +2 -1
- package/Types/Probe/ProbeCapability.js +10 -0
- package/Types/Product/ProductCatalog.d.mts +10 -0
- package/Types/Product/ProductCatalog.d.ts +10 -0
- package/Types/Product/ProductCatalog.js +208 -0
- package/Types/Product/ProductCatalog.mjs +6 -0
- package/Types/Product/ProductOfTable.d.mts +3 -0
- package/Types/Product/ProductOfTable.d.ts +3 -0
- package/Types/Product/ProductOfTable.js +68 -0
- package/Types/Product/ProductOfTable.mjs +3 -0
- package/Types/Product/ProjectProductsAnswer.d.mts +3 -0
- package/Types/Product/ProjectProductsAnswer.d.ts +3 -0
- package/Types/Product/ProjectProductsAnswer.js +35 -2
- package/Types/Product/ProjectProductsAnswer.mjs +1 -0
- package/Types/Product/ServerProducts.d.mts +65 -0
- package/Types/Product/ServerProducts.d.ts +65 -0
- package/Types/Product/ServerProducts.js +383 -0
- package/Types/Product/ServerProducts.mjs +26 -0
- package/Types/Product/ServerProductsAnswer.d.mts +21 -0
- package/Types/Product/ServerProductsAnswer.d.ts +21 -0
- package/Types/Product/ServerProductsAnswer.js +78 -0
- package/Types/Product/ServerProductsAnswer.mjs +5 -0
- package/Types/ProductFeedback/ProductFeedback.d.mts +3 -1
- package/Types/ProductFeedback/ProductFeedback.d.ts +3 -1
- package/Types/ProductFeedback/ProductFeedback.js +8 -0
- package/Types/ReaderLanguage.d.mts +1 -0
- package/Types/ReaderLanguage.d.ts +1 -0
- package/Types/ReaderLanguage.js +13 -1
- package/Types/ReaderLanguage.mjs +1 -0
- package/Types/Rules/RuleRun.js +2 -2
- package/Types/Rum/SessionReplayCustomEvents.d.mts +1 -0
- package/Types/Rum/SessionReplayCustomEvents.d.ts +1 -0
- package/Types/SampleProject/SampleProject.d.mts +54 -0
- package/Types/SampleProject/SampleProject.d.ts +54 -0
- package/Types/SampleProject/SampleProject.js +177 -0
- package/Types/SampleProject/SampleProject.mjs +22 -0
- package/Types/SampleProject/SampleProjectContent.d.mts +127 -0
- package/Types/SampleProject/SampleProjectContent.d.ts +127 -0
- package/Types/SampleProject/SampleProjectContent.js +397 -0
- package/Types/SampleProject/SampleProjectContent.mjs +18 -0
- package/Types/ScheduledMaintenance/MaintenanceCalendar.js +1 -1
- package/Types/ServerSending/ServerSendingStatus.d.mts +7 -0
- package/Types/ServerSending/ServerSendingStatus.d.ts +7 -0
- package/Types/ServerSending/ServerSendingStatus.js +49 -2
- package/Types/ServerSetup/ServerSetupChecklist.js +3 -3
- package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.mts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.ts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.js +50 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.mjs +3 -0
- package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +1 -1
- package/Types/Telemetry/CompatibleIngest.d.mts +20 -0
- package/Types/Telemetry/CompatibleIngest.d.ts +20 -0
- package/Types/Telemetry/CompatibleIngest.js +123 -0
- package/Types/Telemetry/CompatibleIngest.mjs +21 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.mts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.ts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.js +54 -12
- package/Types/TimezoneAlias.d.mts +1 -0
- package/Types/TimezoneAlias.d.ts +1 -0
- package/Types/TimezoneAlias.js +13 -0
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +414 -50
- package/Types/Translator.mjs +1 -0
- package/Types/UsedBy/UsedBy.d.mts +103 -0
- package/Types/UsedBy/UsedBy.d.ts +103 -0
- package/Types/UsedBy/UsedBy.js +389 -0
- package/Types/UsedBy/UsedBy.mjs +20 -0
- package/Types/UsedBy/UsedByServerProducts.d.mts +4 -0
- package/Types/UsedBy/UsedByServerProducts.d.ts +4 -0
- package/Types/UsedBy/UsedByServerProducts.js +48 -0
- package/Types/UsedBy/UsedByServerProducts.mjs +3 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.mts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.ts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.js +54 -2
- package/Types/WelcomeChecklist/WelcomeChecklist.mjs +4 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.mts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.ts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.js +3 -0
- package/Types/Workflow/PassedOnFields.js +2 -1
- package/Types/Workflow/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +3 -3
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.mts +2 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.ts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +28 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +28 -1
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.mts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.ts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.js +456 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.mjs +5 -0
- package/Utils/AI/MeaningMatch.d.mts +36 -0
- package/Utils/AI/MeaningMatch.d.ts +36 -0
- package/Utils/AI/MeaningMatch.js +535 -0
- package/Utils/AI/MeaningMatch.mjs +7 -0
- package/Utils/ArchivableValues.js +1 -1
- package/Utils/AuditLog/AuditLogValues.js +2 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.mts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.ts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.js +105 -2
- package/Utils/Dashboard/DashboardViewConfigSignature.d.mts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.d.ts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.js +45 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.mjs +3 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.mts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
- package/Utils/DataSecurity/TextScanner.js +2 -2
- package/Utils/DeveloperDocs/AiAssistantExamples.js +4 -4
- package/Utils/DeveloperDocs/CliCommands.d.mts +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +1 -0
- package/Utils/DeveloperDocs/CliCommands.js +2 -1
- package/Utils/DeveloperDocs/CliResources.js +2 -1
- package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/GuidedSetup/StatusPageRecords.d.mts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.ts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.js +27 -2
- package/Utils/GuidedSetup/StatusPageRecords.mjs +1 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.js +6 -0
- package/Utils/HostAddressUtil.d.mts +1 -0
- package/Utils/HostAddressUtil.d.ts +1 -0
- package/Utils/HostAddressUtil.js +30 -0
- package/Utils/LinearRegExp/LinearRegExp.js +5 -1
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +1493 -131
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +1 -0
- package/Utils/Markdown/MarkdownTableCell.js +2 -1
- package/Utils/Markdown/OverLongText.js +523 -5
- package/Utils/Markdown/SlowMarkdown.d.mts +14 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +14 -0
- package/Utils/Markdown/SlowMarkdown.js +595 -11
- package/Utils/Markdown/SlowMarkdown.mjs +6 -0
- package/Utils/Milliseconds.d.mts +7 -0
- package/Utils/Milliseconds.d.ts +7 -0
- package/Utils/Milliseconds.js +60 -0
- package/Utils/Milliseconds.mjs +4 -0
- package/Utils/ModelApiName.d.mts +11 -0
- package/Utils/ModelApiName.d.ts +11 -0
- package/Utils/ModelApiName.js +72 -0
- package/Utils/ModelApiName.mjs +5 -0
- package/Utils/Monitor/DeviceMacLearningUtil.d.mts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.d.ts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.js +26 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +97 -22
- package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.mts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.ts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.js +35 -1
- package/Utils/Monitor/ExternalStatusPageReading.mjs +2 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.mts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.ts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.js +217 -5
- package/Utils/Monitor/InterfaceInventoryUtil.mjs +8 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +63 -29
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +13 -2
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +58 -4
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.mts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.ts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.js +45 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.mjs +6 -0
- package/Utils/Monitor/MonitoringOff.d.mts +2 -0
- package/Utils/Monitor/MonitoringOff.d.ts +2 -0
- package/Utils/Monitor/MonitoringOff.js +21 -0
- package/Utils/Monitor/NetworkTopologyUtil.d.mts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.d.ts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.js +10 -0
- package/Utils/Monitor/NotOperationalMonitorQuery.d.mts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.d.ts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.js +23 -4
- package/Utils/Monitor/ProbeFailureReading.d.mts +14 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +14 -0
- package/Utils/Monitor/ProbeFailureReading.js +137 -0
- package/Utils/Monitor/ProbeFailureReading.mjs +7 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.mts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.ts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.js +15 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.mjs +2 -0
- package/Utils/OpenStack/OpenStackCheckName.js +2 -1
- package/Utils/OpenStack/OpenStackLogScrub.js +1 -1
- package/Utils/OpenStack/OpenStackLogs.js +3 -2
- package/Utils/OpenStack/OpenStackTraces.js +2 -1
- package/Utils/Project/NextNumber.js +1 -1
- package/Utils/Project/NotificationChannels.js +5 -5
- package/Utils/Project/ProjectBalance.js +2 -2
- package/Utils/Project/TwilioAccount.js +2 -2
- package/Utils/PromQL/PromQLAst.d.mts +159 -0
- package/Utils/PromQL/PromQLAst.d.ts +159 -0
- package/Utils/PromQL/PromQLAst.js +118 -0
- package/Utils/PromQL/PromQLAst.mjs +12 -0
- package/Utils/PromQL/PromQLDuration.d.mts +2 -0
- package/Utils/PromQL/PromQLDuration.d.ts +2 -0
- package/Utils/PromQL/PromQLDuration.js +78 -0
- package/Utils/PromQL/PromQLDuration.mjs +3 -0
- package/Utils/PromQL/PromQLEngine.d.mts +15 -0
- package/Utils/PromQL/PromQLEngine.d.ts +15 -0
- package/Utils/PromQL/PromQLEngine.js +965 -0
- package/Utils/PromQL/PromQLEngine.mjs +7 -0
- package/Utils/PromQL/PromQLEngineTypes.d.mts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.d.ts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.js +10 -0
- package/Utils/PromQL/PromQLEngineTypes.mjs +2 -0
- package/Utils/PromQL/PromQLError.d.mts +11 -0
- package/Utils/PromQL/PromQLError.d.ts +11 -0
- package/Utils/PromQL/PromQLError.js +27 -0
- package/Utils/PromQL/PromQLError.mjs +3 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.mts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.ts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.js +773 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.mjs +3 -0
- package/Utils/PromQL/PromQLFunctions.d.mts +10 -0
- package/Utils/PromQL/PromQLFunctions.d.ts +10 -0
- package/Utils/PromQL/PromQLFunctions.js +127 -0
- package/Utils/PromQL/PromQLFunctions.mjs +4 -0
- package/Utils/PromQL/PromQLLabels.d.mts +11 -0
- package/Utils/PromQL/PromQLLabels.d.ts +11 -0
- package/Utils/PromQL/PromQLLabels.js +218 -0
- package/Utils/PromQL/PromQLLabels.mjs +9 -0
- package/Utils/PromQL/PromQLLexer.d.mts +39 -0
- package/Utils/PromQL/PromQLLexer.d.ts +39 -0
- package/Utils/PromQL/PromQLLexer.js +391 -0
- package/Utils/PromQL/PromQLLexer.mjs +3 -0
- package/Utils/PromQL/PromQLMath.d.mts +19 -0
- package/Utils/PromQL/PromQLMath.d.ts +19 -0
- package/Utils/PromQL/PromQLMath.js +200 -0
- package/Utils/PromQL/PromQLMath.mjs +9 -0
- package/Utils/PromQL/PromQLMetricNames.d.mts +21 -0
- package/Utils/PromQL/PromQLMetricNames.d.ts +21 -0
- package/Utils/PromQL/PromQLMetricNames.js +199 -0
- package/Utils/PromQL/PromQLMetricNames.mjs +8 -0
- package/Utils/PromQL/PromQLParser.d.mts +4 -0
- package/Utils/PromQL/PromQLParser.d.ts +4 -0
- package/Utils/PromQL/PromQLParser.js +831 -0
- package/Utils/PromQL/PromQLParser.mjs +4 -0
- package/Utils/PromQL/PromQLRegex.d.mts +9 -0
- package/Utils/PromQL/PromQLRegex.d.ts +9 -0
- package/Utils/PromQL/PromQLRegex.js +74 -0
- package/Utils/PromQL/PromQLRegex.mjs +2 -0
- package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
- package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
- package/Utils/PromQL/PrometheusResponse.js +90 -0
- package/Utils/PromQL/PrometheusResponse.mjs +3 -0
- package/Utils/Rum/PathInSentence.d.mts +5 -0
- package/Utils/Rum/PathInSentence.d.ts +5 -0
- package/Utils/Rum/PathInSentence.js +46 -0
- package/Utils/Rum/PathInSentence.mjs +6 -0
- package/Utils/Rum/UrlScrubber.d.mts +4 -0
- package/Utils/Rum/UrlScrubber.d.ts +4 -0
- package/Utils/Rum/UrlScrubber.js +143 -3
- package/Utils/Rum/UserFlow.d.mts +1 -1
- package/Utils/Rum/UserFlow.d.ts +1 -1
- package/Utils/Rum/UserFlow.js +180 -25
- package/Utils/Rum/UserFlow.mjs +1 -1
- package/Utils/Runbook/RunbookStepsSignature.d.mts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.d.ts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.js +30 -0
- package/Utils/Runbook/RunbookStepsSignature.mjs +3 -0
- package/Utils/ScheduledMaintenanceStart.d.mts +3 -0
- package/Utils/ScheduledMaintenanceStart.d.ts +3 -0
- package/Utils/ScheduledMaintenanceStart.js +9 -0
- package/Utils/Schema/ModelSchema.js +10 -1
- package/Utils/Schema/TypeSchemas.js +6 -0
- package/Utils/Slo/SloDuration.d.mts +5 -2
- package/Utils/Slo/SloDuration.d.ts +5 -2
- package/Utils/Slo/SloDuration.js +11 -6
- package/Utils/Slo/SloHealth.js +1 -1
- package/Utils/StateOrder.js +1 -4
- package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
- package/Utils/Telemetry/HeartbeatAvailability.d.mts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.js +118 -26
- package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
- package/Utils/Uptime/UptimeMaintenanceUtil.js +2 -1
- package/Utils/ValueFormatter.d.mts +8 -6
- package/Utils/ValueFormatter.d.ts +8 -6
- package/Utils/ValueFormatter.js +145 -0
- package/package.json +1 -1
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SERVER_EMAIL_COLUMNS = exports.SERVER_EMAIL_SET_BY_ENVIRONMENT_MESSAGE = exports.SERVER_EMAIL_ENVIRONMENT_ROUTE = exports.SERVER_EMAIL_MAILGUN_REGION_VALUES = exports.SERVER_EMAIL_AMAZON_SES_AUTHENTICATION_TYPE_VALUES = exports.SERVER_EMAIL_SMTP_OAUTH_PROVIDER_TYPE_VALUES = exports.SERVER_EMAIL_SMTP_AUTH_TYPE_VALUES = exports.SERVER_EMAIL_SMTP_TRANSPORT_VALUES = exports.SERVER_EMAIL_SERVER_TYPE_VALUES = exports.SERVER_EMAIL_SECRET_VARIABLES = exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES = exports.ServerEmailEnvironmentVariable = void 0;
|
|
7
|
+
const GlobalConfig_1 = require("../../Models/DatabaseModels/GlobalConfig");
|
|
8
|
+
const AwsRegionCode_1 = require("../Cloud/AwsRegionCode");
|
|
9
|
+
const Email_1 = __importDefault(require("../Email"));
|
|
10
|
+
const Hostname_1 = __importDefault(require("../API/Hostname"));
|
|
11
|
+
const URL_1 = __importDefault(require("../API/URL"));
|
|
12
|
+
const Port_1 = __importDefault(require("../Port"));
|
|
13
|
+
const RefusedValue_1 = require("../../Utils/RefusedValue");
|
|
14
|
+
const AmazonSesAuthenticationType_1 = __importDefault(require("./AmazonSesAuthenticationType"));
|
|
15
|
+
const MailgunDomain_1 = require("./MailgunDomain");
|
|
16
|
+
const MailgunRegion_1 = __importDefault(require("./MailgunRegion"));
|
|
17
|
+
const MailTransportType_1 = __importDefault(require("./MailTransportType"));
|
|
18
|
+
const OAuthProviderType_1 = __importDefault(require("./OAuthProviderType"));
|
|
19
|
+
const SMTPAuthenticationType_1 = __importDefault(require("./SMTPAuthenticationType"));
|
|
20
|
+
/*
|
|
21
|
+
* THE SERVER'S OWN EMAIL SETTINGS, SET BY ENVIRONMENT VARIABLES (#7738).
|
|
22
|
+
*
|
|
23
|
+
* Admin Dashboard > Settings > Emails keeps how the server sends its own
|
|
24
|
+
* email in GlobalConfig: the Email Server Type, and that type's settings -
|
|
25
|
+
* a mail server (Custom SMTP, or Microsoft Graph), or SendGrid, Amazon SES,
|
|
26
|
+
* Mailgun, Postmark or Resend. An installation that keeps its configuration
|
|
27
|
+
* in code - Helm values, Terraform's helm_release, a config.env kept in git -
|
|
28
|
+
* sets them with these variables instead, as GLOBAL_TWILIO_ does for the
|
|
29
|
+
* server's Twilio account (Types/CallAndSMS/ServerTwilioEnvironment, #7515).
|
|
30
|
+
*
|
|
31
|
+
* Once GLOBAL_EMAIL_SERVER_TYPE is set, the server's email settings are the
|
|
32
|
+
* ones the variables describe: the senders read them (Server/Utils/
|
|
33
|
+
* ServerEmailSettings), the Admin Dashboard shows them without an Edit
|
|
34
|
+
* button, and the server refuses a write to the saved ones
|
|
35
|
+
* (GlobalConfigService). Unset, the saved settings apply again, as they
|
|
36
|
+
* were. Nothing is copied into the database, so a password or a key stays
|
|
37
|
+
* where it was given: a Kubernetes Secret, or config.env.
|
|
38
|
+
*
|
|
39
|
+
* All of the settings come from the variables, or none of them: a variable
|
|
40
|
+
* left unset is empty, never the saved value, so the variables are the
|
|
41
|
+
* whole of the settings and a value nobody wrote down cannot change what is
|
|
42
|
+
* sent.
|
|
43
|
+
*
|
|
44
|
+
* What is wrong with them is said by the variable's name, and never with a
|
|
45
|
+
* password or a key: when the server starts, on the Admin Dashboard's Email
|
|
46
|
+
* page, and in what the server's sending status says email is missing
|
|
47
|
+
* (ServerChannelSetup). Settings with something wrong send nothing, as
|
|
48
|
+
* settings that are not set up, rather than send through a server or from
|
|
49
|
+
* an address nobody meant. A variable the chosen settings do not read - an
|
|
50
|
+
* SMTP host with SendGrid picked - stops nothing: it is named, as ignored.
|
|
51
|
+
*
|
|
52
|
+
* The variables are new names. SMTP_HOST, SMTP_PORT, SMTP_USERNAME,
|
|
53
|
+
* SMTP_PASSWORD, SMTP_IS_SECURE, SMTP_FROM_EMAIL, SMTP_FROM_NAME and
|
|
54
|
+
* SENDGRID_API_KEY were read once, into a new installation's database, by
|
|
55
|
+
* the UpdateGlobalConfigFromEnv data migration, and an old config.env may
|
|
56
|
+
* still hold them: reading them again would put stale settings over the
|
|
57
|
+
* ones an admin has saved since.
|
|
58
|
+
*/
|
|
59
|
+
var ServerEmailEnvironmentVariable;
|
|
60
|
+
(function (ServerEmailEnvironmentVariable) {
|
|
61
|
+
ServerEmailEnvironmentVariable["ServerType"] = "GLOBAL_EMAIL_SERVER_TYPE";
|
|
62
|
+
ServerEmailEnvironmentVariable["FromEmail"] = "GLOBAL_EMAIL_FROM_EMAIL";
|
|
63
|
+
ServerEmailEnvironmentVariable["FromName"] = "GLOBAL_EMAIL_FROM_NAME";
|
|
64
|
+
ServerEmailEnvironmentVariable["SmtpTransport"] = "GLOBAL_EMAIL_SMTP_TRANSPORT";
|
|
65
|
+
ServerEmailEnvironmentVariable["SmtpHost"] = "GLOBAL_EMAIL_SMTP_HOST";
|
|
66
|
+
ServerEmailEnvironmentVariable["SmtpPort"] = "GLOBAL_EMAIL_SMTP_PORT";
|
|
67
|
+
ServerEmailEnvironmentVariable["SmtpRequireTls"] = "GLOBAL_EMAIL_SMTP_REQUIRE_TLS";
|
|
68
|
+
ServerEmailEnvironmentVariable["SmtpAuthType"] = "GLOBAL_EMAIL_SMTP_AUTH_TYPE";
|
|
69
|
+
ServerEmailEnvironmentVariable["SmtpUsername"] = "GLOBAL_EMAIL_SMTP_USERNAME";
|
|
70
|
+
ServerEmailEnvironmentVariable["SmtpPassword"] = "GLOBAL_EMAIL_SMTP_PASSWORD";
|
|
71
|
+
ServerEmailEnvironmentVariable["SmtpOAuthProviderType"] = "GLOBAL_EMAIL_SMTP_OAUTH_PROVIDER_TYPE";
|
|
72
|
+
ServerEmailEnvironmentVariable["SmtpOAuthClientId"] = "GLOBAL_EMAIL_SMTP_OAUTH_CLIENT_ID";
|
|
73
|
+
ServerEmailEnvironmentVariable["SmtpOAuthClientSecret"] = "GLOBAL_EMAIL_SMTP_OAUTH_CLIENT_SECRET";
|
|
74
|
+
ServerEmailEnvironmentVariable["SmtpOAuthTokenUrl"] = "GLOBAL_EMAIL_SMTP_OAUTH_TOKEN_URL";
|
|
75
|
+
ServerEmailEnvironmentVariable["SmtpOAuthScope"] = "GLOBAL_EMAIL_SMTP_OAUTH_SCOPE";
|
|
76
|
+
ServerEmailEnvironmentVariable["SendgridApiKey"] = "GLOBAL_EMAIL_SENDGRID_API_KEY";
|
|
77
|
+
ServerEmailEnvironmentVariable["AmazonSesAuthenticationType"] = "GLOBAL_EMAIL_AMAZON_SES_AUTHENTICATION_TYPE";
|
|
78
|
+
ServerEmailEnvironmentVariable["AmazonSesAccessKeyId"] = "GLOBAL_EMAIL_AMAZON_SES_ACCESS_KEY_ID";
|
|
79
|
+
ServerEmailEnvironmentVariable["AmazonSesSecretAccessKey"] = "GLOBAL_EMAIL_AMAZON_SES_SECRET_ACCESS_KEY";
|
|
80
|
+
ServerEmailEnvironmentVariable["AmazonSesRegion"] = "GLOBAL_EMAIL_AMAZON_SES_REGION";
|
|
81
|
+
ServerEmailEnvironmentVariable["MailgunApiKey"] = "GLOBAL_EMAIL_MAILGUN_API_KEY";
|
|
82
|
+
ServerEmailEnvironmentVariable["MailgunDomain"] = "GLOBAL_EMAIL_MAILGUN_DOMAIN";
|
|
83
|
+
ServerEmailEnvironmentVariable["MailgunRegion"] = "GLOBAL_EMAIL_MAILGUN_REGION";
|
|
84
|
+
ServerEmailEnvironmentVariable["PostmarkServerToken"] = "GLOBAL_EMAIL_POSTMARK_SERVER_TOKEN";
|
|
85
|
+
ServerEmailEnvironmentVariable["ResendApiKey"] = "GLOBAL_EMAIL_RESEND_API_KEY";
|
|
86
|
+
})(ServerEmailEnvironmentVariable || (exports.ServerEmailEnvironmentVariable = ServerEmailEnvironmentVariable = {}));
|
|
87
|
+
// Every variable, the one that turns them on first: the order problems are said in.
|
|
88
|
+
exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES = [
|
|
89
|
+
ServerEmailEnvironmentVariable.ServerType,
|
|
90
|
+
ServerEmailEnvironmentVariable.FromEmail,
|
|
91
|
+
ServerEmailEnvironmentVariable.FromName,
|
|
92
|
+
ServerEmailEnvironmentVariable.SmtpTransport,
|
|
93
|
+
ServerEmailEnvironmentVariable.SmtpHost,
|
|
94
|
+
ServerEmailEnvironmentVariable.SmtpPort,
|
|
95
|
+
ServerEmailEnvironmentVariable.SmtpRequireTls,
|
|
96
|
+
ServerEmailEnvironmentVariable.SmtpAuthType,
|
|
97
|
+
ServerEmailEnvironmentVariable.SmtpUsername,
|
|
98
|
+
ServerEmailEnvironmentVariable.SmtpPassword,
|
|
99
|
+
ServerEmailEnvironmentVariable.SmtpOAuthProviderType,
|
|
100
|
+
ServerEmailEnvironmentVariable.SmtpOAuthClientId,
|
|
101
|
+
ServerEmailEnvironmentVariable.SmtpOAuthClientSecret,
|
|
102
|
+
ServerEmailEnvironmentVariable.SmtpOAuthTokenUrl,
|
|
103
|
+
ServerEmailEnvironmentVariable.SmtpOAuthScope,
|
|
104
|
+
ServerEmailEnvironmentVariable.SendgridApiKey,
|
|
105
|
+
ServerEmailEnvironmentVariable.AmazonSesAuthenticationType,
|
|
106
|
+
ServerEmailEnvironmentVariable.AmazonSesAccessKeyId,
|
|
107
|
+
ServerEmailEnvironmentVariable.AmazonSesSecretAccessKey,
|
|
108
|
+
ServerEmailEnvironmentVariable.AmazonSesRegion,
|
|
109
|
+
ServerEmailEnvironmentVariable.MailgunApiKey,
|
|
110
|
+
ServerEmailEnvironmentVariable.MailgunDomain,
|
|
111
|
+
ServerEmailEnvironmentVariable.MailgunRegion,
|
|
112
|
+
ServerEmailEnvironmentVariable.PostmarkServerToken,
|
|
113
|
+
ServerEmailEnvironmentVariable.ResendApiKey,
|
|
114
|
+
];
|
|
115
|
+
/*
|
|
116
|
+
* The variables that hold a password or a key: never repeated in a
|
|
117
|
+
* message, never sent to the Admin Dashboard - only whether they are set.
|
|
118
|
+
*/
|
|
119
|
+
exports.SERVER_EMAIL_SECRET_VARIABLES = [
|
|
120
|
+
ServerEmailEnvironmentVariable.SmtpPassword,
|
|
121
|
+
ServerEmailEnvironmentVariable.SmtpOAuthClientSecret,
|
|
122
|
+
ServerEmailEnvironmentVariable.SendgridApiKey,
|
|
123
|
+
ServerEmailEnvironmentVariable.AmazonSesSecretAccessKey,
|
|
124
|
+
ServerEmailEnvironmentVariable.MailgunApiKey,
|
|
125
|
+
ServerEmailEnvironmentVariable.PostmarkServerToken,
|
|
126
|
+
ServerEmailEnvironmentVariable.ResendApiKey,
|
|
127
|
+
];
|
|
128
|
+
/*
|
|
129
|
+
* What GLOBAL_EMAIL_SERVER_TYPE is written as for each Email Server Type,
|
|
130
|
+
* in the docs, the Helm chart and config.example.env. The Admin Dashboard's
|
|
131
|
+
* own words ("Amazon SES") are taken too, in any case and with spaces,
|
|
132
|
+
* hyphens or underscores (readChoice), and smtp for Custom SMTP.
|
|
133
|
+
*/
|
|
134
|
+
exports.SERVER_EMAIL_SERVER_TYPE_VALUES = {
|
|
135
|
+
[GlobalConfig_1.EmailServerType.CustomSMTP]: "custom-smtp",
|
|
136
|
+
[GlobalConfig_1.EmailServerType.Sendgrid]: "sendgrid",
|
|
137
|
+
[GlobalConfig_1.EmailServerType.AmazonSES]: "amazon-ses",
|
|
138
|
+
[GlobalConfig_1.EmailServerType.Mailgun]: "mailgun",
|
|
139
|
+
[GlobalConfig_1.EmailServerType.Postmark]: "postmark",
|
|
140
|
+
[GlobalConfig_1.EmailServerType.Resend]: "resend",
|
|
141
|
+
};
|
|
142
|
+
exports.SERVER_EMAIL_SMTP_TRANSPORT_VALUES = {
|
|
143
|
+
[MailTransportType_1.default.SMTP]: "smtp",
|
|
144
|
+
[MailTransportType_1.default.MicrosoftGraph]: "microsoft-graph",
|
|
145
|
+
};
|
|
146
|
+
exports.SERVER_EMAIL_SMTP_AUTH_TYPE_VALUES = {
|
|
147
|
+
[SMTPAuthenticationType_1.default.UsernamePassword]: "username-and-password",
|
|
148
|
+
[SMTPAuthenticationType_1.default.OAuth]: "oauth",
|
|
149
|
+
[SMTPAuthenticationType_1.default.None]: "none",
|
|
150
|
+
};
|
|
151
|
+
exports.SERVER_EMAIL_SMTP_OAUTH_PROVIDER_TYPE_VALUES = {
|
|
152
|
+
[OAuthProviderType_1.default.ClientCredentials]: "client-credentials",
|
|
153
|
+
[OAuthProviderType_1.default.JWTBearer]: "jwt-bearer",
|
|
154
|
+
};
|
|
155
|
+
exports.SERVER_EMAIL_AMAZON_SES_AUTHENTICATION_TYPE_VALUES = {
|
|
156
|
+
[AmazonSesAuthenticationType_1.default.AccessKey]: "access-key",
|
|
157
|
+
[AmazonSesAuthenticationType_1.default.ServerIamRole]: "server-iam-role",
|
|
158
|
+
};
|
|
159
|
+
exports.SERVER_EMAIL_MAILGUN_REGION_VALUES = {
|
|
160
|
+
[MailgunRegion_1.default.US]: "us",
|
|
161
|
+
[MailgunRegion_1.default.EU]: "eu",
|
|
162
|
+
};
|
|
163
|
+
// Where the Admin Dashboard asks the server whether the variables set its email.
|
|
164
|
+
exports.SERVER_EMAIL_ENVIRONMENT_ROUTE = "/global-config/email-environment";
|
|
165
|
+
/*
|
|
166
|
+
* Said when someone tries to change settings the variables set: the server
|
|
167
|
+
* refuses the write (GlobalConfigService), and the docs and the Admin
|
|
168
|
+
* Dashboard say where the settings are changed instead.
|
|
169
|
+
*/
|
|
170
|
+
exports.SERVER_EMAIL_SET_BY_ENVIRONMENT_MESSAGE = `This server's email settings are set by environment variables (${ServerEmailEnvironmentVariable.ServerType} and the other GLOBAL_EMAIL_ variables), so they cannot be changed in the Admin Dashboard. Change those variables - email in the Helm chart's values, or config.env with Docker Compose - and restart OneUptime.`;
|
|
171
|
+
exports.SERVER_EMAIL_COLUMNS = [
|
|
172
|
+
"emailServerType",
|
|
173
|
+
"isSMTPSecure",
|
|
174
|
+
"smtpTransportType",
|
|
175
|
+
"smtpAuthType",
|
|
176
|
+
"smtpHost",
|
|
177
|
+
"smtpPort",
|
|
178
|
+
"smtpUsername",
|
|
179
|
+
"smtpPassword",
|
|
180
|
+
"smtpFromEmail",
|
|
181
|
+
"smtpFromName",
|
|
182
|
+
"smtpClientId",
|
|
183
|
+
"smtpClientSecret",
|
|
184
|
+
"smtpTokenUrl",
|
|
185
|
+
"smtpScope",
|
|
186
|
+
"smtpOAuthProviderType",
|
|
187
|
+
"sendgridApiKey",
|
|
188
|
+
"sendgridFromEmail",
|
|
189
|
+
"sendgridFromName",
|
|
190
|
+
"amazonSesAuthenticationType",
|
|
191
|
+
"amazonSesAccessKeyId",
|
|
192
|
+
"amazonSesSecretAccessKey",
|
|
193
|
+
"amazonSesRegion",
|
|
194
|
+
"amazonSesFromEmail",
|
|
195
|
+
"amazonSesFromName",
|
|
196
|
+
"mailgunApiKey",
|
|
197
|
+
"mailgunDomain",
|
|
198
|
+
"mailgunRegion",
|
|
199
|
+
"mailgunFromEmail",
|
|
200
|
+
"mailgunFromName",
|
|
201
|
+
"postmarkServerToken",
|
|
202
|
+
"postmarkFromEmail",
|
|
203
|
+
"postmarkFromName",
|
|
204
|
+
"resendApiKey",
|
|
205
|
+
"resendFromEmail",
|
|
206
|
+
"resendFromName",
|
|
207
|
+
];
|
|
208
|
+
// "amazonses" for "Amazon SES", "amazon-ses" and "AMAZON_SES".
|
|
209
|
+
const comparable = (value) => {
|
|
210
|
+
return value.toLowerCase().replace(/[^a-z]/g, "");
|
|
211
|
+
};
|
|
212
|
+
// "A", "A and B", "A, B and C".
|
|
213
|
+
const listed = (names) => {
|
|
214
|
+
if (names.length <= 1) {
|
|
215
|
+
return names.join("");
|
|
216
|
+
}
|
|
217
|
+
return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
218
|
+
};
|
|
219
|
+
// "A or B", "A, B or C".
|
|
220
|
+
const eitherOf = (names) => {
|
|
221
|
+
if (names.length <= 1) {
|
|
222
|
+
return names.join("");
|
|
223
|
+
}
|
|
224
|
+
return `${names.slice(0, -1).join(", ")} or ${names[names.length - 1]}`;
|
|
225
|
+
};
|
|
226
|
+
const NO_SETTINGS_ANSWER = {
|
|
227
|
+
isSetByEnvironment: false,
|
|
228
|
+
serverType: null,
|
|
229
|
+
fields: [],
|
|
230
|
+
problems: [],
|
|
231
|
+
ignored: [],
|
|
232
|
+
};
|
|
233
|
+
// An http or https URL's scheme and host, and any white space.
|
|
234
|
+
const HTTP_URL_START = /^https?:\/\/[^\s/]+/i;
|
|
235
|
+
const WHITE_SPACE = /\s/;
|
|
236
|
+
// A port as written: one to five digits.
|
|
237
|
+
const PORT_DIGITS = /^[0-9]{1,5}$/;
|
|
238
|
+
class ServerEmailEnvironment {
|
|
239
|
+
/*
|
|
240
|
+
* The choice a variable names: the documented value, or the Admin
|
|
241
|
+
* Dashboard's own words for it, in any case and with spaces, hyphens or
|
|
242
|
+
* underscores. The default when it is empty, or null when it names none.
|
|
243
|
+
*/
|
|
244
|
+
static readChoice(value, values, defaultChoice, aliases = {}) {
|
|
245
|
+
const written = comparable((value || "").trim());
|
|
246
|
+
if (!written) {
|
|
247
|
+
return defaultChoice;
|
|
248
|
+
}
|
|
249
|
+
for (const choice of Object.keys(values)) {
|
|
250
|
+
if (comparable(choice) === written ||
|
|
251
|
+
comparable(values[choice]) === written) {
|
|
252
|
+
return choice;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
for (const alias of Object.keys(aliases)) {
|
|
256
|
+
if (comparable(alias) === written) {
|
|
257
|
+
return aliases[alias];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
// The Email Server Type GLOBAL_EMAIL_SERVER_TYPE names, or null.
|
|
263
|
+
static readServerType(value) {
|
|
264
|
+
return ServerEmailEnvironment.readChoice(value, exports.SERVER_EMAIL_SERVER_TYPE_VALUES, null, { smtp: GlobalConfig_1.EmailServerType.CustomSMTP });
|
|
265
|
+
}
|
|
266
|
+
static isSecret(variable) {
|
|
267
|
+
return exports.SERVER_EMAIL_SECRET_VARIABLES.includes(variable);
|
|
268
|
+
}
|
|
269
|
+
/*
|
|
270
|
+
* A mail server's host name or IP address alone, as the mail service
|
|
271
|
+
* connects to it: no port (GLOBAL_EMAIL_SMTP_PORT has it), no user name,
|
|
272
|
+
* no scheme or path.
|
|
273
|
+
*/
|
|
274
|
+
static isBareHost(value) {
|
|
275
|
+
const host = value.trim();
|
|
276
|
+
if (!host ||
|
|
277
|
+
host.includes("@") ||
|
|
278
|
+
host.includes("/") ||
|
|
279
|
+
host.includes("[")) {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
// One colon is a port; an IPv6 address has two or more.
|
|
283
|
+
if (host.split(":").length === 2) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
return Hostname_1.default.isValid(host);
|
|
287
|
+
}
|
|
288
|
+
// An OAuth token endpoint: an http or https URL the server can parse.
|
|
289
|
+
static isTokenUrl(value) {
|
|
290
|
+
const text = value.trim();
|
|
291
|
+
if (!HTTP_URL_START.test(text) || WHITE_SPACE.test(text)) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
URL_1.default.fromString(text);
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
catch (_a) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/*
|
|
303
|
+
* The server's email settings as the environment sets them - process.env
|
|
304
|
+
* on the server, read again on every call, so nothing it held goes stale.
|
|
305
|
+
* Each value is read without the whitespace around it: a key read from a
|
|
306
|
+
* file keeps its final newline (helm --set-file, Terraform's file()).
|
|
307
|
+
*/
|
|
308
|
+
static read(environment) {
|
|
309
|
+
const value = (variable) => {
|
|
310
|
+
const written = environment[variable];
|
|
311
|
+
return typeof written === "string" ? written.trim() : "";
|
|
312
|
+
};
|
|
313
|
+
const setVariables = exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES.filter((variable) => {
|
|
314
|
+
return Boolean(value(variable));
|
|
315
|
+
});
|
|
316
|
+
const values = {};
|
|
317
|
+
for (const variable of setVariables) {
|
|
318
|
+
values[variable] = value(variable);
|
|
319
|
+
}
|
|
320
|
+
const serverTypeText = value(ServerEmailEnvironmentVariable.ServerType);
|
|
321
|
+
if (!serverTypeText) {
|
|
322
|
+
return {
|
|
323
|
+
isSet: false,
|
|
324
|
+
serverType: null,
|
|
325
|
+
settings: null,
|
|
326
|
+
problems: setVariables.length > 0
|
|
327
|
+
? [
|
|
328
|
+
`${listed(setVariables)} ${setVariables.length === 1 ? "is" : "are"} set, but ${ServerEmailEnvironmentVariable.ServerType} is not, so nothing reads ${setVariables.length === 1 ? "it" : "them"}: the email settings saved in the Admin Dashboard are used. Set ${ServerEmailEnvironmentVariable.ServerType} too, or remove ${setVariables.length === 1 ? "it" : "them"}.`,
|
|
329
|
+
]
|
|
330
|
+
: [],
|
|
331
|
+
ignored: [],
|
|
332
|
+
values: values,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const serverType = ServerEmailEnvironment.readServerType(serverTypeText);
|
|
336
|
+
if (!serverType) {
|
|
337
|
+
return {
|
|
338
|
+
isSet: true,
|
|
339
|
+
serverType: null,
|
|
340
|
+
settings: null,
|
|
341
|
+
problems: [
|
|
342
|
+
`${ServerEmailEnvironmentVariable.ServerType} must be ${eitherOf(Object.values(exports.SERVER_EMAIL_SERVER_TYPE_VALUES))}, not "${(0, RefusedValue_1.refusedValue)(serverTypeText)}".`,
|
|
343
|
+
],
|
|
344
|
+
ignored: [],
|
|
345
|
+
values: values,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
const problems = [];
|
|
349
|
+
/*
|
|
350
|
+
* Only the columns the variables fill: one they leave empty is not
|
|
351
|
+
* there, and reads as empty - never as the saved value.
|
|
352
|
+
*/
|
|
353
|
+
const settings = { emailServerType: serverType };
|
|
354
|
+
const put = (column, columnValue) => {
|
|
355
|
+
if (columnValue === undefined || columnValue === "") {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
settings[column] = columnValue;
|
|
359
|
+
};
|
|
360
|
+
// Each variable the chosen settings read, as they are read below.
|
|
361
|
+
const readVariables = new Set([
|
|
362
|
+
ServerEmailEnvironmentVariable.ServerType,
|
|
363
|
+
]);
|
|
364
|
+
const take = (variable) => {
|
|
365
|
+
readVariables.add(variable);
|
|
366
|
+
return value(variable);
|
|
367
|
+
};
|
|
368
|
+
const notSet = (variable, why) => {
|
|
369
|
+
problems.push(`${variable} is not set: ${why}`);
|
|
370
|
+
};
|
|
371
|
+
// A choice the variable must name, or a problem that lists the ones it can.
|
|
372
|
+
const choice = (variable, values, defaultChoice) => {
|
|
373
|
+
const text = take(variable);
|
|
374
|
+
const picked = ServerEmailEnvironment.readChoice(text, values, defaultChoice);
|
|
375
|
+
if (picked === null) {
|
|
376
|
+
problems.push(`${variable} must be ${eitherOf(Object.values(values))}, not "${(0, RefusedValue_1.refusedValue)(text)}".`);
|
|
377
|
+
return defaultChoice;
|
|
378
|
+
}
|
|
379
|
+
return picked;
|
|
380
|
+
};
|
|
381
|
+
// Who the emails come from: every type needs the address.
|
|
382
|
+
const fromEmailText = take(ServerEmailEnvironmentVariable.FromEmail);
|
|
383
|
+
let fromEmail = undefined;
|
|
384
|
+
if (!fromEmailText) {
|
|
385
|
+
notSet(ServerEmailEnvironmentVariable.FromEmail, "every email needs the address it comes from.");
|
|
386
|
+
}
|
|
387
|
+
else if (!Email_1.default.isValid(fromEmailText)) {
|
|
388
|
+
problems.push(`${ServerEmailEnvironmentVariable.FromEmail}: "${(0, RefusedValue_1.refusedValue)(fromEmailText)}" is not an email address.`);
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
fromEmail = new Email_1.default(fromEmailText);
|
|
392
|
+
}
|
|
393
|
+
const fromName = take(ServerEmailEnvironmentVariable.FromName);
|
|
394
|
+
/*
|
|
395
|
+
* Custom SMTP and SendGrid send with the name too, as the Admin
|
|
396
|
+
* Dashboard's forms ask for it; the providers with an HTTP API of their
|
|
397
|
+
* own send with the product's name when it is empty.
|
|
398
|
+
*/
|
|
399
|
+
if (!fromName &&
|
|
400
|
+
(serverType === GlobalConfig_1.EmailServerType.CustomSMTP ||
|
|
401
|
+
serverType === GlobalConfig_1.EmailServerType.Sendgrid)) {
|
|
402
|
+
notSet(ServerEmailEnvironmentVariable.FromName, `${exports.SERVER_EMAIL_SERVER_TYPE_VALUES[serverType]} sends every email with the name it comes from.`);
|
|
403
|
+
}
|
|
404
|
+
// A value the chosen settings cannot send without, and why when it is empty.
|
|
405
|
+
const needed = (variable, why) => {
|
|
406
|
+
const text = take(variable);
|
|
407
|
+
if (!text) {
|
|
408
|
+
notSet(variable, why);
|
|
409
|
+
}
|
|
410
|
+
return text;
|
|
411
|
+
};
|
|
412
|
+
switch (serverType) {
|
|
413
|
+
case GlobalConfig_1.EmailServerType.CustomSMTP: {
|
|
414
|
+
const transport = choice(ServerEmailEnvironmentVariable.SmtpTransport, exports.SERVER_EMAIL_SMTP_TRANSPORT_VALUES, MailTransportType_1.default.SMTP);
|
|
415
|
+
put("smtpTransportType", transport);
|
|
416
|
+
put("smtpFromEmail", fromEmail);
|
|
417
|
+
put("smtpFromName", fromName);
|
|
418
|
+
let usesOAuth = transport === MailTransportType_1.default.MicrosoftGraph;
|
|
419
|
+
let usesJwtBearer = false;
|
|
420
|
+
if (transport === MailTransportType_1.default.SMTP) {
|
|
421
|
+
const hostText = take(ServerEmailEnvironmentVariable.SmtpHost);
|
|
422
|
+
if (!hostText) {
|
|
423
|
+
notSet(ServerEmailEnvironmentVariable.SmtpHost, "email goes out through that mail server, such as smtp.example.com.");
|
|
424
|
+
}
|
|
425
|
+
else if (!ServerEmailEnvironment.isBareHost(hostText)) {
|
|
426
|
+
problems.push(`${ServerEmailEnvironmentVariable.SmtpHost}: "${(0, RefusedValue_1.refusedValue)(hostText)}" is not a host name, such as smtp.example.com. The port goes in ${ServerEmailEnvironmentVariable.SmtpPort}.`);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
put("smtpHost", new Hostname_1.default(hostText));
|
|
430
|
+
}
|
|
431
|
+
const portText = take(ServerEmailEnvironmentVariable.SmtpPort);
|
|
432
|
+
if (!portText) {
|
|
433
|
+
notSet(ServerEmailEnvironmentVariable.SmtpPort, "most mail servers take 587.");
|
|
434
|
+
}
|
|
435
|
+
else if (!PORT_DIGITS.test(portText) ||
|
|
436
|
+
Number(portText) < 1 ||
|
|
437
|
+
Number(portText) > 65535) {
|
|
438
|
+
problems.push(`${ServerEmailEnvironmentVariable.SmtpPort}: "${(0, RefusedValue_1.refusedValue)(portText)}" is not a port, a number from 1 to 65535 such as 587.`);
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
put("smtpPort", new Port_1.default(Number(portText)));
|
|
442
|
+
}
|
|
443
|
+
const requireTlsText = take(ServerEmailEnvironmentVariable.SmtpRequireTls).toLowerCase();
|
|
444
|
+
if (requireTlsText === "true") {
|
|
445
|
+
put("isSMTPSecure", true);
|
|
446
|
+
}
|
|
447
|
+
else if (!requireTlsText || requireTlsText === "false") {
|
|
448
|
+
put("isSMTPSecure", false);
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
problems.push(`${ServerEmailEnvironmentVariable.SmtpRequireTls} must be true or false, not "${(0, RefusedValue_1.refusedValue)(requireTlsText)}".`);
|
|
452
|
+
}
|
|
453
|
+
const authType = choice(ServerEmailEnvironmentVariable.SmtpAuthType, exports.SERVER_EMAIL_SMTP_AUTH_TYPE_VALUES, SMTPAuthenticationType_1.default.UsernamePassword);
|
|
454
|
+
put("smtpAuthType", authType);
|
|
455
|
+
if (authType === SMTPAuthenticationType_1.default.UsernamePassword) {
|
|
456
|
+
/*
|
|
457
|
+
* Both or neither: the mail service signs in only with both, so
|
|
458
|
+
* one alone would send without signing in - most often a
|
|
459
|
+
* password that did not arrive from its Secret.
|
|
460
|
+
*/
|
|
461
|
+
const username = take(ServerEmailEnvironmentVariable.SmtpUsername);
|
|
462
|
+
const password = take(ServerEmailEnvironmentVariable.SmtpPassword);
|
|
463
|
+
if (username && !password) {
|
|
464
|
+
notSet(ServerEmailEnvironmentVariable.SmtpPassword, `the mail server is signed in to with ${ServerEmailEnvironmentVariable.SmtpUsername} and a password. Set it, or set ${ServerEmailEnvironmentVariable.SmtpAuthType} to none to send without signing in.`);
|
|
465
|
+
}
|
|
466
|
+
else if (password && !username) {
|
|
467
|
+
notSet(ServerEmailEnvironmentVariable.SmtpUsername, `the mail server is signed in to with a username and ${ServerEmailEnvironmentVariable.SmtpPassword}.`);
|
|
468
|
+
}
|
|
469
|
+
put("smtpUsername", username);
|
|
470
|
+
put("smtpPassword", password);
|
|
471
|
+
}
|
|
472
|
+
else if (authType === SMTPAuthenticationType_1.default.OAuth) {
|
|
473
|
+
const providerType = choice(ServerEmailEnvironmentVariable.SmtpOAuthProviderType, exports.SERVER_EMAIL_SMTP_OAUTH_PROVIDER_TYPE_VALUES, OAuthProviderType_1.default.ClientCredentials);
|
|
474
|
+
// Left empty, as an admin who never picked it: Client Credentials.
|
|
475
|
+
put("smtpOAuthProviderType", value(ServerEmailEnvironmentVariable.SmtpOAuthProviderType)
|
|
476
|
+
? providerType
|
|
477
|
+
: undefined);
|
|
478
|
+
usesJwtBearer = providerType === OAuthProviderType_1.default.JWTBearer;
|
|
479
|
+
/*
|
|
480
|
+
* The mailbox OAuth signs in as, with either grant: the user
|
|
481
|
+
* the mail server's XOAUTH2 sign-in names, and what JWT Bearer
|
|
482
|
+
* impersonates. MailService refuses every email without one,
|
|
483
|
+
* so the settings are not usable without it.
|
|
484
|
+
*/
|
|
485
|
+
const username = take(ServerEmailEnvironmentVariable.SmtpUsername);
|
|
486
|
+
if (!username) {
|
|
487
|
+
notSet(ServerEmailEnvironmentVariable.SmtpUsername, `with ${ServerEmailEnvironmentVariable.SmtpAuthType} ${exports.SERVER_EMAIL_SMTP_AUTH_TYPE_VALUES[SMTPAuthenticationType_1.default.OAuth]}, the mail server is signed in to as that mailbox, such as alerts@example.com.`);
|
|
488
|
+
}
|
|
489
|
+
put("smtpUsername", username);
|
|
490
|
+
usesOAuth = true;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (usesOAuth) {
|
|
494
|
+
const signsInWith = transport === MailTransportType_1.default.MicrosoftGraph
|
|
495
|
+
? "Microsoft Graph sends with an OAuth app's client ID, client secret, token URL and scope."
|
|
496
|
+
: "the mail server is signed in to with an OAuth app's client ID, client secret, token URL and scope.";
|
|
497
|
+
put("smtpClientId", needed(ServerEmailEnvironmentVariable.SmtpOAuthClientId, signsInWith));
|
|
498
|
+
const clientSecret = needed(ServerEmailEnvironmentVariable.SmtpOAuthClientSecret, signsInWith);
|
|
499
|
+
/*
|
|
500
|
+
* JWT Bearer signs its request with a private key, given as the
|
|
501
|
+
* client secret: anything else could never sign in
|
|
502
|
+
* (SMTPOAuthService). Said without the value.
|
|
503
|
+
*/
|
|
504
|
+
if (clientSecret &&
|
|
505
|
+
usesJwtBearer &&
|
|
506
|
+
!(clientSecret.includes("-----BEGIN") &&
|
|
507
|
+
clientSecret.includes("PRIVATE KEY"))) {
|
|
508
|
+
problems.push(`${ServerEmailEnvironmentVariable.SmtpOAuthClientSecret} is not a private key in PEM format (-----BEGIN PRIVATE KEY-----), which ${exports.SERVER_EMAIL_SMTP_OAUTH_PROVIDER_TYPE_VALUES[OAuthProviderType_1.default.JWTBearer]} signs in with.`);
|
|
509
|
+
}
|
|
510
|
+
put("smtpClientSecret", clientSecret);
|
|
511
|
+
const tokenUrlText = needed(ServerEmailEnvironmentVariable.SmtpOAuthTokenUrl, signsInWith);
|
|
512
|
+
if (tokenUrlText) {
|
|
513
|
+
if (ServerEmailEnvironment.isTokenUrl(tokenUrlText)) {
|
|
514
|
+
put("smtpTokenUrl", tokenUrlText);
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
problems.push(`${ServerEmailEnvironmentVariable.SmtpOAuthTokenUrl}: "${(0, RefusedValue_1.refusedValue)(tokenUrlText)}" is not a URL, such as https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token.`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
put("smtpScope", needed(ServerEmailEnvironmentVariable.SmtpOAuthScope, signsInWith));
|
|
521
|
+
}
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
case GlobalConfig_1.EmailServerType.Sendgrid: {
|
|
525
|
+
put("sendgridApiKey", needed(ServerEmailEnvironmentVariable.SendgridApiKey, "SendGrid sends nothing without it."));
|
|
526
|
+
put("sendgridFromEmail", fromEmail);
|
|
527
|
+
put("sendgridFromName", fromName);
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
case GlobalConfig_1.EmailServerType.AmazonSES: {
|
|
531
|
+
const authenticationType = choice(ServerEmailEnvironmentVariable.AmazonSesAuthenticationType, exports.SERVER_EMAIL_AMAZON_SES_AUTHENTICATION_TYPE_VALUES, AmazonSesAuthenticationType_1.default.AccessKey);
|
|
532
|
+
put("amazonSesAuthenticationType", authenticationType);
|
|
533
|
+
/*
|
|
534
|
+
* Signed in as the server's own IAM role (#7000), it needs no key:
|
|
535
|
+
* the credentials are the role's, fetched when the email goes.
|
|
536
|
+
*/
|
|
537
|
+
if (authenticationType === AmazonSesAuthenticationType_1.default.AccessKey) {
|
|
538
|
+
const signsInWith = `Amazon SES is signed in to with an access key, unless ${ServerEmailEnvironmentVariable.AmazonSesAuthenticationType} is ${exports.SERVER_EMAIL_AMAZON_SES_AUTHENTICATION_TYPE_VALUES[AmazonSesAuthenticationType_1.default.ServerIamRole]}.`;
|
|
539
|
+
put("amazonSesAccessKeyId", needed(ServerEmailEnvironmentVariable.AmazonSesAccessKeyId, signsInWith));
|
|
540
|
+
put("amazonSesSecretAccessKey", needed(ServerEmailEnvironmentVariable.AmazonSesSecretAccessKey, signsInWith));
|
|
541
|
+
}
|
|
542
|
+
const regionText = take(ServerEmailEnvironmentVariable.AmazonSesRegion).toLowerCase();
|
|
543
|
+
if (!regionText) {
|
|
544
|
+
notSet(ServerEmailEnvironmentVariable.AmazonSesRegion, "Amazon SES sends from the Region your sender is verified in, such as us-east-1.");
|
|
545
|
+
}
|
|
546
|
+
else if (!(0, AwsRegionCode_1.isAwsRegion)(regionText)) {
|
|
547
|
+
problems.push(`${ServerEmailEnvironmentVariable.AmazonSesRegion}: "${(0, RefusedValue_1.refusedValue)(regionText)}" is not an AWS Region code, such as us-east-1.`);
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
put("amazonSesRegion", regionText);
|
|
551
|
+
}
|
|
552
|
+
put("amazonSesFromEmail", fromEmail);
|
|
553
|
+
put("amazonSesFromName", fromName);
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
case GlobalConfig_1.EmailServerType.Mailgun: {
|
|
557
|
+
put("mailgunApiKey", needed(ServerEmailEnvironmentVariable.MailgunApiKey, "Mailgun sends nothing without it."));
|
|
558
|
+
const domainText = take(ServerEmailEnvironmentVariable.MailgunDomain).toLowerCase();
|
|
559
|
+
if (!domainText) {
|
|
560
|
+
notSet(ServerEmailEnvironmentVariable.MailgunDomain, "Mailgun sends from that domain, such as mg.example.com.");
|
|
561
|
+
}
|
|
562
|
+
else if (!(0, MailgunDomain_1.isMailgunDomain)(domainText)) {
|
|
563
|
+
problems.push(`${ServerEmailEnvironmentVariable.MailgunDomain}: "${(0, RefusedValue_1.refusedValue)(domainText)}" is not a domain, such as mg.example.com.`);
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
put("mailgunDomain", domainText);
|
|
567
|
+
}
|
|
568
|
+
put("mailgunRegion", choice(ServerEmailEnvironmentVariable.MailgunRegion, exports.SERVER_EMAIL_MAILGUN_REGION_VALUES, MailgunRegion_1.default.US));
|
|
569
|
+
put("mailgunFromEmail", fromEmail);
|
|
570
|
+
put("mailgunFromName", fromName);
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
case GlobalConfig_1.EmailServerType.Postmark: {
|
|
574
|
+
put("postmarkServerToken", needed(ServerEmailEnvironmentVariable.PostmarkServerToken, "Postmark sends nothing without the server's API token."));
|
|
575
|
+
put("postmarkFromEmail", fromEmail);
|
|
576
|
+
put("postmarkFromName", fromName);
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
case GlobalConfig_1.EmailServerType.Resend: {
|
|
580
|
+
put("resendApiKey", needed(ServerEmailEnvironmentVariable.ResendApiKey, "Resend sends nothing without it."));
|
|
581
|
+
put("resendFromEmail", fromEmail);
|
|
582
|
+
put("resendFromName", fromName);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
// In the variables' own order, whatever order they were read in.
|
|
587
|
+
const orderedProblems = [...problems].sort((a, b) => {
|
|
588
|
+
return (ServerEmailEnvironment.variableOrderOf(a) -
|
|
589
|
+
ServerEmailEnvironment.variableOrderOf(b));
|
|
590
|
+
});
|
|
591
|
+
return {
|
|
592
|
+
isSet: true,
|
|
593
|
+
serverType: serverType,
|
|
594
|
+
settings: settings,
|
|
595
|
+
problems: orderedProblems,
|
|
596
|
+
ignored: setVariables.filter((variable) => {
|
|
597
|
+
return !readVariables.has(variable);
|
|
598
|
+
}),
|
|
599
|
+
values: values,
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
// Where a problem's variable comes in SERVER_EMAIL_ENVIRONMENT_VARIABLES.
|
|
603
|
+
static variableOrderOf(problem) {
|
|
604
|
+
const index = exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES.findIndex((variable) => {
|
|
605
|
+
return (problem.startsWith(`${variable} `) ||
|
|
606
|
+
problem.startsWith(`${variable}:`));
|
|
607
|
+
});
|
|
608
|
+
return index === -1 ? exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES.length : index;
|
|
609
|
+
}
|
|
610
|
+
// Whether the settings the variables set can send: set, with nothing wrong.
|
|
611
|
+
static isUsable(reading) {
|
|
612
|
+
return (reading.isSet &&
|
|
613
|
+
reading.serverType !== null &&
|
|
614
|
+
reading.settings !== null &&
|
|
615
|
+
reading.problems.length === 0);
|
|
616
|
+
}
|
|
617
|
+
/*
|
|
618
|
+
* The variables the chosen settings read, in the order the Admin
|
|
619
|
+
* Dashboard lists them: the type, its own settings, then who the emails
|
|
620
|
+
* come from.
|
|
621
|
+
*/
|
|
622
|
+
static getReadVariables(reading) {
|
|
623
|
+
if (!reading.isSet) {
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
// A type that is not one: only it, beside the problem that says so.
|
|
627
|
+
if (!reading.serverType || !reading.settings) {
|
|
628
|
+
return [ServerEmailEnvironmentVariable.ServerType];
|
|
629
|
+
}
|
|
630
|
+
const settings = reading.settings;
|
|
631
|
+
const own = [];
|
|
632
|
+
switch (reading.serverType) {
|
|
633
|
+
case GlobalConfig_1.EmailServerType.CustomSMTP: {
|
|
634
|
+
own.push(ServerEmailEnvironmentVariable.SmtpTransport);
|
|
635
|
+
const isGraph = settings.smtpTransportType === MailTransportType_1.default.MicrosoftGraph;
|
|
636
|
+
if (!isGraph) {
|
|
637
|
+
own.push(ServerEmailEnvironmentVariable.SmtpHost, ServerEmailEnvironmentVariable.SmtpPort, ServerEmailEnvironmentVariable.SmtpRequireTls, ServerEmailEnvironmentVariable.SmtpAuthType);
|
|
638
|
+
if (settings.smtpAuthType === SMTPAuthenticationType_1.default.UsernamePassword) {
|
|
639
|
+
own.push(ServerEmailEnvironmentVariable.SmtpUsername, ServerEmailEnvironmentVariable.SmtpPassword);
|
|
640
|
+
}
|
|
641
|
+
else if (settings.smtpAuthType === SMTPAuthenticationType_1.default.OAuth) {
|
|
642
|
+
own.push(ServerEmailEnvironmentVariable.SmtpUsername, ServerEmailEnvironmentVariable.SmtpOAuthProviderType);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (isGraph || settings.smtpAuthType === SMTPAuthenticationType_1.default.OAuth) {
|
|
646
|
+
own.push(ServerEmailEnvironmentVariable.SmtpOAuthClientId, ServerEmailEnvironmentVariable.SmtpOAuthClientSecret, ServerEmailEnvironmentVariable.SmtpOAuthTokenUrl, ServerEmailEnvironmentVariable.SmtpOAuthScope);
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
case GlobalConfig_1.EmailServerType.Sendgrid:
|
|
651
|
+
own.push(ServerEmailEnvironmentVariable.SendgridApiKey);
|
|
652
|
+
break;
|
|
653
|
+
case GlobalConfig_1.EmailServerType.AmazonSES:
|
|
654
|
+
own.push(ServerEmailEnvironmentVariable.AmazonSesAuthenticationType);
|
|
655
|
+
if (settings.amazonSesAuthenticationType !==
|
|
656
|
+
AmazonSesAuthenticationType_1.default.ServerIamRole) {
|
|
657
|
+
own.push(ServerEmailEnvironmentVariable.AmazonSesAccessKeyId, ServerEmailEnvironmentVariable.AmazonSesSecretAccessKey);
|
|
658
|
+
}
|
|
659
|
+
own.push(ServerEmailEnvironmentVariable.AmazonSesRegion);
|
|
660
|
+
break;
|
|
661
|
+
case GlobalConfig_1.EmailServerType.Mailgun:
|
|
662
|
+
own.push(ServerEmailEnvironmentVariable.MailgunApiKey, ServerEmailEnvironmentVariable.MailgunDomain, ServerEmailEnvironmentVariable.MailgunRegion);
|
|
663
|
+
break;
|
|
664
|
+
case GlobalConfig_1.EmailServerType.Postmark:
|
|
665
|
+
own.push(ServerEmailEnvironmentVariable.PostmarkServerToken);
|
|
666
|
+
break;
|
|
667
|
+
case GlobalConfig_1.EmailServerType.Resend:
|
|
668
|
+
own.push(ServerEmailEnvironmentVariable.ResendApiKey);
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
return [
|
|
672
|
+
ServerEmailEnvironmentVariable.ServerType,
|
|
673
|
+
...own,
|
|
674
|
+
ServerEmailEnvironmentVariable.FromEmail,
|
|
675
|
+
ServerEmailEnvironmentVariable.FromName,
|
|
676
|
+
];
|
|
677
|
+
}
|
|
678
|
+
// What the Admin Dashboard is told: never a password or a key.
|
|
679
|
+
static toAnswer(reading) {
|
|
680
|
+
if (!reading.isSet) {
|
|
681
|
+
return Object.assign(Object.assign({}, NO_SETTINGS_ANSWER), { problems: [...reading.problems] });
|
|
682
|
+
}
|
|
683
|
+
const fields = ServerEmailEnvironment.getReadVariables(reading).map((variable) => {
|
|
684
|
+
const text = reading.values[variable] || "";
|
|
685
|
+
const isSecret = ServerEmailEnvironment.isSecret(variable);
|
|
686
|
+
return {
|
|
687
|
+
variable: variable,
|
|
688
|
+
value: isSecret || !text ? null : text,
|
|
689
|
+
isSecret: isSecret,
|
|
690
|
+
isSet: Boolean(text),
|
|
691
|
+
};
|
|
692
|
+
});
|
|
693
|
+
return {
|
|
694
|
+
isSetByEnvironment: true,
|
|
695
|
+
serverType: reading.serverType,
|
|
696
|
+
fields: fields,
|
|
697
|
+
problems: [...reading.problems],
|
|
698
|
+
ignored: [...reading.ignored],
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/*
|
|
702
|
+
* The answer as the Admin Dashboard reads it back. Anything that is not
|
|
703
|
+
* the answer's shape reads as the variables not set, so the page shows
|
|
704
|
+
* the saved settings and their Edit buttons, and the server still refuses
|
|
705
|
+
* a write it must not take.
|
|
706
|
+
*/
|
|
707
|
+
static answerFromJSON(json) {
|
|
708
|
+
if (!json || typeof json !== "object" || Array.isArray(json)) {
|
|
709
|
+
return Object.assign(Object.assign({}, NO_SETTINGS_ANSWER), { fields: [], problems: [], ignored: [] });
|
|
710
|
+
}
|
|
711
|
+
const data = json;
|
|
712
|
+
const isVariable = (variable) => {
|
|
713
|
+
return exports.SERVER_EMAIL_ENVIRONMENT_VARIABLES.includes(variable);
|
|
714
|
+
};
|
|
715
|
+
const texts = (key) => {
|
|
716
|
+
return Array.isArray(data[key])
|
|
717
|
+
? data[key].filter((text) => {
|
|
718
|
+
return typeof text === "string" && text.length > 0;
|
|
719
|
+
})
|
|
720
|
+
: [];
|
|
721
|
+
};
|
|
722
|
+
const serverType = data["serverType"];
|
|
723
|
+
const fields = Array.isArray(data["fields"])
|
|
724
|
+
? data["fields"].flatMap((field) => {
|
|
725
|
+
if (!field || typeof field !== "object" || Array.isArray(field)) {
|
|
726
|
+
return [];
|
|
727
|
+
}
|
|
728
|
+
const entry = field;
|
|
729
|
+
if (!isVariable(entry["variable"])) {
|
|
730
|
+
return [];
|
|
731
|
+
}
|
|
732
|
+
const variable = entry["variable"];
|
|
733
|
+
const isSecret = ServerEmailEnvironment.isSecret(variable);
|
|
734
|
+
const value = entry["value"];
|
|
735
|
+
return [
|
|
736
|
+
{
|
|
737
|
+
variable: variable,
|
|
738
|
+
// A secret's value is never shown, whatever came back.
|
|
739
|
+
value: !isSecret && typeof value === "string" && value.trim()
|
|
740
|
+
? value
|
|
741
|
+
: null,
|
|
742
|
+
isSecret: isSecret,
|
|
743
|
+
isSet: entry["isSet"] === true,
|
|
744
|
+
},
|
|
745
|
+
];
|
|
746
|
+
})
|
|
747
|
+
: [];
|
|
748
|
+
return {
|
|
749
|
+
isSetByEnvironment: data["isSetByEnvironment"] === true,
|
|
750
|
+
serverType: Object.values(GlobalConfig_1.EmailServerType).includes(serverType)
|
|
751
|
+
? serverType
|
|
752
|
+
: null,
|
|
753
|
+
fields: fields,
|
|
754
|
+
problems: texts("problems"),
|
|
755
|
+
ignored: texts("ignored").filter(isVariable),
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
/*
|
|
759
|
+
* What the server says once as it starts, so nobody looks for the
|
|
760
|
+
* settings in the Admin Dashboard: the variables set them. Null when
|
|
761
|
+
* GLOBAL_EMAIL_SERVER_TYPE is not set.
|
|
762
|
+
*/
|
|
763
|
+
static getStartupNotice(reading) {
|
|
764
|
+
if (!reading.isSet) {
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
return `The server's email settings are set by environment variables (${ServerEmailEnvironmentVariable.ServerType} and the other GLOBAL_EMAIL_ variables): the settings saved in the Admin Dashboard are not used.`;
|
|
768
|
+
}
|
|
769
|
+
/*
|
|
770
|
+
* The variables that hold a value nothing reads with the chosen settings,
|
|
771
|
+
* as the server and the Admin Dashboard say it. Null when there are none.
|
|
772
|
+
*/
|
|
773
|
+
static getIgnoredMessage(reading) {
|
|
774
|
+
if (!reading.isSet || reading.ignored.length === 0) {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
const count = reading.ignored.length;
|
|
778
|
+
return `${listed(reading.ignored)} ${count === 1 ? "is" : "are"} set, but the email settings the GLOBAL_EMAIL_ variables describe do not read ${count === 1 ? "it" : "them"}, so ${count === 1 ? "it changes" : "they change"} nothing. Remove ${count === 1 ? "it" : "them"}, or check ${ServerEmailEnvironmentVariable.ServerType} and the variables that pick how email is sent.`;
|
|
779
|
+
}
|
|
780
|
+
// What is wrong with the variables, as the server says it when it starts.
|
|
781
|
+
static getStartupWarning(reading) {
|
|
782
|
+
const ignored = ServerEmailEnvironment.getIgnoredMessage(reading);
|
|
783
|
+
if (reading.problems.length === 0) {
|
|
784
|
+
return ignored;
|
|
785
|
+
}
|
|
786
|
+
if (!reading.isSet) {
|
|
787
|
+
return reading.problems.join(" ");
|
|
788
|
+
}
|
|
789
|
+
const warning = `The email settings set by environment variables send no email until this is fixed: ${reading.problems.join(" ")}`;
|
|
790
|
+
return ignored ? `${warning} ${ignored}` : warning;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
exports.default = ServerEmailEnvironment;
|