@oneuptime/common 10.0.53 → 10.0.54
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/Metric.ts +78 -0
- package/Server/API/AIAgentDataAPI.ts +6 -1
- package/Server/API/BillingAPI.ts +28 -6
- package/Server/API/CommonAPI.ts +11 -0
- package/Server/API/DashboardAPI.ts +6 -2
- package/Server/API/DashboardDomainAPI.ts +10 -3
- package/Server/API/GitHubAPI.ts +58 -14
- package/Server/API/MicrosoftTeamsAPI.ts +97 -33
- package/Server/API/OpenSourceDeploymentAPI.ts +2 -2
- package/Server/API/SlackAPI.ts +107 -36
- package/Server/API/StatusAPI.ts +37 -16
- package/Server/API/StatusPageAPI.ts +97 -23
- package/Server/API/StatusPageDomainAPI.ts +6 -3
- package/Server/API/UserAPI.ts +3 -3
- package/Server/API/UserCallAPI.ts +5 -2
- package/Server/API/UserEmailAPI.ts +5 -2
- package/Server/API/UserPushAPI.ts +9 -3
- package/Server/API/UserSmsAPI.ts +5 -2
- package/Server/API/UserWhatsAppAPI.ts +5 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/NotificationMiddleware.ts +2 -2
- package/Server/Middleware/ProjectAuthorization.ts +6 -0
- package/Server/Middleware/SCIMAuthorization.ts +2 -1
- package/Server/Middleware/SlackAuthorization.ts +28 -10
- package/Server/Middleware/TelemetryIngest.ts +16 -3
- package/Server/Middleware/UserAuthorization.ts +22 -5
- package/Server/Middleware/WhatsAppAuthorization.ts +15 -4
- package/Server/Services/AIAgentService.ts +13 -6
- package/Server/Services/AIService.ts +9 -3
- package/Server/Services/AlertEpisodeFeedService.ts +17 -5
- package/Server/Services/AlertEpisodeService.ts +34 -3
- package/Server/Services/AlertEpisodeStateTimelineService.ts +80 -22
- package/Server/Services/AlertFeedService.ts +17 -5
- package/Server/Services/AlertGroupingEngineService.ts +36 -7
- package/Server/Services/AlertService.ts +60 -8
- package/Server/Services/AlertStateTimelineService.ts +29 -7
- package/Server/Services/AnalyticsDatabaseService.ts +59 -25
- package/Server/Services/BillingInvoiceService.ts +7 -3
- package/Server/Services/BillingService.ts +9 -2
- package/Server/Services/DashboardDomainService.ts +56 -22
- package/Server/Services/DashboardService.ts +11 -4
- package/Server/Services/DatabaseService.ts +31 -11
- package/Server/Services/IncidentEpisodeFeedService.ts +17 -5
- package/Server/Services/IncidentEpisodeService.ts +34 -3
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +80 -22
- package/Server/Services/IncidentFeedService.ts +33 -9
- package/Server/Services/IncidentGroupingEngineService.ts +35 -6
- package/Server/Services/IncidentService.ts +103 -9
- package/Server/Services/IncidentSlaRuleService.ts +16 -4
- package/Server/Services/IncidentSlaService.ts +20 -4
- package/Server/Services/IncidentStateTimelineService.ts +120 -31
- package/Server/Services/KubernetesClusterService.ts +62 -14
- package/Server/Services/MonitorFeedService.ts +33 -9
- package/Server/Services/MonitorProbeService.ts +4 -2
- package/Server/Services/MonitorService.ts +35 -4
- package/Server/Services/MonitorStatusTimelineService.ts +68 -20
- package/Server/Services/NotificationService.ts +4 -2
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +53 -9
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +9 -2
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +29 -8
- package/Server/Services/OnCallDutyPolicyFeedService.ts +33 -8
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +97 -24
- package/Server/Services/OnCallDutyPolicyService.ts +2 -1
- package/Server/Services/OpenTelemetryIngestService.ts +51 -20
- package/Server/Services/ProbeService.ts +16 -7
- package/Server/Services/ProjectService.ts +21 -7
- package/Server/Services/ScheduledMaintenanceFeedService.ts +17 -4
- package/Server/Services/ScheduledMaintenanceService.ts +52 -6
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +72 -20
- package/Server/Services/StatusPageDomainService.ts +59 -23
- package/Server/Services/StatusPageService.ts +26 -8
- package/Server/Services/StatusPageSubscriberService.ts +382 -111
- package/Server/Services/TeamMemberService.ts +9 -3
- package/Server/Services/UserNotificationRuleService.ts +9 -3
- package/Server/Services/UserService.ts +6 -4
- package/Server/Services/UserWhatsAppService.ts +9 -3
- package/Server/Services/WorkflowService.ts +7 -3
- package/Server/Services/WorkspaceNotificationRuleService.ts +398 -156
- package/Server/Types/Domain.ts +15 -5
- package/Server/Types/Workflow/Components/API/Post.ts +22 -8
- package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +12 -4
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +10 -0
- package/Server/Utils/CodeRepository/CodeRepository.ts +62 -13
- package/Server/Utils/Express.ts +1 -0
- package/Server/Utils/Greenlock/Greenlock.ts +75 -20
- package/Server/Utils/LLM/LLMService.ts +22 -7
- package/Server/Utils/Logger.ts +93 -13
- package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +15 -5
- package/Server/Utils/Monitor/MonitorIncident.ts +17 -3
- package/Server/Utils/Monitor/MonitorStatusTimeline.ts +6 -1
- package/Server/Utils/Profiling.ts +11 -5
- package/Server/Utils/Realtime.ts +90 -31
- package/Server/Utils/Response.ts +2 -2
- package/Server/Utils/StartServer.ts +43 -9
- package/Server/Utils/Telemetry/SpanUtil.ts +90 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +58 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +58 -15
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +19 -3
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +87 -22
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +12 -3
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.ts +25 -7
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +55 -8
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +100 -22
- package/Server/Utils/Workspace/Slack/Actions/Alert.ts +35 -9
- package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +32 -8
- package/Server/Utils/Workspace/Slack/Actions/Auth.ts +3 -1
- package/Server/Utils/Workspace/Slack/Actions/Incident.ts +52 -11
- package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +4 -1
- package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +89 -20
- package/Server/Utils/Workspace/Slack/Slack.ts +498 -247
- package/Server/Utils/Workspace/Workspace.ts +33 -11
- package/Server/Utils/Workspace/WorkspaceBase.ts +3 -1
- package/Server/Utils/Workspace/WorkspaceMessages/Alert.ts +8 -2
- package/Tests/Server/Middleware/UserAuthorization.test.ts +1 -1
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +12 -3
- package/UI/Components/Charts/Area/AreaChart.tsx +35 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +7 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +33 -0
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +33 -0
- package/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.ts +14 -0
- package/UI/Components/Charts/Line/LineChart.tsx +35 -1
- package/UI/Components/Charts/Types/ExemplarPoint.ts +6 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +3 -3
- package/UI/Components/Navbar/NavBar.tsx +10 -0
- package/build/dist/Models/AnalyticsModels/Metric.js +70 -0
- package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +6 -6
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/BillingAPI.js +13 -13
- package/build/dist/Server/API/BillingAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +5 -0
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +2 -2
- package/build/dist/Server/API/DashboardAPI.js.map +1 -1
- package/build/dist/Server/API/DashboardDomainAPI.js +3 -3
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
- package/build/dist/Server/API/GitHubAPI.js +19 -19
- package/build/dist/Server/API/GitHubAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +34 -34
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/OpenSourceDeploymentAPI.js +2 -2
- package/build/dist/Server/API/OpenSourceDeploymentAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +38 -38
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/StatusAPI.js +16 -16
- package/build/dist/Server/API/StatusAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +52 -52
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageDomainAPI.js +3 -3
- package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
- package/build/dist/Server/API/UserAPI.js +3 -3
- package/build/dist/Server/API/UserAPI.js.map +1 -1
- package/build/dist/Server/API/UserCallAPI.js +2 -2
- package/build/dist/Server/API/UserCallAPI.js.map +1 -1
- package/build/dist/Server/API/UserEmailAPI.js +2 -2
- package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
- package/build/dist/Server/API/UserPushAPI.js +3 -3
- package/build/dist/Server/API/UserPushAPI.js.map +1 -1
- package/build/dist/Server/API/UserSmsAPI.js +2 -2
- package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
- package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
- package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/NotificationMiddleware.js +2 -2
- package/build/dist/Server/Middleware/NotificationMiddleware.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +5 -0
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SCIMAuthorization.js +2 -2
- package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SlackAuthorization.js +10 -10
- package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +9 -4
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +10 -5
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js +6 -6
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js.map +1 -1
- package/build/dist/Server/Services/AIAgentService.js +13 -7
- package/build/dist/Server/Services/AIAgentService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +9 -2
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeFeedService.js +17 -5
- package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeService.js +40 -10
- package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +81 -24
- package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AlertFeedService.js +17 -5
- package/build/dist/Server/Services/AlertFeedService.js.map +1 -1
- package/build/dist/Server/Services/AlertGroupingEngineService.js +44 -28
- package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +72 -20
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/AlertStateTimelineService.js +36 -13
- package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +52 -28
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/BillingInvoiceService.js +7 -2
- package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +8 -8
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +49 -27
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
- package/build/dist/Server/Services/DashboardService.js +11 -4
- package/build/dist/Server/Services/DashboardService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +32 -12
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js +17 -5
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeService.js +40 -10
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +81 -24
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentFeedService.js +34 -10
- package/build/dist/Server/Services/IncidentFeedService.js.map +1 -1
- package/build/dist/Server/Services/IncidentGroupingEngineService.js +43 -29
- package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +116 -28
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSlaRuleService.js +19 -11
- package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncidentSlaService.js +21 -14
- package/build/dist/Server/Services/IncidentSlaService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +130 -37
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/KubernetesClusterService.js +51 -14
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
- package/build/dist/Server/Services/MonitorFeedService.js +34 -10
- package/build/dist/Server/Services/MonitorFeedService.js.map +1 -1
- package/build/dist/Server/Services/MonitorProbeService.js +4 -2
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +42 -11
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +69 -21
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/NotificationService.js +4 -3
- package/build/dist/Server/Services/NotificationService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +49 -12
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +9 -3
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +26 -11
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js +34 -10
- package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +94 -37
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +45 -17
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +13 -7
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +33 -17
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js +17 -5
- package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +71 -24
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +72 -24
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +55 -29
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +29 -9
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberService.js +393 -130
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +10 -2
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +10 -2
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +8 -3
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserWhatsAppService.js +10 -2
- package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -1
- package/build/dist/Server/Services/WorkflowService.js +7 -2
- package/build/dist/Server/Services/WorkflowService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +367 -180
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/Domain.js +12 -6
- package/build/dist/Server/Types/Domain.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -7
- package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +11 -4
- package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +7 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +45 -17
- package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +36 -29
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +18 -6
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +61 -13
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +23 -20
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +13 -4
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -22
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +6 -3
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Server/Utils/Profiling.js +9 -6
- package/build/dist/Server/Utils/Profiling.js.map +1 -1
- package/build/dist/Server/Utils/Realtime.js +50 -34
- package/build/dist/Server/Utils/Realtime.js.map +1 -1
- package/build/dist/Server/Utils/Response.js +2 -2
- package/build/dist/Server/Utils/Response.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +23 -11
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js +52 -0
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +58 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +58 -15
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +19 -5
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +90 -26
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +12 -3
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js +25 -7
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +58 -19
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +102 -29
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +38 -9
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +34 -8
- package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +3 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +55 -13
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +5 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +91 -26
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +355 -270
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Workspace.js +21 -12
- package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +3 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js +9 -2
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js.map +1 -1
- package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js +1 -1
- package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js +12 -6
- package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +20 -2
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +9 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +9 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +20 -2
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js.map +1 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +3 -3
- package/build/dist/UI/Components/Navbar/NavBar.js +9 -1
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,29 +36,55 @@ export class Service extends DatabaseService {
|
|
|
36
36
|
super(Model);
|
|
37
37
|
}
|
|
38
38
|
async onBeforeCreate(data) {
|
|
39
|
-
|
|
40
|
-
logger.debug(data
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
|
|
40
|
+
logger.debug("onBeforeCreate called with data:", {
|
|
41
|
+
projectId: (_a = data.data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
42
|
+
statusPageId: (_b = data.data.statusPageId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
43
|
+
});
|
|
44
|
+
logger.debug(data, {
|
|
45
|
+
projectId: (_c = data.data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
46
|
+
statusPageId: (_d = data.data.statusPageId) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
47
|
+
});
|
|
41
48
|
if (!data.data.statusPageId) {
|
|
42
|
-
logger.debug("Status Page ID is missing."
|
|
49
|
+
logger.debug("Status Page ID is missing.", {
|
|
50
|
+
projectId: (_e = data.data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
51
|
+
});
|
|
43
52
|
throw new BadDataException("Status Page ID is required.");
|
|
44
53
|
}
|
|
45
54
|
if (!data.data.projectId) {
|
|
46
|
-
logger.debug("Project ID is missing."
|
|
55
|
+
logger.debug("Project ID is missing.", {
|
|
56
|
+
statusPageId: (_f = data.data.statusPageId) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
57
|
+
});
|
|
47
58
|
throw new BadDataException("Project ID is required.");
|
|
48
59
|
}
|
|
49
60
|
const projectId = data.data.projectId;
|
|
50
|
-
logger.debug(`Project ID: ${projectId}
|
|
61
|
+
logger.debug(`Project ID: ${projectId}`, {
|
|
62
|
+
projectId: (_g = data.data.projectId) === null || _g === void 0 ? void 0 : _g.toString(),
|
|
63
|
+
statusPageId: (_h = data.data.statusPageId) === null || _h === void 0 ? void 0 : _h.toString(),
|
|
64
|
+
});
|
|
51
65
|
// if the project is on the free plan, then only allow 1 status page.
|
|
52
66
|
if (IsBillingEnabled) {
|
|
53
|
-
logger.debug("Billing is enabled."
|
|
67
|
+
logger.debug("Billing is enabled.", {
|
|
68
|
+
projectId: (_j = data.data.projectId) === null || _j === void 0 ? void 0 : _j.toString(),
|
|
69
|
+
statusPageId: (_k = data.data.statusPageId) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
70
|
+
});
|
|
54
71
|
const currentPlan = await ProjectService.getCurrentPlan(projectId);
|
|
55
|
-
logger.debug(`Current Plan: ${JSON.stringify(currentPlan)}
|
|
72
|
+
logger.debug(`Current Plan: ${JSON.stringify(currentPlan)}`, {
|
|
73
|
+
projectId: (_l = data.data.projectId) === null || _l === void 0 ? void 0 : _l.toString(),
|
|
74
|
+
statusPageId: (_m = data.data.statusPageId) === null || _m === void 0 ? void 0 : _m.toString(),
|
|
75
|
+
});
|
|
56
76
|
if (currentPlan.isSubscriptionUnpaid) {
|
|
57
|
-
logger.debug("Subscription is unpaid."
|
|
77
|
+
logger.debug("Subscription is unpaid.", {
|
|
78
|
+
projectId: (_o = data.data.projectId) === null || _o === void 0 ? void 0 : _o.toString(),
|
|
79
|
+
statusPageId: (_p = data.data.statusPageId) === null || _p === void 0 ? void 0 : _p.toString(),
|
|
80
|
+
});
|
|
58
81
|
throw new BadDataException("Your subscription is unpaid. Please update your payment method and to add subscribers.");
|
|
59
82
|
}
|
|
60
83
|
if (currentPlan.plan === PlanType.Free) {
|
|
61
|
-
logger.debug("Current plan is Free."
|
|
84
|
+
logger.debug("Current plan is Free.", {
|
|
85
|
+
projectId: (_q = data.data.projectId) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
86
|
+
statusPageId: (_r = data.data.statusPageId) === null || _r === void 0 ? void 0 : _r.toString(),
|
|
87
|
+
});
|
|
62
88
|
const subscribersCount = await this.countBy({
|
|
63
89
|
query: {
|
|
64
90
|
projectId: projectId,
|
|
@@ -67,16 +93,25 @@ export class Service extends DatabaseService {
|
|
|
67
93
|
isRoot: true,
|
|
68
94
|
},
|
|
69
95
|
});
|
|
70
|
-
logger.debug(`Subscribers Count: ${subscribersCount.toNumber()}
|
|
96
|
+
logger.debug(`Subscribers Count: ${subscribersCount.toNumber()}`, {
|
|
97
|
+
projectId: (_s = data.data.projectId) === null || _s === void 0 ? void 0 : _s.toString(),
|
|
98
|
+
statusPageId: (_t = data.data.statusPageId) === null || _t === void 0 ? void 0 : _t.toString(),
|
|
99
|
+
});
|
|
71
100
|
if (subscribersCount.toNumber() >= AllowedSubscribersCountInFreePlan) {
|
|
72
|
-
logger.debug("Reached maximum allowed subscriber limit for the free plan."
|
|
101
|
+
logger.debug("Reached maximum allowed subscriber limit for the free plan.", {
|
|
102
|
+
projectId: (_u = data.data.projectId) === null || _u === void 0 ? void 0 : _u.toString(),
|
|
103
|
+
statusPageId: (_v = data.data.statusPageId) === null || _v === void 0 ? void 0 : _v.toString(),
|
|
104
|
+
});
|
|
73
105
|
throw new BadDataException(`You have reached the maximum allowed subscriber limit for the free plan. Please upgrade your plan to add more subscribers.`);
|
|
74
106
|
}
|
|
75
107
|
}
|
|
76
108
|
}
|
|
77
109
|
let subscriber = null;
|
|
78
110
|
if (data.data.subscriberEmail) {
|
|
79
|
-
logger.debug(`Subscriber Email: ${data.data.subscriberEmail}
|
|
111
|
+
logger.debug(`Subscriber Email: ${data.data.subscriberEmail}`, {
|
|
112
|
+
projectId: (_w = data.data.projectId) === null || _w === void 0 ? void 0 : _w.toString(),
|
|
113
|
+
statusPageId: (_x = data.data.statusPageId) === null || _x === void 0 ? void 0 : _x.toString(),
|
|
114
|
+
});
|
|
80
115
|
subscriber = await this.findOneBy({
|
|
81
116
|
query: {
|
|
82
117
|
statusPageId: data.data.statusPageId,
|
|
@@ -91,15 +126,27 @@ export class Service extends DatabaseService {
|
|
|
91
126
|
ignoreHooks: true,
|
|
92
127
|
},
|
|
93
128
|
});
|
|
94
|
-
logger.debug(`Found Subscriber by Email: ${JSON.stringify(subscriber)}
|
|
129
|
+
logger.debug(`Found Subscriber by Email: ${JSON.stringify(subscriber)}`, {
|
|
130
|
+
projectId: (_y = data.data.projectId) === null || _y === void 0 ? void 0 : _y.toString(),
|
|
131
|
+
statusPageId: (_z = data.data.statusPageId) === null || _z === void 0 ? void 0 : _z.toString(),
|
|
132
|
+
});
|
|
95
133
|
}
|
|
96
134
|
if (data.data.subscriberPhone) {
|
|
97
|
-
logger.debug(`Subscriber Phone: ${data.data.subscriberPhone}
|
|
135
|
+
logger.debug(`Subscriber Phone: ${data.data.subscriberPhone}`, {
|
|
136
|
+
projectId: (_0 = data.data.projectId) === null || _0 === void 0 ? void 0 : _0.toString(),
|
|
137
|
+
statusPageId: (_1 = data.data.statusPageId) === null || _1 === void 0 ? void 0 : _1.toString(),
|
|
138
|
+
});
|
|
98
139
|
// check if this project has SMS enabled.
|
|
99
140
|
const isSMSEnabled = await ProjectService.isSMSNotificationsEnabled(projectId);
|
|
100
|
-
logger.debug(`Is SMS Enabled: ${isSMSEnabled}
|
|
141
|
+
logger.debug(`Is SMS Enabled: ${isSMSEnabled}`, {
|
|
142
|
+
projectId: (_2 = data.data.projectId) === null || _2 === void 0 ? void 0 : _2.toString(),
|
|
143
|
+
statusPageId: (_3 = data.data.statusPageId) === null || _3 === void 0 ? void 0 : _3.toString(),
|
|
144
|
+
});
|
|
101
145
|
if (!isSMSEnabled) {
|
|
102
|
-
logger.debug("SMS notifications are not enabled for this project."
|
|
146
|
+
logger.debug("SMS notifications are not enabled for this project.", {
|
|
147
|
+
projectId: (_4 = data.data.projectId) === null || _4 === void 0 ? void 0 : _4.toString(),
|
|
148
|
+
statusPageId: (_5 = data.data.statusPageId) === null || _5 === void 0 ? void 0 : _5.toString(),
|
|
149
|
+
});
|
|
103
150
|
throw new BadDataException("SMS notifications are not enabled for this project. Please enable SMS notifications in the Project Settings > Notifications Settings.");
|
|
104
151
|
}
|
|
105
152
|
subscriber = await this.findOneBy({
|
|
@@ -116,15 +163,24 @@ export class Service extends DatabaseService {
|
|
|
116
163
|
ignoreHooks: true,
|
|
117
164
|
},
|
|
118
165
|
});
|
|
119
|
-
logger.debug(`Found Subscriber by Phone: ${JSON.stringify(subscriber)}
|
|
166
|
+
logger.debug(`Found Subscriber by Phone: ${JSON.stringify(subscriber)}`, {
|
|
167
|
+
projectId: (_6 = data.data.projectId) === null || _6 === void 0 ? void 0 : _6.toString(),
|
|
168
|
+
statusPageId: (_7 = data.data.statusPageId) === null || _7 === void 0 ? void 0 : _7.toString(),
|
|
169
|
+
});
|
|
120
170
|
}
|
|
121
171
|
if (subscriber && !subscriber.isUnsubscribed) {
|
|
122
|
-
logger.debug("Subscriber is already subscribed and not unsubscribed."
|
|
172
|
+
logger.debug("Subscriber is already subscribed and not unsubscribed.", {
|
|
173
|
+
projectId: (_8 = data.data.projectId) === null || _8 === void 0 ? void 0 : _8.toString(),
|
|
174
|
+
statusPageId: (_9 = data.data.statusPageId) === null || _9 === void 0 ? void 0 : _9.toString(),
|
|
175
|
+
});
|
|
123
176
|
throw new BadDataException("You are already subscribed to this status page.");
|
|
124
177
|
}
|
|
125
178
|
// if the user is unsubscribed, delete this record and it'll create a new one.
|
|
126
179
|
if (subscriber) {
|
|
127
|
-
logger.debug("Subscriber is unsubscribed. Deleting old record."
|
|
180
|
+
logger.debug("Subscriber is unsubscribed. Deleting old record.", {
|
|
181
|
+
projectId: (_10 = data.data.projectId) === null || _10 === void 0 ? void 0 : _10.toString(),
|
|
182
|
+
statusPageId: (_11 = data.data.statusPageId) === null || _11 === void 0 ? void 0 : _11.toString(),
|
|
183
|
+
});
|
|
128
184
|
await this.deleteOneBy({
|
|
129
185
|
query: {
|
|
130
186
|
_id: subscriber === null || subscriber === void 0 ? void 0 : subscriber._id,
|
|
@@ -136,70 +192,122 @@ export class Service extends DatabaseService {
|
|
|
136
192
|
});
|
|
137
193
|
}
|
|
138
194
|
const statuspages = await this.getStatusPagesToSendNotification([data.data.statusPageId]);
|
|
139
|
-
logger.debug(`Status Pages: ${JSON.stringify(statuspages)}
|
|
195
|
+
logger.debug(`Status Pages: ${JSON.stringify(statuspages)}`, {
|
|
196
|
+
projectId: (_12 = data.data.projectId) === null || _12 === void 0 ? void 0 : _12.toString(),
|
|
197
|
+
statusPageId: (_13 = data.data.statusPageId) === null || _13 === void 0 ? void 0 : _13.toString(),
|
|
198
|
+
});
|
|
140
199
|
const statuspage = statuspages.find((statuspage) => {
|
|
141
200
|
var _a, _b;
|
|
142
201
|
return (((_a = statuspage._id) === null || _a === void 0 ? void 0 : _a.toString()) === ((_b = data.data.statusPageId) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
143
202
|
});
|
|
144
203
|
if (!statuspage || !statuspage.projectId) {
|
|
145
|
-
logger.debug("Status Page not found or Project ID is missing."
|
|
204
|
+
logger.debug("Status Page not found or Project ID is missing.", {
|
|
205
|
+
projectId: (_14 = data.data.projectId) === null || _14 === void 0 ? void 0 : _14.toString(),
|
|
206
|
+
statusPageId: (_15 = data.data.statusPageId) === null || _15 === void 0 ? void 0 : _15.toString(),
|
|
207
|
+
});
|
|
146
208
|
throw new BadDataException("Status Page not found");
|
|
147
209
|
}
|
|
148
210
|
data.data.projectId = statuspage.projectId;
|
|
149
|
-
logger.debug(`Updated Project ID: ${data.data.projectId}
|
|
211
|
+
logger.debug(`Updated Project ID: ${data.data.projectId}`, {
|
|
212
|
+
projectId: (_16 = data.data.projectId) === null || _16 === void 0 ? void 0 : _16.toString(),
|
|
213
|
+
statusPageId: (_17 = data.data.statusPageId) === null || _17 === void 0 ? void 0 : _17.toString(),
|
|
214
|
+
});
|
|
150
215
|
const isEmailSubscriber = Boolean(data.data.subscriberEmail);
|
|
151
216
|
const isSubscriptionConfirmed = Boolean(data.data.isSubscriptionConfirmed);
|
|
152
|
-
logger.debug(`Is Email Subscriber: ${isEmailSubscriber}
|
|
153
|
-
|
|
217
|
+
logger.debug(`Is Email Subscriber: ${isEmailSubscriber}`, {
|
|
218
|
+
projectId: (_18 = data.data.projectId) === null || _18 === void 0 ? void 0 : _18.toString(),
|
|
219
|
+
statusPageId: (_19 = data.data.statusPageId) === null || _19 === void 0 ? void 0 : _19.toString(),
|
|
220
|
+
});
|
|
221
|
+
logger.debug(`Is Subscription Confirmed: ${isSubscriptionConfirmed}`, {
|
|
222
|
+
projectId: (_20 = data.data.projectId) === null || _20 === void 0 ? void 0 : _20.toString(),
|
|
223
|
+
statusPageId: (_21 = data.data.statusPageId) === null || _21 === void 0 ? void 0 : _21.toString(),
|
|
224
|
+
});
|
|
154
225
|
if (isEmailSubscriber && !isSubscriptionConfirmed) {
|
|
155
226
|
data.data.isSubscriptionConfirmed = false;
|
|
156
227
|
}
|
|
157
228
|
else {
|
|
158
229
|
data.data.isSubscriptionConfirmed = true; // if the subscriber is not email, then set it to true for SMS subscribers / slack subscribers.
|
|
159
230
|
}
|
|
160
|
-
logger.debug(`Final Subscription Confirmed: ${data.data.isSubscriptionConfirmed}
|
|
231
|
+
logger.debug(`Final Subscription Confirmed: ${data.data.isSubscriptionConfirmed}`, {
|
|
232
|
+
projectId: (_22 = data.data.projectId) === null || _22 === void 0 ? void 0 : _22.toString(),
|
|
233
|
+
statusPageId: (_23 = data.data.statusPageId) === null || _23 === void 0 ? void 0 : _23.toString(),
|
|
234
|
+
});
|
|
161
235
|
// if slack incoming webhook is provided, then see if it starts with https://hooks.slack.com/services/
|
|
162
236
|
if (data.data.slackIncomingWebhookUrl) {
|
|
163
|
-
logger.debug(`Slack Incoming Webhook URL: ${data.data.slackIncomingWebhookUrl}
|
|
237
|
+
logger.debug(`Slack Incoming Webhook URL: ${data.data.slackIncomingWebhookUrl}`, {
|
|
238
|
+
projectId: (_24 = data.data.projectId) === null || _24 === void 0 ? void 0 : _24.toString(),
|
|
239
|
+
statusPageId: (_25 = data.data.statusPageId) === null || _25 === void 0 ? void 0 : _25.toString(),
|
|
240
|
+
});
|
|
164
241
|
if (!SlackUtil.isValidSlackIncomingWebhookUrl(data.data.slackIncomingWebhookUrl)) {
|
|
165
|
-
logger.debug("Invalid Slack Incoming Webhook URL."
|
|
242
|
+
logger.debug("Invalid Slack Incoming Webhook URL.", {
|
|
243
|
+
projectId: (_26 = data.data.projectId) === null || _26 === void 0 ? void 0 : _26.toString(),
|
|
244
|
+
statusPageId: (_27 = data.data.statusPageId) === null || _27 === void 0 ? void 0 : _27.toString(),
|
|
245
|
+
});
|
|
166
246
|
throw new BadDataException("Invalid Slack Incoming Webhook URL.");
|
|
167
247
|
}
|
|
168
248
|
}
|
|
169
249
|
// Validate Microsoft Teams webhook URL if provided
|
|
170
250
|
if (data.data.microsoftTeamsIncomingWebhookUrl) {
|
|
171
|
-
logger.debug(`Microsoft Teams Incoming Webhook URL: ${data.data.microsoftTeamsIncomingWebhookUrl}
|
|
251
|
+
logger.debug(`Microsoft Teams Incoming Webhook URL: ${data.data.microsoftTeamsIncomingWebhookUrl}`, {
|
|
252
|
+
projectId: (_28 = data.data.projectId) === null || _28 === void 0 ? void 0 : _28.toString(),
|
|
253
|
+
statusPageId: (_29 = data.data.statusPageId) === null || _29 === void 0 ? void 0 : _29.toString(),
|
|
254
|
+
});
|
|
172
255
|
if (!MicrosoftTeamsUtil.isValidMicrosoftTeamsIncomingWebhookUrl(data.data.microsoftTeamsIncomingWebhookUrl)) {
|
|
173
|
-
logger.debug("Invalid Microsoft Teams Incoming Webhook URL."
|
|
256
|
+
logger.debug("Invalid Microsoft Teams Incoming Webhook URL.", {
|
|
257
|
+
projectId: (_30 = data.data.projectId) === null || _30 === void 0 ? void 0 : _30.toString(),
|
|
258
|
+
statusPageId: (_31 = data.data.statusPageId) === null || _31 === void 0 ? void 0 : _31.toString(),
|
|
259
|
+
});
|
|
174
260
|
throw new BadDataException("Invalid Microsoft Teams Incoming Webhook URL.");
|
|
175
261
|
}
|
|
176
262
|
}
|
|
177
263
|
data.data.subscriptionConfirmationToken = NumberUtil.getRandomNumber(100000, 999999).toString();
|
|
178
|
-
logger.debug(`Subscription Confirmation Token: ${data.data.subscriptionConfirmationToken}
|
|
179
|
-
|
|
180
|
-
|
|
264
|
+
logger.debug(`Subscription Confirmation Token: ${data.data.subscriptionConfirmationToken}`, {
|
|
265
|
+
projectId: (_32 = data.data.projectId) === null || _32 === void 0 ? void 0 : _32.toString(),
|
|
266
|
+
statusPageId: (_33 = data.data.statusPageId) === null || _33 === void 0 ? void 0 : _33.toString(),
|
|
267
|
+
});
|
|
268
|
+
logger.debug("onBeforeCreate processed data:", {
|
|
269
|
+
projectId: (_34 = data.data.projectId) === null || _34 === void 0 ? void 0 : _34.toString(),
|
|
270
|
+
statusPageId: (_35 = data.data.statusPageId) === null || _35 === void 0 ? void 0 : _35.toString(),
|
|
271
|
+
});
|
|
272
|
+
logger.debug(data, {
|
|
273
|
+
projectId: (_36 = data.data.projectId) === null || _36 === void 0 ? void 0 : _36.toString(),
|
|
274
|
+
statusPageId: (_37 = data.data.statusPageId) === null || _37 === void 0 ? void 0 : _37.toString(),
|
|
275
|
+
});
|
|
181
276
|
return { createBy: data, carryForward: statuspage };
|
|
182
277
|
}
|
|
183
278
|
async onCreateSuccess(onCreate, createdItem) {
|
|
184
|
-
|
|
185
|
-
logger.debug(createdItem
|
|
279
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
280
|
+
logger.debug("onCreateSuccess called with createdItem:", {
|
|
281
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
282
|
+
});
|
|
283
|
+
logger.debug(createdItem, {
|
|
284
|
+
projectId: (_b = createdItem.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
285
|
+
});
|
|
186
286
|
if (!createdItem.statusPageId) {
|
|
187
|
-
logger.debug("Status Page ID is missing in createdItem."
|
|
287
|
+
logger.debug("Status Page ID is missing in createdItem.", {
|
|
288
|
+
projectId: (_c = createdItem.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
289
|
+
});
|
|
188
290
|
return createdItem;
|
|
189
291
|
}
|
|
190
292
|
const statusPageURL = await StatusPageService.getStatusPageURL(createdItem.statusPageId);
|
|
191
|
-
logger.debug(`Status Page URL: ${statusPageURL}
|
|
293
|
+
logger.debug(`Status Page URL: ${statusPageURL}`, {
|
|
294
|
+
projectId: (_d = createdItem.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
295
|
+
});
|
|
192
296
|
const statusPageName = onCreate.carryForward.pageTitle ||
|
|
193
297
|
onCreate.carryForward.name ||
|
|
194
298
|
"Status Page";
|
|
195
|
-
logger.debug(`Status Page Name: ${statusPageName}
|
|
299
|
+
logger.debug(`Status Page Name: ${statusPageName}`, {
|
|
300
|
+
projectId: (_e = createdItem.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
301
|
+
});
|
|
196
302
|
const unsubscribeLink = this.getUnsubscribeLink(URL.fromString(statusPageURL), createdItem.id).toString();
|
|
197
|
-
logger.debug(`Unsubscribe Link: ${unsubscribeLink}
|
|
303
|
+
logger.debug(`Unsubscribe Link: ${unsubscribeLink}`, {
|
|
304
|
+
projectId: (_f = createdItem.projectId) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
305
|
+
});
|
|
198
306
|
if (createdItem.statusPageId &&
|
|
199
307
|
createdItem.subscriberPhone &&
|
|
200
308
|
createdItem._id &&
|
|
201
309
|
createdItem.sendYouHaveSubscribedMessage) {
|
|
202
|
-
logger.debug("Subscriber has a phone number and sendYouHaveSubscribedMessage is true.");
|
|
310
|
+
logger.debug("Subscriber has a phone number and sendYouHaveSubscribedMessage is true.", { projectId: (_g = createdItem.projectId) === null || _g === void 0 ? void 0 : _g.toString() });
|
|
203
311
|
const statusPage = await StatusPageService.findOneBy({
|
|
204
312
|
query: {
|
|
205
313
|
_id: createdItem.statusPageId.toString(),
|
|
@@ -219,10 +327,12 @@ export class Service extends DatabaseService {
|
|
|
219
327
|
},
|
|
220
328
|
});
|
|
221
329
|
if (!statusPage) {
|
|
222
|
-
logger.debug("Status Page not found."
|
|
330
|
+
logger.debug("Status Page not found.", {
|
|
331
|
+
projectId: (_h = createdItem.projectId) === null || _h === void 0 ? void 0 : _h.toString(),
|
|
332
|
+
});
|
|
223
333
|
return createdItem;
|
|
224
334
|
}
|
|
225
|
-
logger.debug(`Status Page Call SMS Config: ${JSON.stringify(statusPage.callSmsConfig)}
|
|
335
|
+
logger.debug(`Status Page Call SMS Config: ${JSON.stringify(statusPage.callSmsConfig)}`, { projectId: (_j = createdItem.projectId) === null || _j === void 0 ? void 0 : _j.toString() });
|
|
226
336
|
SmsService.sendSms({
|
|
227
337
|
to: createdItem.subscriberPhone,
|
|
228
338
|
message: `You have been subscribed to ${statusPageName}. To unsubscribe, click on the link: ${unsubscribeLink}`,
|
|
@@ -232,23 +342,30 @@ export class Service extends DatabaseService {
|
|
|
232
342
|
customTwilioConfig: ProjectCallSMSConfigService.toTwilioConfig(statusPage.callSmsConfig),
|
|
233
343
|
statusPageId: createdItem.statusPageId,
|
|
234
344
|
}).catch((err) => {
|
|
235
|
-
|
|
345
|
+
var _a;
|
|
346
|
+
logger.error(err, {
|
|
347
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
348
|
+
});
|
|
236
349
|
});
|
|
237
350
|
}
|
|
238
351
|
if (createdItem.statusPageId &&
|
|
239
352
|
createdItem.subscriberEmail &&
|
|
240
353
|
createdItem._id) {
|
|
241
|
-
logger.debug("Subscriber has an email."
|
|
354
|
+
logger.debug("Subscriber has an email.", {
|
|
355
|
+
projectId: (_k = createdItem.projectId) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
356
|
+
});
|
|
242
357
|
const isSubcriptionConfirmed = Boolean(createdItem.isSubscriptionConfirmed);
|
|
243
|
-
logger.debug(`Is Subscription Confirmed: ${isSubcriptionConfirmed}
|
|
358
|
+
logger.debug(`Is Subscription Confirmed: ${isSubcriptionConfirmed}`, {
|
|
359
|
+
projectId: (_l = createdItem.projectId) === null || _l === void 0 ? void 0 : _l.toString(),
|
|
360
|
+
});
|
|
244
361
|
if (!isSubcriptionConfirmed) {
|
|
245
|
-
logger.debug("Subscription is not confirmed. Sending confirmation email.");
|
|
362
|
+
logger.debug("Subscription is not confirmed. Sending confirmation email.", { projectId: (_m = createdItem.projectId) === null || _m === void 0 ? void 0 : _m.toString() });
|
|
246
363
|
await this.sendConfirmSubscriptionEmail({
|
|
247
364
|
subscriberId: createdItem.id,
|
|
248
365
|
});
|
|
249
366
|
}
|
|
250
367
|
if (isSubcriptionConfirmed && createdItem.sendYouHaveSubscribedMessage) {
|
|
251
|
-
logger.debug("Subscription is confirmed and sendYouHaveSubscribedMessage is true. Sending 'You have subscribed' email.");
|
|
368
|
+
logger.debug("Subscription is confirmed and sendYouHaveSubscribedMessage is true. Sending 'You have subscribed' email.", { projectId: (_o = createdItem.projectId) === null || _o === void 0 ? void 0 : _o.toString() });
|
|
252
369
|
await this.sendYouHaveSubscribedEmail({
|
|
253
370
|
subscriberId: createdItem.id,
|
|
254
371
|
});
|
|
@@ -256,7 +373,9 @@ export class Service extends DatabaseService {
|
|
|
256
373
|
}
|
|
257
374
|
// if slack incoming webhook is provided, then send a message to the slack channel.
|
|
258
375
|
if (createdItem.slackIncomingWebhookUrl) {
|
|
259
|
-
logger.debug("Sending Slack notification for new subscriber."
|
|
376
|
+
logger.debug("Sending Slack notification for new subscriber.", {
|
|
377
|
+
projectId: (_p = createdItem.projectId) === null || _p === void 0 ? void 0 : _p.toString(),
|
|
378
|
+
});
|
|
260
379
|
const slackMessage = `## 📢 New Subscription to ${statusPageName}
|
|
261
380
|
|
|
262
381
|
**You have successfully subscribed to receive status updates!**
|
|
@@ -271,23 +390,35 @@ You will receive real-time notifications for:
|
|
|
271
390
|
• Status updates
|
|
272
391
|
|
|
273
392
|
Stay informed about service availability! 🚀`;
|
|
274
|
-
logger.debug(`Slack Message: ${slackMessage}
|
|
393
|
+
logger.debug(`Slack Message: ${slackMessage}`, {
|
|
394
|
+
projectId: (_q = createdItem.projectId) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
395
|
+
});
|
|
275
396
|
SlackUtil.sendMessageToChannelViaIncomingWebhook({
|
|
276
397
|
url: URL.fromString(createdItem.slackIncomingWebhookUrl.toString()),
|
|
277
398
|
text: SlackUtil.convertMarkdownToSlackRichText(slackMessage),
|
|
278
399
|
})
|
|
279
400
|
.then(() => {
|
|
280
|
-
|
|
401
|
+
var _a;
|
|
402
|
+
logger.debug("Slack notification sent successfully.", {
|
|
403
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
404
|
+
});
|
|
281
405
|
})
|
|
282
406
|
.catch((err) => {
|
|
283
|
-
|
|
284
|
-
logger.error(
|
|
407
|
+
var _a, _b;
|
|
408
|
+
logger.error("Error sending Slack notification:", {
|
|
409
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
410
|
+
});
|
|
411
|
+
logger.error(err, {
|
|
412
|
+
projectId: (_b = createdItem.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
413
|
+
});
|
|
285
414
|
});
|
|
286
415
|
}
|
|
287
416
|
// if Microsoft Teams incoming webhook is provided and sendYouHaveSubscribedMessage is true, then send a message to the Teams channel.
|
|
288
417
|
if (createdItem.microsoftTeamsIncomingWebhookUrl &&
|
|
289
418
|
createdItem.sendYouHaveSubscribedMessage) {
|
|
290
|
-
logger.debug("Sending Microsoft Teams notification for new subscriber."
|
|
419
|
+
logger.debug("Sending Microsoft Teams notification for new subscriber.", {
|
|
420
|
+
projectId: (_r = createdItem.projectId) === null || _r === void 0 ? void 0 : _r.toString(),
|
|
421
|
+
});
|
|
291
422
|
const teamsMessage = `## 📢 New Subscription to ${statusPageName}
|
|
292
423
|
|
|
293
424
|
**You have successfully subscribed to receive status updates!**
|
|
@@ -302,26 +433,42 @@ You will receive real-time notifications for:
|
|
|
302
433
|
• Status updates
|
|
303
434
|
|
|
304
435
|
Stay informed about service availability! 🚀`;
|
|
305
|
-
logger.debug(`Teams Message: ${teamsMessage}
|
|
436
|
+
logger.debug(`Teams Message: ${teamsMessage}`, {
|
|
437
|
+
projectId: (_s = createdItem.projectId) === null || _s === void 0 ? void 0 : _s.toString(),
|
|
438
|
+
});
|
|
306
439
|
MicrosoftTeamsUtil.sendMessageToChannelViaIncomingWebhook({
|
|
307
440
|
url: URL.fromString(createdItem.microsoftTeamsIncomingWebhookUrl.toString()),
|
|
308
441
|
text: teamsMessage,
|
|
309
442
|
})
|
|
310
443
|
.then(() => {
|
|
311
|
-
|
|
444
|
+
var _a;
|
|
445
|
+
logger.debug("Microsoft Teams notification sent successfully.", {
|
|
446
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
447
|
+
});
|
|
312
448
|
})
|
|
313
449
|
.catch((err) => {
|
|
314
|
-
|
|
315
|
-
logger.error(
|
|
450
|
+
var _a, _b;
|
|
451
|
+
logger.error("Error sending Microsoft Teams notification:", {
|
|
452
|
+
projectId: (_a = createdItem.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
453
|
+
});
|
|
454
|
+
logger.error(err, {
|
|
455
|
+
projectId: (_b = createdItem.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
456
|
+
});
|
|
316
457
|
});
|
|
317
458
|
}
|
|
318
|
-
logger.debug("onCreateSuccess completed."
|
|
459
|
+
logger.debug("onCreateSuccess completed.", {
|
|
460
|
+
projectId: (_t = createdItem.projectId) === null || _t === void 0 ? void 0 : _t.toString(),
|
|
461
|
+
});
|
|
319
462
|
return createdItem;
|
|
320
463
|
}
|
|
321
464
|
async sendConfirmSubscriptionEmail(data) {
|
|
322
|
-
var _a, _b;
|
|
323
|
-
logger.debug("sendConfirmSubscriptionEmail called with data:"
|
|
324
|
-
|
|
465
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
466
|
+
logger.debug("sendConfirmSubscriptionEmail called with data:", {
|
|
467
|
+
statusPageSubscriberId: (_a = data.subscriberId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
468
|
+
});
|
|
469
|
+
logger.debug(data, {
|
|
470
|
+
statusPageSubscriberId: (_b = data.subscriberId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
471
|
+
});
|
|
325
472
|
// get subscriber
|
|
326
473
|
const subscriber = await this.findOneBy({
|
|
327
474
|
query: {
|
|
@@ -340,10 +487,14 @@ Stay informed about service availability! 🚀`;
|
|
|
340
487
|
ignoreHooks: true,
|
|
341
488
|
},
|
|
342
489
|
});
|
|
343
|
-
logger.debug(`Found Subscriber: ${JSON.stringify(subscriber)}
|
|
490
|
+
logger.debug(`Found Subscriber: ${JSON.stringify(subscriber)}`, {
|
|
491
|
+
statusPageSubscriberId: (_c = data.subscriberId) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
492
|
+
});
|
|
344
493
|
// get status page
|
|
345
494
|
if (!subscriber || !subscriber.statusPageId) {
|
|
346
|
-
logger.debug("Subscriber or Status Page ID is missing."
|
|
495
|
+
logger.debug("Subscriber or Status Page ID is missing.", {
|
|
496
|
+
statusPageSubscriberId: (_d = data.subscriberId) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
497
|
+
});
|
|
347
498
|
return;
|
|
348
499
|
}
|
|
349
500
|
const statusPage = await StatusPageService.findOneBy({
|
|
@@ -371,31 +522,47 @@ Stay informed about service availability! 🚀`;
|
|
|
371
522
|
ignoreHooks: true,
|
|
372
523
|
},
|
|
373
524
|
});
|
|
374
|
-
logger.debug(`Found Status Page: ${JSON.stringify(statusPage)}
|
|
525
|
+
logger.debug(`Found Status Page: ${JSON.stringify(statusPage)}`, {
|
|
526
|
+
statusPageSubscriberId: (_e = data.subscriberId) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
527
|
+
});
|
|
375
528
|
if (!statusPage || !statusPage.id) {
|
|
376
|
-
logger.debug("Status Page not found or ID is missing."
|
|
529
|
+
logger.debug("Status Page not found or ID is missing.", {
|
|
530
|
+
statusPageSubscriberId: (_f = data.subscriberId) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
531
|
+
});
|
|
377
532
|
return;
|
|
378
533
|
}
|
|
379
534
|
const statusPageURL = await StatusPageService.getStatusPageURL(statusPage.id);
|
|
380
|
-
logger.debug(`Status Page URL: ${statusPageURL}
|
|
535
|
+
logger.debug(`Status Page URL: ${statusPageURL}`, {
|
|
536
|
+
statusPageSubscriberId: (_g = data.subscriberId) === null || _g === void 0 ? void 0 : _g.toString(),
|
|
537
|
+
});
|
|
381
538
|
const statusPageName = statusPage.pageTitle || statusPage.name || "Status Page";
|
|
382
|
-
logger.debug(`Status Page Name: ${statusPageName}
|
|
539
|
+
logger.debug(`Status Page Name: ${statusPageName}`, {
|
|
540
|
+
statusPageSubscriberId: (_h = data.subscriberId) === null || _h === void 0 ? void 0 : _h.toString(),
|
|
541
|
+
});
|
|
383
542
|
const host = await DatabaseConfig.getHost();
|
|
384
|
-
logger.debug(`Host: ${host}
|
|
543
|
+
logger.debug(`Host: ${host}`, {
|
|
544
|
+
statusPageSubscriberId: (_j = data.subscriberId) === null || _j === void 0 ? void 0 : _j.toString(),
|
|
545
|
+
});
|
|
385
546
|
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
386
|
-
logger.debug(`HTTP Protocol: ${httpProtocol}
|
|
387
|
-
|
|
547
|
+
logger.debug(`HTTP Protocol: ${httpProtocol}`, {
|
|
548
|
+
statusPageSubscriberId: (_k = data.subscriberId) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
549
|
+
});
|
|
550
|
+
const statusPageIdString = ((_l = statusPage.id) === null || _l === void 0 ? void 0 : _l.toString()) || ((_m = statusPage._id) === null || _m === void 0 ? void 0 : _m.toString()) || null;
|
|
388
551
|
const confirmSubscriptionLink = this.getConfirmSubscriptionLink({
|
|
389
552
|
statusPageUrl: statusPageURL,
|
|
390
553
|
confirmationToken: subscriber.subscriptionConfirmationToken || "",
|
|
391
554
|
statusPageSubscriberId: subscriber.id,
|
|
392
555
|
}).toString();
|
|
393
|
-
logger.debug(`Confirm Subscription Link: ${confirmSubscriptionLink}
|
|
556
|
+
logger.debug(`Confirm Subscription Link: ${confirmSubscriptionLink}`, {
|
|
557
|
+
statusPageSubscriberId: (_o = data.subscriberId) === null || _o === void 0 ? void 0 : _o.toString(),
|
|
558
|
+
});
|
|
394
559
|
if (subscriber.statusPageId &&
|
|
395
560
|
subscriber.subscriberEmail &&
|
|
396
561
|
subscriber._id) {
|
|
397
562
|
const unsubscribeUrl = this.getUnsubscribeLink(URL.fromString(statusPageURL), subscriber.id).toString();
|
|
398
|
-
logger.debug(`Unsubscribe URL: ${unsubscribeUrl}
|
|
563
|
+
logger.debug(`Unsubscribe URL: ${unsubscribeUrl}`, {
|
|
564
|
+
statusPageSubscriberId: (_p = data.subscriberId) === null || _p === void 0 ? void 0 : _p.toString(),
|
|
565
|
+
});
|
|
399
566
|
MailService.sendMail({
|
|
400
567
|
toEmail: subscriber.subscriberEmail,
|
|
401
568
|
templateType: EmailTemplateType.ConfirmStatusPageSubscription,
|
|
@@ -420,18 +587,29 @@ Stay informed about service availability! 🚀`;
|
|
|
420
587
|
mailServer: ProjectSMTPConfigService.toEmailServer(statusPage.smtpConfig),
|
|
421
588
|
statusPageId: statusPage.id,
|
|
422
589
|
}).catch((err) => {
|
|
423
|
-
|
|
590
|
+
var _a;
|
|
591
|
+
logger.error(err, {
|
|
592
|
+
projectId: (_a = subscriber.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
logger.debug("Confirmation email sent.", {
|
|
596
|
+
statusPageSubscriberId: (_q = data.subscriberId) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
424
597
|
});
|
|
425
|
-
logger.debug("Confirmation email sent.");
|
|
426
598
|
}
|
|
427
599
|
else {
|
|
428
|
-
logger.debug("Subscriber email or ID is missing."
|
|
600
|
+
logger.debug("Subscriber email or ID is missing.", {
|
|
601
|
+
statusPageSubscriberId: (_r = data.subscriberId) === null || _r === void 0 ? void 0 : _r.toString(),
|
|
602
|
+
});
|
|
429
603
|
}
|
|
430
604
|
}
|
|
431
605
|
async sendYouHaveSubscribedEmail(data) {
|
|
432
|
-
var _a, _b;
|
|
433
|
-
logger.debug("sendYouHaveSubscribedEmail called with data:"
|
|
434
|
-
|
|
606
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
607
|
+
logger.debug("sendYouHaveSubscribedEmail called with data:", {
|
|
608
|
+
statusPageSubscriberId: (_a = data.subscriberId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
609
|
+
});
|
|
610
|
+
logger.debug(data, {
|
|
611
|
+
statusPageSubscriberId: (_b = data.subscriberId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
612
|
+
});
|
|
435
613
|
// get subscriber
|
|
436
614
|
const subscriber = await this.findOneBy({
|
|
437
615
|
query: {
|
|
@@ -449,10 +627,14 @@ Stay informed about service availability! 🚀`;
|
|
|
449
627
|
ignoreHooks: true,
|
|
450
628
|
},
|
|
451
629
|
});
|
|
452
|
-
logger.debug(`Found Subscriber: ${JSON.stringify(subscriber)}
|
|
630
|
+
logger.debug(`Found Subscriber: ${JSON.stringify(subscriber)}`, {
|
|
631
|
+
statusPageSubscriberId: (_c = data.subscriberId) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
632
|
+
});
|
|
453
633
|
// get status page
|
|
454
634
|
if (!subscriber || !subscriber.statusPageId) {
|
|
455
|
-
logger.debug("Subscriber or Status Page ID is missing."
|
|
635
|
+
logger.debug("Subscriber or Status Page ID is missing.", {
|
|
636
|
+
statusPageSubscriberId: (_d = data.subscriberId) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
637
|
+
});
|
|
456
638
|
return;
|
|
457
639
|
}
|
|
458
640
|
const statusPage = await StatusPageService.findOneBy({
|
|
@@ -480,26 +662,42 @@ Stay informed about service availability! 🚀`;
|
|
|
480
662
|
ignoreHooks: true,
|
|
481
663
|
},
|
|
482
664
|
});
|
|
483
|
-
logger.debug(`Found Status Page: ${JSON.stringify(statusPage)}
|
|
665
|
+
logger.debug(`Found Status Page: ${JSON.stringify(statusPage)}`, {
|
|
666
|
+
statusPageSubscriberId: (_e = data.subscriberId) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
667
|
+
});
|
|
484
668
|
if (!statusPage || !statusPage.id) {
|
|
485
|
-
logger.debug("Status Page not found or ID is missing."
|
|
669
|
+
logger.debug("Status Page not found or ID is missing.", {
|
|
670
|
+
statusPageSubscriberId: (_f = data.subscriberId) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
671
|
+
});
|
|
486
672
|
return;
|
|
487
673
|
}
|
|
488
674
|
const statusPageURL = await StatusPageService.getStatusPageURL(statusPage.id);
|
|
489
|
-
logger.debug(`Status Page URL: ${statusPageURL}
|
|
675
|
+
logger.debug(`Status Page URL: ${statusPageURL}`, {
|
|
676
|
+
statusPageSubscriberId: (_g = data.subscriberId) === null || _g === void 0 ? void 0 : _g.toString(),
|
|
677
|
+
});
|
|
490
678
|
const statusPageName = statusPage.pageTitle || statusPage.name || "Status Page";
|
|
491
|
-
logger.debug(`Status Page Name: ${statusPageName}
|
|
679
|
+
logger.debug(`Status Page Name: ${statusPageName}`, {
|
|
680
|
+
statusPageSubscriberId: (_h = data.subscriberId) === null || _h === void 0 ? void 0 : _h.toString(),
|
|
681
|
+
});
|
|
492
682
|
const host = await DatabaseConfig.getHost();
|
|
493
|
-
logger.debug(`Host: ${host}
|
|
683
|
+
logger.debug(`Host: ${host}`, {
|
|
684
|
+
statusPageSubscriberId: (_j = data.subscriberId) === null || _j === void 0 ? void 0 : _j.toString(),
|
|
685
|
+
});
|
|
494
686
|
const httpProtocol = await DatabaseConfig.getHttpProtocol();
|
|
495
|
-
logger.debug(`HTTP Protocol: ${httpProtocol}
|
|
496
|
-
|
|
687
|
+
logger.debug(`HTTP Protocol: ${httpProtocol}`, {
|
|
688
|
+
statusPageSubscriberId: (_k = data.subscriberId) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
689
|
+
});
|
|
690
|
+
const statusPageIdString = ((_l = statusPage.id) === null || _l === void 0 ? void 0 : _l.toString()) || ((_m = statusPage._id) === null || _m === void 0 ? void 0 : _m.toString()) || null;
|
|
497
691
|
const unsubscribeLink = this.getUnsubscribeLink(URL.fromString(statusPageURL), subscriber.id).toString();
|
|
498
|
-
logger.debug(`Unsubscribe Link: ${unsubscribeLink}
|
|
692
|
+
logger.debug(`Unsubscribe Link: ${unsubscribeLink}`, {
|
|
693
|
+
statusPageSubscriberId: (_o = data.subscriberId) === null || _o === void 0 ? void 0 : _o.toString(),
|
|
694
|
+
});
|
|
499
695
|
if (subscriber.statusPageId &&
|
|
500
696
|
subscriber.subscriberEmail &&
|
|
501
697
|
subscriber._id) {
|
|
502
|
-
logger.debug("Subscriber has an email and ID."
|
|
698
|
+
logger.debug("Subscriber has an email and ID.", {
|
|
699
|
+
statusPageSubscriberId: (_p = data.subscriberId) === null || _p === void 0 ? void 0 : _p.toString(),
|
|
700
|
+
});
|
|
503
701
|
MailService.sendMail({
|
|
504
702
|
toEmail: subscriber.subscriberEmail,
|
|
505
703
|
templateType: EmailTemplateType.SubscribedToStatusPage,
|
|
@@ -523,27 +721,51 @@ Stay informed about service availability! 🚀`;
|
|
|
523
721
|
mailServer: ProjectSMTPConfigService.toEmailServer(statusPage.smtpConfig),
|
|
524
722
|
statusPageId: statusPage.id,
|
|
525
723
|
}).catch((err) => {
|
|
526
|
-
|
|
527
|
-
logger.error(
|
|
724
|
+
var _a, _b;
|
|
725
|
+
logger.error("Error sending subscription email:", {
|
|
726
|
+
projectId: (_a = subscriber.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
727
|
+
});
|
|
728
|
+
logger.error(err, {
|
|
729
|
+
projectId: (_b = subscriber.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
logger.debug("Subscription email sent successfully.", {
|
|
733
|
+
statusPageSubscriberId: (_q = data.subscriberId) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
528
734
|
});
|
|
529
|
-
logger.debug("Subscription email sent successfully.");
|
|
530
735
|
}
|
|
531
736
|
else {
|
|
532
|
-
logger.debug("Subscriber email or ID is missing."
|
|
737
|
+
logger.debug("Subscriber email or ID is missing.", {
|
|
738
|
+
statusPageSubscriberId: (_r = data.subscriberId) === null || _r === void 0 ? void 0 : _r.toString(),
|
|
739
|
+
});
|
|
533
740
|
}
|
|
534
741
|
}
|
|
535
742
|
getConfirmSubscriptionLink(data) {
|
|
536
|
-
|
|
537
|
-
logger.debug(data
|
|
743
|
+
var _a, _b, _c;
|
|
744
|
+
logger.debug("getConfirmSubscriptionLink called with data:", {
|
|
745
|
+
statusPageSubscriberId: (_a = data.statusPageSubscriberId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
746
|
+
});
|
|
747
|
+
logger.debug(data, {
|
|
748
|
+
statusPageSubscriberId: (_b = data.statusPageSubscriberId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
749
|
+
});
|
|
538
750
|
const confirmSubscriptionLink = URL.fromString(data.statusPageUrl).addRoute(`/confirm-subscription/${data.statusPageSubscriberId.toString()}?verification-token=${data.confirmationToken}`);
|
|
539
|
-
logger.debug(`Generated Confirm Subscription Link: ${confirmSubscriptionLink.toString()}
|
|
751
|
+
logger.debug(`Generated Confirm Subscription Link: ${confirmSubscriptionLink.toString()}`, {
|
|
752
|
+
statusPageSubscriberId: (_c = data.statusPageSubscriberId) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
753
|
+
});
|
|
540
754
|
return confirmSubscriptionLink;
|
|
541
755
|
}
|
|
542
756
|
async getSubscribersByStatusPage(statusPageId, props) {
|
|
543
|
-
logger.debug("getSubscribersByStatusPage called with statusPageId:"
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
logger.debug(
|
|
757
|
+
logger.debug("getSubscribersByStatusPage called with statusPageId:", {
|
|
758
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
759
|
+
});
|
|
760
|
+
logger.debug(statusPageId, {
|
|
761
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
762
|
+
});
|
|
763
|
+
logger.debug("DatabaseCommonInteractionProps:", {
|
|
764
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
765
|
+
});
|
|
766
|
+
logger.debug(props, {
|
|
767
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
768
|
+
});
|
|
547
769
|
const subscribers = await this.findBy({
|
|
548
770
|
query: {
|
|
549
771
|
statusPageId: statusPageId,
|
|
@@ -566,27 +788,49 @@ Stay informed about service availability! 🚀`;
|
|
|
566
788
|
limit: LIMIT_MAX,
|
|
567
789
|
props: props,
|
|
568
790
|
});
|
|
569
|
-
logger.debug("Found subscribers:"
|
|
570
|
-
|
|
791
|
+
logger.debug("Found subscribers:", {
|
|
792
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
793
|
+
});
|
|
794
|
+
logger.debug(subscribers, {
|
|
795
|
+
statusPageId: statusPageId === null || statusPageId === void 0 ? void 0 : statusPageId.toString(),
|
|
796
|
+
});
|
|
571
797
|
return subscribers;
|
|
572
798
|
}
|
|
573
799
|
getUnsubscribeLink(statusPageUrl, statusPageSubscriberId) {
|
|
574
|
-
logger.debug("getUnsubscribeLink called with statusPageUrl:"
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
logger.debug(
|
|
800
|
+
logger.debug("getUnsubscribeLink called with statusPageUrl:", {
|
|
801
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
802
|
+
});
|
|
803
|
+
logger.debug(statusPageUrl, {
|
|
804
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
805
|
+
});
|
|
806
|
+
logger.debug("statusPageSubscriberId:", {
|
|
807
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
808
|
+
});
|
|
809
|
+
logger.debug(statusPageSubscriberId, {
|
|
810
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
811
|
+
});
|
|
578
812
|
const unsubscribeLink = URL.fromString(statusPageUrl.toString()).addRoute("/update-subscription/" + statusPageSubscriberId.toString());
|
|
579
|
-
logger.debug("Generated Unsubscribe Link:"
|
|
580
|
-
|
|
813
|
+
logger.debug("Generated Unsubscribe Link:", {
|
|
814
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
815
|
+
});
|
|
816
|
+
logger.debug(unsubscribeLink, {
|
|
817
|
+
statusPageSubscriberId: statusPageSubscriberId === null || statusPageSubscriberId === void 0 ? void 0 : statusPageSubscriberId.toString(),
|
|
818
|
+
});
|
|
581
819
|
return unsubscribeLink;
|
|
582
820
|
}
|
|
583
821
|
shouldSendNotification(data) {
|
|
584
|
-
var _a, _b;
|
|
585
|
-
logger.debug("shouldSendNotification called with data:"
|
|
586
|
-
|
|
822
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
823
|
+
logger.debug("shouldSendNotification called with data:", {
|
|
824
|
+
statusPageId: (_b = (_a = data.statusPage) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
825
|
+
});
|
|
826
|
+
logger.debug(data, {
|
|
827
|
+
statusPageId: (_d = (_c = data.statusPage) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
828
|
+
});
|
|
587
829
|
let shouldSendNotification = true; // default to true.
|
|
588
830
|
if (data.subscriber.isUnsubscribed) {
|
|
589
|
-
logger.debug("Subscriber is unsubscribed."
|
|
831
|
+
logger.debug("Subscriber is unsubscribed.", {
|
|
832
|
+
statusPageId: (_f = (_e = data.statusPage) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
833
|
+
});
|
|
590
834
|
shouldSendNotification = false;
|
|
591
835
|
return shouldSendNotification;
|
|
592
836
|
}
|
|
@@ -595,53 +839,67 @@ Stay informed about service availability! 🚀`;
|
|
|
595
839
|
!(data.eventType === StatusPageEventType.Announcement &&
|
|
596
840
|
data.statusPageResources.length === 0) // announcements with no monitors don't use resource filtering
|
|
597
841
|
) {
|
|
598
|
-
logger.debug("Subscriber can choose resources and is not subscribed to all resources.");
|
|
599
|
-
const subscriberResourceIds = ((
|
|
842
|
+
logger.debug("Subscriber can choose resources and is not subscribed to all resources.", { statusPageId: (_h = (_g = data.statusPage) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.toString() });
|
|
843
|
+
const subscriberResourceIds = ((_j = data.subscriber.statusPageResources) === null || _j === void 0 ? void 0 : _j.map((resource) => {
|
|
600
844
|
var _a;
|
|
601
845
|
return (_a = resource.id) === null || _a === void 0 ? void 0 : _a.toString();
|
|
602
846
|
})) || [];
|
|
603
|
-
logger.debug(`Subscriber Resource IDs: ${subscriberResourceIds}
|
|
847
|
+
logger.debug(`Subscriber Resource IDs: ${subscriberResourceIds}`, {
|
|
848
|
+
statusPageId: (_l = (_k = data.statusPage) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.toString(),
|
|
849
|
+
});
|
|
604
850
|
let shouldSendNotificationForResource = false;
|
|
605
851
|
if (subscriberResourceIds.length === 0) {
|
|
606
|
-
logger.debug("Subscriber has no resource IDs."
|
|
852
|
+
logger.debug("Subscriber has no resource IDs.", {
|
|
853
|
+
statusPageId: (_o = (_m = data.statusPage) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.toString(),
|
|
854
|
+
});
|
|
607
855
|
shouldSendNotificationForResource = false;
|
|
608
856
|
}
|
|
609
857
|
else {
|
|
610
858
|
for (const resource of data.statusPageResources) {
|
|
611
|
-
logger.debug(`Checking resource: ${resource.id}
|
|
612
|
-
|
|
613
|
-
|
|
859
|
+
logger.debug(`Checking resource: ${resource.id}`, {
|
|
860
|
+
statusPageId: (_q = (_p = data.statusPage) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
861
|
+
});
|
|
862
|
+
if (subscriberResourceIds.includes((_r = resource.id) === null || _r === void 0 ? void 0 : _r.toString())) {
|
|
863
|
+
logger.debug("Resource ID matches subscriber's resource ID.", {
|
|
864
|
+
statusPageId: (_t = (_s = data.statusPage) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.toString(),
|
|
865
|
+
});
|
|
614
866
|
shouldSendNotificationForResource = true;
|
|
615
867
|
}
|
|
616
868
|
}
|
|
617
869
|
}
|
|
618
870
|
if (!shouldSendNotificationForResource) {
|
|
619
|
-
logger.debug("Should not send notification for resource."
|
|
871
|
+
logger.debug("Should not send notification for resource.", {
|
|
872
|
+
statusPageId: (_v = (_u = data.statusPage) === null || _u === void 0 ? void 0 : _u.id) === null || _v === void 0 ? void 0 : _v.toString(),
|
|
873
|
+
});
|
|
620
874
|
shouldSendNotification = false;
|
|
621
875
|
}
|
|
622
876
|
}
|
|
623
877
|
// now do for event types
|
|
624
878
|
if (data.statusPage.allowSubscribersToChooseEventTypes &&
|
|
625
879
|
!data.subscriber.isSubscribedToAllEventTypes) {
|
|
626
|
-
logger.debug("Subscriber can choose event types and is not subscribed to all event types.");
|
|
880
|
+
logger.debug("Subscriber can choose event types and is not subscribed to all event types.", { statusPageId: (_x = (_w = data.statusPage) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.toString() });
|
|
627
881
|
const subscriberEventTypes = data.subscriber.statusPageEventTypes || [];
|
|
628
|
-
logger.debug(`Subscriber Event Types: ${subscriberEventTypes}
|
|
882
|
+
logger.debug(`Subscriber Event Types: ${subscriberEventTypes}`, {
|
|
883
|
+
statusPageId: (_z = (_y = data.statusPage) === null || _y === void 0 ? void 0 : _y.id) === null || _z === void 0 ? void 0 : _z.toString(),
|
|
884
|
+
});
|
|
629
885
|
let shouldSendNotificationForEventType = false;
|
|
630
886
|
if (subscriberEventTypes.includes(data.eventType)) {
|
|
631
|
-
logger.debug("Event type matches subscriber's event type."
|
|
887
|
+
logger.debug("Event type matches subscriber's event type.", {
|
|
888
|
+
statusPageId: (_1 = (_0 = data.statusPage) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.toString(),
|
|
889
|
+
});
|
|
632
890
|
shouldSendNotificationForEventType = true;
|
|
633
891
|
}
|
|
634
892
|
if (!shouldSendNotificationForEventType) {
|
|
635
|
-
logger.debug("Should not send notification for event type.");
|
|
893
|
+
logger.debug("Should not send notification for event type.", {});
|
|
636
894
|
shouldSendNotification = false;
|
|
637
895
|
}
|
|
638
896
|
}
|
|
639
|
-
logger.debug(`Final decision on shouldSendNotification: ${shouldSendNotification}
|
|
897
|
+
logger.debug(`Final decision on shouldSendNotification: ${shouldSendNotification}`, {});
|
|
640
898
|
return shouldSendNotification;
|
|
641
899
|
}
|
|
642
900
|
async getStatusPagesToSendNotification(statusPageIds) {
|
|
643
|
-
logger.debug("getStatusPagesToSendNotification called with statusPageIds:");
|
|
644
|
-
logger.debug(statusPageIds);
|
|
901
|
+
logger.debug("getStatusPagesToSendNotification called with statusPageIds:", {});
|
|
902
|
+
logger.debug(statusPageIds, {});
|
|
645
903
|
const statusPages = await StatusPageService.findBy({
|
|
646
904
|
query: {
|
|
647
905
|
_id: QueryHelper.any(statusPageIds),
|
|
@@ -688,11 +946,12 @@ Stay informed about service availability! 🚀`;
|
|
|
688
946
|
showScheduledMaintenanceEventsOnStatusPage: true,
|
|
689
947
|
},
|
|
690
948
|
});
|
|
691
|
-
logger.debug("Found status pages:");
|
|
692
|
-
logger.debug(statusPages);
|
|
949
|
+
logger.debug("Found status pages:", {});
|
|
950
|
+
logger.debug(statusPages, {});
|
|
693
951
|
return statusPages;
|
|
694
952
|
}
|
|
695
953
|
async testSlackWebhook(data) {
|
|
954
|
+
var _a, _b;
|
|
696
955
|
// Validate the webhook URL
|
|
697
956
|
if (!data.webhookUrl.startsWith("https://hooks.slack.com/services/")) {
|
|
698
957
|
throw new BadDataException("Invalid Slack webhook URL");
|
|
@@ -738,8 +997,12 @@ You will receive real-time notifications for:
|
|
|
738
997
|
});
|
|
739
998
|
}
|
|
740
999
|
catch (error) {
|
|
741
|
-
logger.error("Error sending test Slack notification:"
|
|
742
|
-
|
|
1000
|
+
logger.error("Error sending test Slack notification:", {
|
|
1001
|
+
projectId: (_a = statusPage === null || statusPage === void 0 ? void 0 : statusPage.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
1002
|
+
});
|
|
1003
|
+
logger.error(error, {
|
|
1004
|
+
projectId: (_b = statusPage === null || statusPage === void 0 ? void 0 : statusPage.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
1005
|
+
});
|
|
743
1006
|
throw error;
|
|
744
1007
|
}
|
|
745
1008
|
}
|