@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
|
@@ -27,9 +27,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
27
27
|
.startsWith("https://hooks.slack.com/services/");
|
|
28
28
|
}
|
|
29
29
|
static async getUsernameFromUserId(data) {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
const usernameLogAttributes = {
|
|
32
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
33
|
+
};
|
|
34
|
+
logger.debug("Getting username from user ID with data:", usernameLogAttributes);
|
|
35
|
+
logger.debug(data, usernameLogAttributes);
|
|
33
36
|
const response = await API.post({
|
|
34
37
|
url: URL.fromString("https://slack.com/api/users.info"),
|
|
35
38
|
data: {
|
|
@@ -44,38 +47,39 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
44
47
|
exponentialBackoff: true,
|
|
45
48
|
},
|
|
46
49
|
});
|
|
47
|
-
logger.debug("Response from Slack API for getting user info:");
|
|
48
|
-
logger.debug(response);
|
|
50
|
+
logger.debug("Response from Slack API for getting user info:", usernameLogAttributes);
|
|
51
|
+
logger.debug(response, usernameLogAttributes);
|
|
49
52
|
if (response instanceof HTTPErrorResponse) {
|
|
50
|
-
logger.error("Error response from Slack API:");
|
|
51
|
-
logger.error(response);
|
|
53
|
+
logger.error("Error response from Slack API:", usernameLogAttributes);
|
|
54
|
+
logger.error(response, usernameLogAttributes);
|
|
52
55
|
throw response;
|
|
53
56
|
}
|
|
54
57
|
// check for ok response
|
|
55
|
-
if (((
|
|
56
|
-
logger.error("Invalid response from Slack API:");
|
|
57
|
-
logger.error(response.jsonData);
|
|
58
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
59
|
+
logger.error("Invalid response from Slack API:", usernameLogAttributes);
|
|
60
|
+
logger.error(response.jsonData, usernameLogAttributes);
|
|
58
61
|
return null;
|
|
59
62
|
}
|
|
60
|
-
if (!((
|
|
61
|
-
logger.error("Invalid response from Slack API:");
|
|
62
|
-
logger.error(response.jsonData);
|
|
63
|
+
if (!((_d = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["user"]) === null || _d === void 0 ? void 0 : _d["name"])) {
|
|
64
|
+
logger.error("Invalid response from Slack API:", usernameLogAttributes);
|
|
65
|
+
logger.error(response.jsonData, usernameLogAttributes);
|
|
63
66
|
return null;
|
|
64
67
|
}
|
|
65
68
|
const username = response.jsonData["user"]["name"];
|
|
66
|
-
logger.debug("Username obtained:");
|
|
67
|
-
logger.debug(username);
|
|
69
|
+
logger.debug("Username obtained:", usernameLogAttributes);
|
|
70
|
+
logger.debug(username, usernameLogAttributes);
|
|
68
71
|
return username;
|
|
69
72
|
}
|
|
70
73
|
static async showModalToUser(data) {
|
|
71
74
|
var _a, _b;
|
|
72
|
-
|
|
73
|
-
logger.debug(data);
|
|
75
|
+
const modalLogAttributes = { triggerId: data.triggerId };
|
|
76
|
+
logger.debug("Showing modal to user with data:", modalLogAttributes);
|
|
77
|
+
logger.debug(data, modalLogAttributes);
|
|
74
78
|
const modalJson = this.getModalBlock({
|
|
75
79
|
payloadModalBlock: data.modalBlock,
|
|
76
80
|
});
|
|
77
|
-
logger.debug("Modal JSON generated:");
|
|
78
|
-
logger.debug(JSON.stringify(modalJson, null, 2));
|
|
81
|
+
logger.debug("Modal JSON generated:", modalLogAttributes);
|
|
82
|
+
logger.debug(JSON.stringify(modalJson, null, 2), modalLogAttributes);
|
|
79
83
|
// use view.open API to show modal
|
|
80
84
|
const result = await API.post({
|
|
81
85
|
url: URL.fromString("https://slack.com/api/views.open"),
|
|
@@ -93,17 +97,17 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
93
97
|
},
|
|
94
98
|
});
|
|
95
99
|
if (result instanceof HTTPErrorResponse) {
|
|
96
|
-
logger.error("Error response from Slack API:");
|
|
97
|
-
logger.error(result);
|
|
100
|
+
logger.error("Error response from Slack API:", modalLogAttributes);
|
|
101
|
+
logger.error(result, modalLogAttributes);
|
|
98
102
|
throw result;
|
|
99
103
|
}
|
|
100
104
|
if (((_a = result.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
101
|
-
logger.error("Invalid response from Slack API:");
|
|
102
|
-
logger.error(result.jsonData);
|
|
105
|
+
logger.error("Invalid response from Slack API:", modalLogAttributes);
|
|
106
|
+
logger.error(result.jsonData, modalLogAttributes);
|
|
103
107
|
const messageFromSlack = (_b = result.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
104
108
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
105
109
|
}
|
|
106
|
-
logger.debug("Modal shown to user successfully.");
|
|
110
|
+
logger.debug("Modal shown to user successfully.", modalLogAttributes);
|
|
107
111
|
}
|
|
108
112
|
static async sendEphemeralMessageToChannel(data) {
|
|
109
113
|
var _a, _b;
|
|
@@ -127,17 +131,25 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
127
131
|
},
|
|
128
132
|
});
|
|
129
133
|
if (response instanceof HTTPErrorResponse) {
|
|
130
|
-
logger.error("Error response from Slack API for ephemeral message:"
|
|
131
|
-
|
|
134
|
+
logger.error("Error response from Slack API for ephemeral message:", {
|
|
135
|
+
channelId: data.channelId,
|
|
136
|
+
});
|
|
137
|
+
logger.error(response, { channelId: data.channelId });
|
|
132
138
|
throw response;
|
|
133
139
|
}
|
|
134
140
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
135
|
-
logger.error("Invalid response from Slack API for ephemeral message:"
|
|
136
|
-
|
|
141
|
+
logger.error("Invalid response from Slack API for ephemeral message:", {
|
|
142
|
+
channelId: data.channelId,
|
|
143
|
+
});
|
|
144
|
+
logger.error(response.jsonData, {
|
|
145
|
+
channelId: data.channelId,
|
|
146
|
+
});
|
|
137
147
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
138
148
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
139
149
|
}
|
|
140
|
-
logger.debug("Ephemeral message sent successfully."
|
|
150
|
+
logger.debug("Ephemeral message sent successfully.", {
|
|
151
|
+
channelId: data.channelId,
|
|
152
|
+
});
|
|
141
153
|
}
|
|
142
154
|
static async sendDirectMessageToUser(data) {
|
|
143
155
|
// Send direct message to user
|
|
@@ -155,7 +167,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
155
167
|
});
|
|
156
168
|
}
|
|
157
169
|
static async archiveChannels(data) {
|
|
158
|
-
var _a, _b;
|
|
170
|
+
var _a, _b, _c;
|
|
159
171
|
if (data.sendMessageBeforeArchiving) {
|
|
160
172
|
await this.sendMessage({
|
|
161
173
|
workspaceMessagePayload: {
|
|
@@ -170,8 +182,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
170
182
|
projectId: data.projectId,
|
|
171
183
|
});
|
|
172
184
|
}
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
const archiveLogAttributes = {
|
|
186
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
187
|
+
};
|
|
188
|
+
logger.debug("Archiving channels with data:", archiveLogAttributes);
|
|
189
|
+
logger.debug(data, archiveLogAttributes);
|
|
175
190
|
for (const channelId of data.channelIds) {
|
|
176
191
|
const response = await API.post({
|
|
177
192
|
url: URL.fromString("https://slack.com/api/conversations.archive"),
|
|
@@ -187,26 +202,27 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
187
202
|
exponentialBackoff: true,
|
|
188
203
|
},
|
|
189
204
|
});
|
|
190
|
-
logger.debug("Response from Slack API for archiving channel:");
|
|
191
|
-
logger.debug(response);
|
|
205
|
+
logger.debug("Response from Slack API for archiving channel:", archiveLogAttributes);
|
|
206
|
+
logger.debug(response, archiveLogAttributes);
|
|
192
207
|
if (response instanceof HTTPErrorResponse) {
|
|
193
|
-
logger.error("Error response from Slack API:");
|
|
194
|
-
logger.error(response);
|
|
208
|
+
logger.error("Error response from Slack API:", archiveLogAttributes);
|
|
209
|
+
logger.error(response, archiveLogAttributes);
|
|
195
210
|
throw response;
|
|
196
211
|
}
|
|
197
|
-
if (((
|
|
198
|
-
logger.error("Invalid response from Slack API:");
|
|
199
|
-
logger.error(response.jsonData);
|
|
200
|
-
const messageFromSlack = (
|
|
212
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
213
|
+
logger.error("Invalid response from Slack API:", archiveLogAttributes);
|
|
214
|
+
logger.error(response.jsonData, archiveLogAttributes);
|
|
215
|
+
const messageFromSlack = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["error"];
|
|
201
216
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
202
217
|
}
|
|
203
218
|
}
|
|
204
|
-
logger.debug("Channels archived successfully.");
|
|
219
|
+
logger.debug("Channels archived successfully.", archiveLogAttributes);
|
|
205
220
|
}
|
|
206
221
|
static async joinChannel(data) {
|
|
207
222
|
var _a, _b;
|
|
208
|
-
|
|
209
|
-
logger.debug(data);
|
|
223
|
+
const joinLogAttributes = { channelId: data.channelId };
|
|
224
|
+
logger.debug("Joining channel with data:", joinLogAttributes);
|
|
225
|
+
logger.debug(data, joinLogAttributes);
|
|
210
226
|
// Join channel
|
|
211
227
|
const response = await API.post({
|
|
212
228
|
url: URL.fromString("https://slack.com/api/conversations.join"),
|
|
@@ -222,21 +238,21 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
222
238
|
exponentialBackoff: true,
|
|
223
239
|
},
|
|
224
240
|
});
|
|
225
|
-
logger.debug("Response from Slack API for joining channel:");
|
|
226
|
-
logger.debug(response);
|
|
241
|
+
logger.debug("Response from Slack API for joining channel:", joinLogAttributes);
|
|
242
|
+
logger.debug(response, joinLogAttributes);
|
|
227
243
|
if (response instanceof HTTPErrorResponse) {
|
|
228
|
-
logger.error("Error response from Slack API:");
|
|
229
|
-
logger.error(response);
|
|
244
|
+
logger.error("Error response from Slack API:", joinLogAttributes);
|
|
245
|
+
logger.error(response, joinLogAttributes);
|
|
230
246
|
throw response;
|
|
231
247
|
}
|
|
232
248
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
233
|
-
logger.error("Invalid response from Slack API:");
|
|
234
|
-
logger.error(response.jsonData);
|
|
249
|
+
logger.error("Invalid response from Slack API:", joinLogAttributes);
|
|
250
|
+
logger.error(response.jsonData, joinLogAttributes);
|
|
235
251
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
236
252
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
237
253
|
}
|
|
238
|
-
logger.debug("Channel joined successfully with data:");
|
|
239
|
-
logger.debug(data);
|
|
254
|
+
logger.debug("Channel joined successfully with data:", joinLogAttributes);
|
|
255
|
+
logger.debug(data, joinLogAttributes);
|
|
240
256
|
}
|
|
241
257
|
static async inviteUserToChannelByChannelId(data) {
|
|
242
258
|
var _a, _b;
|
|
@@ -247,11 +263,16 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
247
263
|
userId: data.workspaceUserId,
|
|
248
264
|
});
|
|
249
265
|
if (isUserInChannel) {
|
|
250
|
-
logger.debug("User already in channel."
|
|
266
|
+
logger.debug("User already in channel.", {
|
|
267
|
+
channelId: data.channelId,
|
|
268
|
+
});
|
|
251
269
|
return;
|
|
252
270
|
}
|
|
253
|
-
|
|
254
|
-
|
|
271
|
+
const inviteByIdLogAttributes = {
|
|
272
|
+
channelId: data.channelId,
|
|
273
|
+
};
|
|
274
|
+
logger.debug("Inviting user to channel with data:", inviteByIdLogAttributes);
|
|
275
|
+
logger.debug(data, inviteByIdLogAttributes);
|
|
255
276
|
const response = await API.post({
|
|
256
277
|
url: URL.fromString("https://slack.com/api/conversations.invite"),
|
|
257
278
|
data: {
|
|
@@ -267,28 +288,33 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
267
288
|
exponentialBackoff: true,
|
|
268
289
|
},
|
|
269
290
|
});
|
|
270
|
-
logger.debug("Response from Slack API for inviting user:");
|
|
271
|
-
logger.debug(response);
|
|
291
|
+
logger.debug("Response from Slack API for inviting user:", inviteByIdLogAttributes);
|
|
292
|
+
logger.debug(response, inviteByIdLogAttributes);
|
|
272
293
|
if (response instanceof HTTPErrorResponse) {
|
|
273
|
-
logger.error("Error response from Slack API:");
|
|
274
|
-
logger.error(response);
|
|
294
|
+
logger.error("Error response from Slack API:", inviteByIdLogAttributes);
|
|
295
|
+
logger.error(response, inviteByIdLogAttributes);
|
|
275
296
|
throw response;
|
|
276
297
|
}
|
|
277
298
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
278
|
-
logger.error("Invalid response from Slack API:");
|
|
279
|
-
logger.error(response.jsonData);
|
|
299
|
+
logger.error("Invalid response from Slack API:", inviteByIdLogAttributes);
|
|
300
|
+
logger.error(response.jsonData, inviteByIdLogAttributes);
|
|
280
301
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
281
302
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
282
303
|
}
|
|
283
|
-
logger.debug("User invited to channel successfully.");
|
|
304
|
+
logger.debug("User invited to channel successfully.", inviteByIdLogAttributes);
|
|
284
305
|
}
|
|
285
306
|
static async inviteUserToChannelByChannelName(data) {
|
|
307
|
+
var _a, _b;
|
|
286
308
|
if (data.channelName && data.channelName.startsWith("#")) {
|
|
287
309
|
// trim # from channel name
|
|
288
310
|
data.channelName = data.channelName.substring(1);
|
|
289
311
|
}
|
|
290
|
-
logger.debug("Inviting user to channel with data:"
|
|
291
|
-
|
|
312
|
+
logger.debug("Inviting user to channel with data:", {
|
|
313
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
314
|
+
});
|
|
315
|
+
logger.debug(data, {
|
|
316
|
+
projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
317
|
+
});
|
|
292
318
|
const channelId = (await this.getWorkspaceChannelFromChannelName({
|
|
293
319
|
authToken: data.authToken,
|
|
294
320
|
channelName: data.channelName,
|
|
@@ -301,8 +327,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
301
327
|
});
|
|
302
328
|
}
|
|
303
329
|
static async createChannelsIfDoesNotExist(data) {
|
|
304
|
-
|
|
305
|
-
|
|
330
|
+
var _a;
|
|
331
|
+
const createChLogAttributes = {
|
|
332
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
333
|
+
};
|
|
334
|
+
logger.debug("Creating channels if they do not exist with data:", createChLogAttributes);
|
|
335
|
+
logger.debug(data, createChLogAttributes);
|
|
306
336
|
const workspaceChannels = [];
|
|
307
337
|
for (let channelName of data.channelNames) {
|
|
308
338
|
/*
|
|
@@ -320,45 +350,50 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
320
350
|
projectId: data.projectId,
|
|
321
351
|
});
|
|
322
352
|
if (existingChannel) {
|
|
323
|
-
logger.debug(`Channel ${channelName} already exists
|
|
353
|
+
logger.debug(`Channel ${channelName} already exists.`, createChLogAttributes);
|
|
324
354
|
workspaceChannels.push(existingChannel);
|
|
325
355
|
continue;
|
|
326
356
|
}
|
|
327
|
-
logger.debug(`Channel ${channelName} does not exist. Creating channel
|
|
357
|
+
logger.debug(`Channel ${channelName} does not exist. Creating channel.`, createChLogAttributes);
|
|
328
358
|
const channel = await this.createChannel({
|
|
329
359
|
authToken: data.authToken,
|
|
330
360
|
channelName: channelName,
|
|
331
361
|
projectId: data.projectId,
|
|
332
362
|
});
|
|
333
363
|
if (channel) {
|
|
334
|
-
logger.debug(`Channel ${channelName} created successfully
|
|
364
|
+
logger.debug(`Channel ${channelName} created successfully.`, createChLogAttributes);
|
|
335
365
|
workspaceChannels.push(channel);
|
|
336
366
|
}
|
|
337
367
|
}
|
|
338
|
-
logger.debug("Channels created or found:");
|
|
339
|
-
logger.debug(workspaceChannels);
|
|
368
|
+
logger.debug("Channels created or found:", createChLogAttributes);
|
|
369
|
+
logger.debug(workspaceChannels, createChLogAttributes);
|
|
340
370
|
return workspaceChannels;
|
|
341
371
|
}
|
|
342
372
|
static async getWorkspaceChannelFromChannelName(data) {
|
|
343
|
-
|
|
344
|
-
|
|
373
|
+
var _a;
|
|
374
|
+
const getChNameLogAttributes = {
|
|
375
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
376
|
+
};
|
|
377
|
+
logger.debug("Getting workspace channel ID from channel name with data:", getChNameLogAttributes);
|
|
378
|
+
logger.debug(data, getChNameLogAttributes);
|
|
345
379
|
const channel = await this.getWorkspaceChannelByName({
|
|
346
380
|
authToken: data.authToken,
|
|
347
381
|
channelName: data.channelName,
|
|
348
382
|
projectId: data.projectId,
|
|
349
383
|
});
|
|
350
384
|
if (!channel) {
|
|
351
|
-
logger.error("Channel not found.");
|
|
385
|
+
logger.error("Channel not found.", getChNameLogAttributes);
|
|
352
386
|
throw new BadDataException("Channel not found.");
|
|
353
387
|
}
|
|
354
|
-
logger.debug("Workspace channel obtained:");
|
|
355
|
-
logger.debug(channel);
|
|
388
|
+
logger.debug("Workspace channel obtained:", getChNameLogAttributes);
|
|
389
|
+
logger.debug(channel, getChNameLogAttributes);
|
|
356
390
|
return channel;
|
|
357
391
|
}
|
|
358
392
|
static async getWorkspaceChannelFromChannelId(data) {
|
|
359
393
|
var _a, _b, _c, _d;
|
|
360
|
-
|
|
361
|
-
logger.debug(data);
|
|
394
|
+
const getChIdLogAttributes = { channelId: data.channelId };
|
|
395
|
+
logger.debug("Getting workspace channel from channel ID with data:", getChIdLogAttributes);
|
|
396
|
+
logger.debug(data, getChIdLogAttributes);
|
|
362
397
|
const response = await API.post({
|
|
363
398
|
url: URL.fromString("https://slack.com/api/conversations.info"),
|
|
364
399
|
data: {
|
|
@@ -373,23 +408,23 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
373
408
|
exponentialBackoff: true,
|
|
374
409
|
},
|
|
375
410
|
});
|
|
376
|
-
logger.debug("Response from Slack API for getting channel info:");
|
|
377
|
-
logger.debug(response);
|
|
411
|
+
logger.debug("Response from Slack API for getting channel info:", getChIdLogAttributes);
|
|
412
|
+
logger.debug(response, getChIdLogAttributes);
|
|
378
413
|
if (response instanceof HTTPErrorResponse) {
|
|
379
|
-
logger.error("Error response from Slack API:");
|
|
380
|
-
logger.error(response);
|
|
414
|
+
logger.error("Error response from Slack API:", getChIdLogAttributes);
|
|
415
|
+
logger.error(response, getChIdLogAttributes);
|
|
381
416
|
throw response;
|
|
382
417
|
}
|
|
383
418
|
// check for ok response
|
|
384
419
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
385
|
-
logger.error("Invalid response from Slack API:");
|
|
386
|
-
logger.error(response.jsonData);
|
|
420
|
+
logger.error("Invalid response from Slack API:", getChIdLogAttributes);
|
|
421
|
+
logger.error(response.jsonData, getChIdLogAttributes);
|
|
387
422
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
388
423
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
389
424
|
}
|
|
390
425
|
if (!((_d = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["channel"]) === null || _d === void 0 ? void 0 : _d["name"])) {
|
|
391
|
-
logger.error("Invalid response from Slack API:");
|
|
392
|
-
logger.error(response.jsonData);
|
|
426
|
+
logger.error("Invalid response from Slack API:", getChIdLogAttributes);
|
|
427
|
+
logger.error(response.jsonData, getChIdLogAttributes);
|
|
393
428
|
throw new Error("Invalid response");
|
|
394
429
|
}
|
|
395
430
|
const channel = {
|
|
@@ -397,14 +432,17 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
397
432
|
id: data.channelId,
|
|
398
433
|
workspaceType: WorkspaceType.Slack,
|
|
399
434
|
};
|
|
400
|
-
logger.debug("Workspace channel obtained:");
|
|
401
|
-
logger.debug(channel);
|
|
435
|
+
logger.debug("Workspace channel obtained:", getChIdLogAttributes);
|
|
436
|
+
logger.debug(channel, getChIdLogAttributes);
|
|
402
437
|
return channel;
|
|
403
438
|
}
|
|
404
439
|
static async getAllWorkspaceChannels(data) {
|
|
405
|
-
var _a, _b, _c;
|
|
406
|
-
|
|
407
|
-
|
|
440
|
+
var _a, _b, _c, _d;
|
|
441
|
+
const getAllChLogAttributes = {
|
|
442
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
443
|
+
};
|
|
444
|
+
logger.debug("Getting all workspace channels with data:", getAllChLogAttributes);
|
|
445
|
+
logger.debug(data, getAllChLogAttributes);
|
|
408
446
|
const channels = {};
|
|
409
447
|
let cursor = undefined;
|
|
410
448
|
const maxPages = 100;
|
|
@@ -432,15 +470,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
432
470
|
},
|
|
433
471
|
});
|
|
434
472
|
if (response instanceof HTTPErrorResponse) {
|
|
435
|
-
logger.error("Error response from Slack API:");
|
|
436
|
-
logger.error(response);
|
|
473
|
+
logger.error("Error response from Slack API:", getAllChLogAttributes);
|
|
474
|
+
logger.error(response, getAllChLogAttributes);
|
|
437
475
|
throw response;
|
|
438
476
|
}
|
|
439
477
|
// check for ok response
|
|
440
|
-
if (((
|
|
441
|
-
logger.error("Invalid response from Slack API:");
|
|
442
|
-
logger.error(response.jsonData);
|
|
443
|
-
const messageFromSlack = (
|
|
478
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
479
|
+
logger.error("Invalid response from Slack API:", getAllChLogAttributes);
|
|
480
|
+
logger.error(response.jsonData, getAllChLogAttributes);
|
|
481
|
+
const messageFromSlack = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["error"];
|
|
444
482
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
445
483
|
}
|
|
446
484
|
for (const channel of response.jsonData["channels"]) {
|
|
@@ -462,7 +500,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
462
500
|
lastUpdated: OneUptimeDate.toString(OneUptimeDate.getCurrentDate()),
|
|
463
501
|
};
|
|
464
502
|
}
|
|
465
|
-
cursor = (
|
|
503
|
+
cursor = (_d = response.jsonData["response_metadata"]) === null || _d === void 0 ? void 0 : _d["next_cursor"];
|
|
466
504
|
pageCount++;
|
|
467
505
|
} while (cursor && pageCount < maxPages);
|
|
468
506
|
// Update cache in bulk
|
|
@@ -473,20 +511,23 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
473
511
|
});
|
|
474
512
|
}
|
|
475
513
|
catch (error) {
|
|
476
|
-
logger.error("Error bulk updating channel cache:");
|
|
477
|
-
logger.error(error);
|
|
514
|
+
logger.error("Error bulk updating channel cache:", getAllChLogAttributes);
|
|
515
|
+
logger.error(error, getAllChLogAttributes);
|
|
478
516
|
// Don't fail the request if caching fails
|
|
479
517
|
}
|
|
480
|
-
logger.debug("All workspace channels obtained:");
|
|
518
|
+
logger.debug("All workspace channels obtained:", getAllChLogAttributes);
|
|
481
519
|
return channels;
|
|
482
520
|
}
|
|
483
521
|
static async updateChannelsInCache(data) {
|
|
522
|
+
var _a, _b;
|
|
484
523
|
const projectAuth = await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
485
524
|
projectId: data.projectId,
|
|
486
525
|
workspaceType: WorkspaceType.Slack,
|
|
487
526
|
});
|
|
488
527
|
if (!projectAuth) {
|
|
489
|
-
logger.debug("No project auth found, cannot update cache"
|
|
528
|
+
logger.debug("No project auth found, cannot update cache", {
|
|
529
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
530
|
+
});
|
|
490
531
|
return;
|
|
491
532
|
}
|
|
492
533
|
const miscData = projectAuth.miscData || {};
|
|
@@ -503,23 +544,29 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
503
544
|
workspaceProjectId: projectAuth.workspaceProjectId,
|
|
504
545
|
miscData: miscData,
|
|
505
546
|
});
|
|
506
|
-
logger.debug("Channel cache updated successfully"
|
|
547
|
+
logger.debug("Channel cache updated successfully", {
|
|
548
|
+
projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
549
|
+
});
|
|
507
550
|
}
|
|
508
551
|
static async getChannelFromCache(data) {
|
|
509
|
-
|
|
510
|
-
|
|
552
|
+
var _a;
|
|
553
|
+
const cacheGetLogAttributes = {
|
|
554
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
555
|
+
};
|
|
556
|
+
logger.debug("Getting channel from cache with data:", cacheGetLogAttributes);
|
|
557
|
+
logger.debug(data, cacheGetLogAttributes);
|
|
511
558
|
const projectAuth = await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
512
559
|
projectId: data.projectId,
|
|
513
560
|
workspaceType: WorkspaceType.Slack,
|
|
514
561
|
});
|
|
515
562
|
if (!projectAuth || !projectAuth.miscData) {
|
|
516
|
-
logger.debug("No project auth found or no misc data");
|
|
563
|
+
logger.debug("No project auth found or no misc data", cacheGetLogAttributes);
|
|
517
564
|
return null;
|
|
518
565
|
}
|
|
519
566
|
const miscData = projectAuth.miscData;
|
|
520
567
|
const channelCache = miscData.channelCache;
|
|
521
568
|
if (!channelCache || !channelCache[data.channelName]) {
|
|
522
|
-
logger.debug("Channel not found in cache");
|
|
569
|
+
logger.debug("Channel not found in cache", cacheGetLogAttributes);
|
|
523
570
|
return null;
|
|
524
571
|
}
|
|
525
572
|
const cachedChannelData = channelCache[data.channelName];
|
|
@@ -528,19 +575,23 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
528
575
|
name: cachedChannelData.name,
|
|
529
576
|
workspaceType: WorkspaceType.Slack,
|
|
530
577
|
};
|
|
531
|
-
logger.debug("Channel found in cache:");
|
|
532
|
-
logger.debug(channel);
|
|
578
|
+
logger.debug("Channel found in cache:", cacheGetLogAttributes);
|
|
579
|
+
logger.debug(channel, cacheGetLogAttributes);
|
|
533
580
|
return channel;
|
|
534
581
|
}
|
|
535
582
|
static async updateChannelCache(data) {
|
|
536
|
-
|
|
537
|
-
|
|
583
|
+
var _a;
|
|
584
|
+
const cacheUpdateLogAttributes = {
|
|
585
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
586
|
+
};
|
|
587
|
+
logger.debug("Updating channel cache with data:", cacheUpdateLogAttributes);
|
|
588
|
+
logger.debug(data, cacheUpdateLogAttributes);
|
|
538
589
|
const projectAuth = await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
539
590
|
projectId: data.projectId,
|
|
540
591
|
workspaceType: WorkspaceType.Slack,
|
|
541
592
|
});
|
|
542
593
|
if (!projectAuth) {
|
|
543
|
-
logger.debug("No project auth found, cannot update cache");
|
|
594
|
+
logger.debug("No project auth found, cannot update cache", cacheUpdateLogAttributes);
|
|
544
595
|
return;
|
|
545
596
|
}
|
|
546
597
|
const miscData = projectAuth.miscData || {};
|
|
@@ -561,12 +612,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
561
612
|
workspaceProjectId: projectAuth.workspaceProjectId,
|
|
562
613
|
miscData: miscData,
|
|
563
614
|
});
|
|
564
|
-
logger.debug("Channel cache updated successfully");
|
|
615
|
+
logger.debug("Channel cache updated successfully", cacheUpdateLogAttributes);
|
|
565
616
|
}
|
|
566
617
|
static async getWorkspaceChannelByName(data) {
|
|
567
|
-
var _a, _b, _c;
|
|
568
|
-
|
|
569
|
-
|
|
618
|
+
var _a, _b, _c, _d;
|
|
619
|
+
const getByNameLogAttributes = {
|
|
620
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
621
|
+
};
|
|
622
|
+
logger.debug("Getting workspace channel by name with data:", getByNameLogAttributes);
|
|
623
|
+
logger.debug(data, getByNameLogAttributes);
|
|
570
624
|
// Normalize channel name
|
|
571
625
|
let normalizedChannelName = data.channelName;
|
|
572
626
|
if (normalizedChannelName && normalizedChannelName.startsWith("#")) {
|
|
@@ -580,14 +634,14 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
580
634
|
channelName: normalizedChannelName,
|
|
581
635
|
});
|
|
582
636
|
if (cachedChannel) {
|
|
583
|
-
logger.debug("Channel found in cache:");
|
|
584
|
-
logger.debug(cachedChannel);
|
|
637
|
+
logger.debug("Channel found in cache:", getByNameLogAttributes);
|
|
638
|
+
logger.debug(cachedChannel, getByNameLogAttributes);
|
|
585
639
|
return cachedChannel;
|
|
586
640
|
}
|
|
587
641
|
}
|
|
588
642
|
catch (error) {
|
|
589
|
-
logger.error("Error getting channel from cache, falling back to API:");
|
|
590
|
-
logger.error(error);
|
|
643
|
+
logger.error("Error getting channel from cache, falling back to API:", getByNameLogAttributes);
|
|
644
|
+
logger.error(error, getByNameLogAttributes);
|
|
591
645
|
}
|
|
592
646
|
let cursor = undefined;
|
|
593
647
|
const maxPages = 500;
|
|
@@ -615,20 +669,20 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
615
669
|
},
|
|
616
670
|
});
|
|
617
671
|
if (response instanceof HTTPErrorResponse) {
|
|
618
|
-
logger.error("Error response from Slack API:");
|
|
619
|
-
logger.error(response);
|
|
672
|
+
logger.error("Error response from Slack API:", getByNameLogAttributes);
|
|
673
|
+
logger.error(response, getByNameLogAttributes);
|
|
620
674
|
throw response;
|
|
621
675
|
}
|
|
622
676
|
// check for ok response
|
|
623
|
-
if (((
|
|
624
|
-
logger.error("Invalid response from Slack API:");
|
|
625
|
-
logger.error(response.jsonData);
|
|
626
|
-
const messageFromSlack = (
|
|
677
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
678
|
+
logger.error("Invalid response from Slack API:", getByNameLogAttributes);
|
|
679
|
+
logger.error(response.jsonData, getByNameLogAttributes);
|
|
680
|
+
const messageFromSlack = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["error"];
|
|
627
681
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
628
682
|
}
|
|
629
|
-
logger.debug("Searching for " + normalizedChannelName);
|
|
630
|
-
logger.debug("Searching channels in current page...");
|
|
631
|
-
logger.debug(JSON.stringify(response.jsonData["channels"], null, 2));
|
|
683
|
+
logger.debug("Searching for " + normalizedChannelName, getByNameLogAttributes);
|
|
684
|
+
logger.debug("Searching channels in current page...", getByNameLogAttributes);
|
|
685
|
+
logger.debug(JSON.stringify(response.jsonData["channels"], null, 2), getByNameLogAttributes);
|
|
632
686
|
for (const channel of response.jsonData["channels"]) {
|
|
633
687
|
if (!channel["id"] || !channel["name"]) {
|
|
634
688
|
continue;
|
|
@@ -648,8 +702,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
648
702
|
};
|
|
649
703
|
const channelName = channel["name"].toLowerCase();
|
|
650
704
|
if (channelName === normalizedChannelName) {
|
|
651
|
-
logger.debug("Channel found:");
|
|
652
|
-
logger.debug(channel);
|
|
705
|
+
logger.debug("Channel found:", getByNameLogAttributes);
|
|
706
|
+
logger.debug(channel, getByNameLogAttributes);
|
|
653
707
|
// Update cache before returning
|
|
654
708
|
try {
|
|
655
709
|
await this.updateChannelsInCache({
|
|
@@ -658,14 +712,14 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
658
712
|
});
|
|
659
713
|
}
|
|
660
714
|
catch (error) {
|
|
661
|
-
logger.error("Error bulk updating channel cache:");
|
|
662
|
-
logger.error(error);
|
|
715
|
+
logger.error("Error bulk updating channel cache:", getByNameLogAttributes);
|
|
716
|
+
logger.error(error, getByNameLogAttributes);
|
|
663
717
|
// Don't fail the request if caching fails
|
|
664
718
|
}
|
|
665
719
|
return channelObj;
|
|
666
720
|
}
|
|
667
721
|
}
|
|
668
|
-
cursor = (
|
|
722
|
+
cursor = (_d = response.jsonData["response_metadata"]) === null || _d === void 0 ? void 0 : _d["next_cursor"];
|
|
669
723
|
pageCount++;
|
|
670
724
|
} while (cursor && pageCount < maxPages);
|
|
671
725
|
// Update cache even if channel not found
|
|
@@ -676,11 +730,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
676
730
|
});
|
|
677
731
|
}
|
|
678
732
|
catch (error) {
|
|
679
|
-
logger.error("Error bulk updating channel cache:");
|
|
680
|
-
logger.error(error);
|
|
733
|
+
logger.error("Error bulk updating channel cache:", getByNameLogAttributes);
|
|
734
|
+
logger.error(error, getByNameLogAttributes);
|
|
681
735
|
// Don't fail the request if caching fails
|
|
682
736
|
}
|
|
683
|
-
logger.debug("Channel not found:");
|
|
737
|
+
logger.debug("Channel not found:", getByNameLogAttributes);
|
|
684
738
|
return null;
|
|
685
739
|
}
|
|
686
740
|
static getDividerBlock() {
|
|
@@ -690,8 +744,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
690
744
|
}
|
|
691
745
|
static getValuesFromView(data) {
|
|
692
746
|
var _a, _b;
|
|
693
|
-
logger.debug("Getting values from view with data:");
|
|
694
|
-
logger.debug(JSON.stringify(data, null, 2));
|
|
747
|
+
logger.debug("Getting values from view with data:", {});
|
|
748
|
+
logger.debug(JSON.stringify(data, null, 2), {});
|
|
695
749
|
const slackView = data.view;
|
|
696
750
|
const values = {};
|
|
697
751
|
if (!slackView["state"] || !slackView["state"]["values"]) {
|
|
@@ -716,8 +770,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
716
770
|
}
|
|
717
771
|
}
|
|
718
772
|
}
|
|
719
|
-
logger.debug("Values obtained from view:");
|
|
720
|
-
logger.debug(values);
|
|
773
|
+
logger.debug("Values obtained from view:", {});
|
|
774
|
+
logger.debug(values, {});
|
|
721
775
|
return values;
|
|
722
776
|
}
|
|
723
777
|
static async doesChannelExist(data) {
|
|
@@ -736,11 +790,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
736
790
|
return channel !== null;
|
|
737
791
|
}
|
|
738
792
|
static async sendMessage(data) {
|
|
739
|
-
|
|
740
|
-
|
|
793
|
+
var _a;
|
|
794
|
+
const sendMsgLogAttributes = {
|
|
795
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
796
|
+
};
|
|
797
|
+
logger.debug("Sending message to Slack with data:", sendMsgLogAttributes);
|
|
798
|
+
logger.debug(data, sendMsgLogAttributes);
|
|
741
799
|
const blocks = this.getBlocksFromWorkspaceMessagePayload(data.workspaceMessagePayload);
|
|
742
|
-
logger.debug("Blocks generated from workspace message payload:");
|
|
743
|
-
logger.debug(blocks);
|
|
800
|
+
logger.debug("Blocks generated from workspace message payload:", sendMsgLogAttributes);
|
|
801
|
+
logger.debug(blocks, sendMsgLogAttributes);
|
|
744
802
|
const workspaceChannelsToPostTo = [];
|
|
745
803
|
// Resolve channel names efficiently
|
|
746
804
|
for (let channelName of data.workspaceMessagePayload.channelNames) {
|
|
@@ -757,7 +815,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
757
815
|
workspaceChannelsToPostTo.push(channel);
|
|
758
816
|
}
|
|
759
817
|
else {
|
|
760
|
-
logger.debug(`Channel ${channelName} does not exist
|
|
818
|
+
logger.debug(`Channel ${channelName} does not exist.`, sendMsgLogAttributes);
|
|
761
819
|
}
|
|
762
820
|
}
|
|
763
821
|
// add channel ids.
|
|
@@ -771,8 +829,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
771
829
|
workspaceChannelsToPostTo.push(channel);
|
|
772
830
|
}
|
|
773
831
|
catch (err) {
|
|
774
|
-
logger.error(`Error getting channel info for channel ID ${channelId}
|
|
775
|
-
logger.error(err);
|
|
832
|
+
logger.error(`Error getting channel info for channel ID ${channelId}:`, sendMsgLogAttributes);
|
|
833
|
+
logger.error(err, sendMsgLogAttributes);
|
|
776
834
|
// Fallback: create channel object with empty name if API call fails
|
|
777
835
|
const channel = {
|
|
778
836
|
id: channelId,
|
|
@@ -782,8 +840,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
782
840
|
workspaceChannelsToPostTo.push(channel);
|
|
783
841
|
}
|
|
784
842
|
}
|
|
785
|
-
logger.debug("Channel IDs to post to:");
|
|
786
|
-
logger.debug(workspaceChannelsToPostTo);
|
|
843
|
+
logger.debug("Channel IDs to post to:", sendMsgLogAttributes);
|
|
844
|
+
logger.debug(workspaceChannelsToPostTo, sendMsgLogAttributes);
|
|
787
845
|
const workspaspaceMessageResponse = {
|
|
788
846
|
threads: [],
|
|
789
847
|
workspaceType: WorkspaceType.Slack,
|
|
@@ -829,25 +887,28 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
829
887
|
if (lastThread) {
|
|
830
888
|
workspaspaceMessageResponse.threads.push(lastThread);
|
|
831
889
|
}
|
|
832
|
-
logger.debug(`Message sent to channel ID ${channel.id} successfully
|
|
890
|
+
logger.debug(`Message sent to channel ID ${channel.id} successfully.`, sendMsgLogAttributes);
|
|
833
891
|
}
|
|
834
892
|
catch (e) {
|
|
835
|
-
logger.error(`Error sending message to channel ID ${channel.id}
|
|
836
|
-
logger.error(e);
|
|
893
|
+
logger.error(`Error sending message to channel ID ${channel.id}:`, sendMsgLogAttributes);
|
|
894
|
+
logger.error(e, sendMsgLogAttributes);
|
|
837
895
|
workspaspaceMessageResponse.errors.push({
|
|
838
896
|
channel: channel,
|
|
839
897
|
error: e instanceof Error ? e.message : String(e),
|
|
840
898
|
});
|
|
841
899
|
}
|
|
842
900
|
}
|
|
843
|
-
logger.debug("Message sent successfully.");
|
|
844
|
-
logger.debug(workspaspaceMessageResponse);
|
|
901
|
+
logger.debug("Message sent successfully.", sendMsgLogAttributes);
|
|
902
|
+
logger.debug(workspaspaceMessageResponse, sendMsgLogAttributes);
|
|
845
903
|
return workspaspaceMessageResponse;
|
|
846
904
|
}
|
|
847
905
|
static async sendPayloadBlocksToChannel(data) {
|
|
848
|
-
var _a, _b;
|
|
849
|
-
|
|
850
|
-
|
|
906
|
+
var _a, _b, _c;
|
|
907
|
+
const payloadBlocksLogAttributes = {
|
|
908
|
+
channelId: (_a = data.workspaceChannel) === null || _a === void 0 ? void 0 : _a.id,
|
|
909
|
+
};
|
|
910
|
+
logger.debug("Sending payload blocks to channel with data:", payloadBlocksLogAttributes);
|
|
911
|
+
logger.debug(JSON.stringify(data, null, 2), payloadBlocksLogAttributes);
|
|
851
912
|
const response = await API.post({
|
|
852
913
|
url: URL.fromString("https://slack.com/api/chat.postMessage"),
|
|
853
914
|
data: {
|
|
@@ -864,20 +925,20 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
864
925
|
exponentialBackoff: true,
|
|
865
926
|
},
|
|
866
927
|
});
|
|
867
|
-
logger.debug("Response from Slack API for sending message:");
|
|
868
|
-
logger.debug(response);
|
|
928
|
+
logger.debug("Response from Slack API for sending message:", payloadBlocksLogAttributes);
|
|
929
|
+
logger.debug(response, payloadBlocksLogAttributes);
|
|
869
930
|
if (response instanceof HTTPErrorResponse) {
|
|
870
|
-
logger.error("Error response from Slack API:");
|
|
871
|
-
logger.error(response);
|
|
931
|
+
logger.error("Error response from Slack API:", payloadBlocksLogAttributes);
|
|
932
|
+
logger.error(response, payloadBlocksLogAttributes);
|
|
872
933
|
throw response;
|
|
873
934
|
}
|
|
874
|
-
if (((
|
|
875
|
-
logger.error("Invalid response from Slack API:");
|
|
876
|
-
logger.error(response.jsonData);
|
|
877
|
-
const messageFromSlack = (
|
|
935
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
936
|
+
logger.error("Invalid response from Slack API:", payloadBlocksLogAttributes);
|
|
937
|
+
logger.error(response.jsonData, payloadBlocksLogAttributes);
|
|
938
|
+
const messageFromSlack = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["error"];
|
|
878
939
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
879
940
|
}
|
|
880
|
-
logger.debug("Payload blocks sent to channel successfully.");
|
|
941
|
+
logger.debug("Payload blocks sent to channel successfully.", payloadBlocksLogAttributes);
|
|
881
942
|
return {
|
|
882
943
|
channel: data.workspaceChannel,
|
|
883
944
|
threadId: response.jsonData["ts"],
|
|
@@ -885,8 +946,9 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
885
946
|
}
|
|
886
947
|
static async sendMessageToThread(data) {
|
|
887
948
|
var _a, _b;
|
|
888
|
-
|
|
889
|
-
logger.debug(data);
|
|
949
|
+
const threadLogAttributes = { channelId: data.channelId };
|
|
950
|
+
logger.debug("Sending message to thread with data:", threadLogAttributes);
|
|
951
|
+
logger.debug(data, threadLogAttributes);
|
|
890
952
|
const response = await API.post({
|
|
891
953
|
url: URL.fromString("https://slack.com/api/chat.postMessage"),
|
|
892
954
|
data: {
|
|
@@ -903,25 +965,26 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
903
965
|
exponentialBackoff: true,
|
|
904
966
|
},
|
|
905
967
|
});
|
|
906
|
-
logger.debug("Response from Slack API for sending thread message:");
|
|
907
|
-
logger.debug(response);
|
|
968
|
+
logger.debug("Response from Slack API for sending thread message:", threadLogAttributes);
|
|
969
|
+
logger.debug(response, threadLogAttributes);
|
|
908
970
|
if (response instanceof HTTPErrorResponse) {
|
|
909
|
-
logger.error("Error response from Slack API:");
|
|
910
|
-
logger.error(response);
|
|
971
|
+
logger.error("Error response from Slack API:", threadLogAttributes);
|
|
972
|
+
logger.error(response, threadLogAttributes);
|
|
911
973
|
throw response;
|
|
912
974
|
}
|
|
913
975
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
914
|
-
logger.error("Invalid response from Slack API:");
|
|
915
|
-
logger.error(response.jsonData);
|
|
976
|
+
logger.error("Invalid response from Slack API:", threadLogAttributes);
|
|
977
|
+
logger.error(response.jsonData, threadLogAttributes);
|
|
916
978
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
917
979
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
918
980
|
}
|
|
919
|
-
logger.debug("Thread message sent successfully.");
|
|
981
|
+
logger.debug("Thread message sent successfully.", threadLogAttributes);
|
|
920
982
|
}
|
|
921
983
|
static async getMessageByTimestamp(data) {
|
|
922
984
|
var _a, _b, _c, _d;
|
|
923
|
-
|
|
924
|
-
logger.debug(data);
|
|
985
|
+
const getMsgLogAttributes = { channelId: data.channelId };
|
|
986
|
+
logger.debug("Getting message by timestamp with data:", getMsgLogAttributes);
|
|
987
|
+
logger.debug(data, getMsgLogAttributes);
|
|
925
988
|
const response = await API.post({
|
|
926
989
|
url: URL.fromString("https://slack.com/api/conversations.history"),
|
|
927
990
|
data: {
|
|
@@ -940,44 +1003,44 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
940
1003
|
exponentialBackoff: true,
|
|
941
1004
|
},
|
|
942
1005
|
});
|
|
943
|
-
logger.debug("Response from Slack API for getting message:");
|
|
944
|
-
logger.debug(response);
|
|
1006
|
+
logger.debug("Response from Slack API for getting message:", getMsgLogAttributes);
|
|
1007
|
+
logger.debug(response, getMsgLogAttributes);
|
|
945
1008
|
if (response instanceof HTTPErrorResponse) {
|
|
946
|
-
logger.error("Error response from Slack API:");
|
|
947
|
-
logger.error(response);
|
|
1009
|
+
logger.error("Error response from Slack API:", getMsgLogAttributes);
|
|
1010
|
+
logger.error(response, getMsgLogAttributes);
|
|
948
1011
|
throw response;
|
|
949
1012
|
}
|
|
950
1013
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
951
|
-
logger.error("Invalid response from Slack API:");
|
|
952
|
-
logger.error(response.jsonData);
|
|
1014
|
+
logger.error("Invalid response from Slack API:", getMsgLogAttributes);
|
|
1015
|
+
logger.error(response.jsonData, getMsgLogAttributes);
|
|
953
1016
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
954
1017
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
955
1018
|
}
|
|
956
1019
|
const messages = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["messages"];
|
|
957
1020
|
if (!messages || messages.length === 0) {
|
|
958
|
-
logger.debug("No messages found for timestamp.");
|
|
1021
|
+
logger.debug("No messages found for timestamp.", getMsgLogAttributes);
|
|
959
1022
|
return null;
|
|
960
1023
|
}
|
|
961
1024
|
const messageText = (_d = messages[0]) === null || _d === void 0 ? void 0 : _d["text"];
|
|
962
|
-
logger.debug("Message text retrieved:");
|
|
963
|
-
logger.debug(messageText);
|
|
1025
|
+
logger.debug("Message text retrieved:", getMsgLogAttributes);
|
|
1026
|
+
logger.debug(messageText, getMsgLogAttributes);
|
|
964
1027
|
return messageText || null;
|
|
965
1028
|
}
|
|
966
1029
|
static getButtonsBlock(data) {
|
|
967
|
-
logger.debug("Getting buttons block with data:");
|
|
968
|
-
logger.debug(data);
|
|
1030
|
+
logger.debug("Getting buttons block with data:", {});
|
|
1031
|
+
logger.debug(data, {});
|
|
969
1032
|
const buttonsBlock = {
|
|
970
1033
|
type: "actions",
|
|
971
1034
|
elements: data.payloadButtonsBlock.buttons.map((button) => {
|
|
972
1035
|
return this.getButtonBlock({ payloadButtonBlock: button });
|
|
973
1036
|
}),
|
|
974
1037
|
};
|
|
975
|
-
logger.debug("Buttons block generated:");
|
|
976
|
-
logger.debug(buttonsBlock);
|
|
1038
|
+
logger.debug("Buttons block generated:", {});
|
|
1039
|
+
logger.debug(buttonsBlock, {});
|
|
977
1040
|
return buttonsBlock;
|
|
978
1041
|
}
|
|
979
1042
|
static async createChannel(data) {
|
|
980
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1043
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
981
1044
|
/*
|
|
982
1045
|
* Sanitize channel name: Slack only allows lowercase letters, numbers,
|
|
983
1046
|
* hyphens, and underscores. Remove all other characters (including #).
|
|
@@ -985,8 +1048,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
985
1048
|
data.channelName = data.channelName
|
|
986
1049
|
.toLowerCase()
|
|
987
1050
|
.replace(/[^a-z0-9\-_]/g, "");
|
|
988
|
-
|
|
989
|
-
|
|
1051
|
+
const createChannelLogAttributes = {
|
|
1052
|
+
projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
1053
|
+
};
|
|
1054
|
+
logger.debug("Creating channel with data:", createChannelLogAttributes);
|
|
1055
|
+
logger.debug(data, createChannelLogAttributes);
|
|
990
1056
|
const response = await API.post({
|
|
991
1057
|
url: URL.fromString("https://slack.com/api/conversations.create"),
|
|
992
1058
|
data: {
|
|
@@ -1001,24 +1067,24 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1001
1067
|
exponentialBackoff: true,
|
|
1002
1068
|
},
|
|
1003
1069
|
});
|
|
1004
|
-
logger.debug("Response from Slack API for creating channel:");
|
|
1005
|
-
logger.debug(response);
|
|
1070
|
+
logger.debug("Response from Slack API for creating channel:", createChannelLogAttributes);
|
|
1071
|
+
logger.debug(response, createChannelLogAttributes);
|
|
1006
1072
|
if (response instanceof HTTPErrorResponse) {
|
|
1007
|
-
logger.error("Error response from Slack API:");
|
|
1008
|
-
logger.error(response);
|
|
1073
|
+
logger.error("Error response from Slack API:", createChannelLogAttributes);
|
|
1074
|
+
logger.error(response, createChannelLogAttributes);
|
|
1009
1075
|
throw response;
|
|
1010
1076
|
}
|
|
1011
1077
|
// check for ok response
|
|
1012
|
-
if (((
|
|
1013
|
-
logger.error("Invalid response from Slack API:");
|
|
1014
|
-
logger.error(response.jsonData);
|
|
1015
|
-
const messageFromSlack = (
|
|
1078
|
+
if (((_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["ok"]) !== true) {
|
|
1079
|
+
logger.error("Invalid response from Slack API:", createChannelLogAttributes);
|
|
1080
|
+
logger.error(response.jsonData, createChannelLogAttributes);
|
|
1081
|
+
const messageFromSlack = (_c = response.jsonData) === null || _c === void 0 ? void 0 : _c["error"];
|
|
1016
1082
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
1017
1083
|
}
|
|
1018
|
-
if (!((
|
|
1019
|
-
!((
|
|
1020
|
-
logger.error("Invalid response from Slack API:");
|
|
1021
|
-
logger.error(response.jsonData);
|
|
1084
|
+
if (!((_e = (_d = response.jsonData) === null || _d === void 0 ? void 0 : _d["channel"]) === null || _e === void 0 ? void 0 : _e["id"]) ||
|
|
1085
|
+
!((_g = (_f = response.jsonData) === null || _f === void 0 ? void 0 : _f["channel"]) === null || _g === void 0 ? void 0 : _g["name"])) {
|
|
1086
|
+
logger.error("Invalid response from Slack API:", createChannelLogAttributes);
|
|
1087
|
+
logger.error(response.jsonData, createChannelLogAttributes);
|
|
1022
1088
|
throw new Error("Invalid response");
|
|
1023
1089
|
}
|
|
1024
1090
|
const channel = {
|
|
@@ -1026,8 +1092,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1026
1092
|
name: response.jsonData["channel"]["name"],
|
|
1027
1093
|
workspaceType: WorkspaceType.Slack,
|
|
1028
1094
|
};
|
|
1029
|
-
logger.debug("Channel created successfully:");
|
|
1030
|
-
logger.debug(channel);
|
|
1095
|
+
logger.debug("Channel created successfully:", createChannelLogAttributes);
|
|
1096
|
+
logger.debug(channel, createChannelLogAttributes);
|
|
1031
1097
|
// Cache the created channel
|
|
1032
1098
|
try {
|
|
1033
1099
|
const localCache = {};
|
|
@@ -1043,15 +1109,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1043
1109
|
});
|
|
1044
1110
|
}
|
|
1045
1111
|
catch (error) {
|
|
1046
|
-
logger.error("Error caching created channel:");
|
|
1047
|
-
logger.error(error);
|
|
1112
|
+
logger.error("Error caching created channel:", createChannelLogAttributes);
|
|
1113
|
+
logger.error(error, createChannelLogAttributes);
|
|
1048
1114
|
// Don't fail the creation if caching fails
|
|
1049
1115
|
}
|
|
1050
1116
|
return channel;
|
|
1051
1117
|
}
|
|
1052
1118
|
static getHeaderBlock(data) {
|
|
1053
|
-
logger.debug("Getting header block with data:");
|
|
1054
|
-
logger.debug(data);
|
|
1119
|
+
logger.debug("Getting header block with data:", {});
|
|
1120
|
+
logger.debug(data, {});
|
|
1055
1121
|
const headerBlock = {
|
|
1056
1122
|
type: "header",
|
|
1057
1123
|
text: {
|
|
@@ -1059,13 +1125,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1059
1125
|
text: data.payloadHeaderBlock.text,
|
|
1060
1126
|
},
|
|
1061
1127
|
};
|
|
1062
|
-
logger.debug("Header block generated:");
|
|
1063
|
-
logger.debug(headerBlock);
|
|
1128
|
+
logger.debug("Header block generated:", {});
|
|
1129
|
+
logger.debug(headerBlock, {});
|
|
1064
1130
|
return headerBlock;
|
|
1065
1131
|
}
|
|
1066
1132
|
static getCheckboxBlock(data) {
|
|
1067
|
-
logger.debug("Getting checkbox block with data:");
|
|
1068
|
-
logger.debug(data);
|
|
1133
|
+
logger.debug("Getting checkbox block with data:", {});
|
|
1134
|
+
logger.debug(data, {});
|
|
1069
1135
|
const checkboxBlock = {
|
|
1070
1136
|
type: "input",
|
|
1071
1137
|
element: {
|
|
@@ -1104,13 +1170,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1104
1170
|
text: data.payloadCheckboxBlock.description,
|
|
1105
1171
|
};
|
|
1106
1172
|
}
|
|
1107
|
-
logger.debug("Checkbox block generated:");
|
|
1108
|
-
logger.debug(checkboxBlock);
|
|
1173
|
+
logger.debug("Checkbox block generated:", {});
|
|
1174
|
+
logger.debug(checkboxBlock, {});
|
|
1109
1175
|
return checkboxBlock;
|
|
1110
1176
|
}
|
|
1111
1177
|
static getDateTimePickerBlock(data) {
|
|
1112
|
-
logger.debug("Getting date time picker block with data:");
|
|
1113
|
-
logger.debug(data);
|
|
1178
|
+
logger.debug("Getting date time picker block with data:", {});
|
|
1179
|
+
logger.debug(data, {});
|
|
1114
1180
|
const dateTimePickerBlock = {
|
|
1115
1181
|
type: "input",
|
|
1116
1182
|
element: {
|
|
@@ -1123,13 +1189,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1123
1189
|
text: data.payloadDateTimePickerBlock.label,
|
|
1124
1190
|
},
|
|
1125
1191
|
};
|
|
1126
|
-
logger.debug("Date time picker block generated:");
|
|
1127
|
-
logger.debug(dateTimePickerBlock);
|
|
1192
|
+
logger.debug("Date time picker block generated:", {});
|
|
1193
|
+
logger.debug(dateTimePickerBlock, {});
|
|
1128
1194
|
return dateTimePickerBlock;
|
|
1129
1195
|
}
|
|
1130
1196
|
static getTextAreaBlock(data) {
|
|
1131
|
-
logger.debug("Getting text area block with data:");
|
|
1132
|
-
logger.debug(data);
|
|
1197
|
+
logger.debug("Getting text area block with data:", {});
|
|
1198
|
+
logger.debug(data, {});
|
|
1133
1199
|
const optional = data.payloadTextAreaBlock.optional || false;
|
|
1134
1200
|
const textAreaBlock = {
|
|
1135
1201
|
type: "input",
|
|
@@ -1156,13 +1222,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1156
1222
|
text: data.payloadTextAreaBlock.description,
|
|
1157
1223
|
};
|
|
1158
1224
|
}
|
|
1159
|
-
logger.debug("Text area block generated:");
|
|
1160
|
-
logger.debug(textAreaBlock);
|
|
1225
|
+
logger.debug("Text area block generated:", {});
|
|
1226
|
+
logger.debug(textAreaBlock, {});
|
|
1161
1227
|
return textAreaBlock;
|
|
1162
1228
|
}
|
|
1163
1229
|
static getTextBoxBlock(data) {
|
|
1164
|
-
logger.debug("Getting text box block with data:");
|
|
1165
|
-
logger.debug(data);
|
|
1230
|
+
logger.debug("Getting text box block with data:", {});
|
|
1231
|
+
logger.debug(data, {});
|
|
1166
1232
|
const optional = data.payloadTextBoxBlock.optional || false;
|
|
1167
1233
|
const textBoxBlock = {
|
|
1168
1234
|
type: "input",
|
|
@@ -1188,25 +1254,25 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1188
1254
|
text: data.payloadTextBoxBlock.description,
|
|
1189
1255
|
};
|
|
1190
1256
|
}
|
|
1191
|
-
logger.debug("Text box block generated:");
|
|
1192
|
-
logger.debug(textBoxBlock);
|
|
1257
|
+
logger.debug("Text box block generated:", {});
|
|
1258
|
+
logger.debug(textBoxBlock, {});
|
|
1193
1259
|
return textBoxBlock;
|
|
1194
1260
|
}
|
|
1195
1261
|
static getImageBlock(data) {
|
|
1196
|
-
logger.debug("Getting image block with data:");
|
|
1197
|
-
logger.debug(data);
|
|
1262
|
+
logger.debug("Getting image block with data:", {});
|
|
1263
|
+
logger.debug(data, {});
|
|
1198
1264
|
const imageBlock = {
|
|
1199
1265
|
type: "image",
|
|
1200
1266
|
image_url: data.payloadImageBlock.imageUrl.toString(),
|
|
1201
1267
|
alt_text: data.payloadImageBlock.altText,
|
|
1202
1268
|
};
|
|
1203
|
-
logger.debug("Image block generated:");
|
|
1204
|
-
logger.debug(imageBlock);
|
|
1269
|
+
logger.debug("Image block generated:", {});
|
|
1270
|
+
logger.debug(imageBlock, {});
|
|
1205
1271
|
return imageBlock;
|
|
1206
1272
|
}
|
|
1207
1273
|
static getDropdownBlock(data) {
|
|
1208
|
-
logger.debug("Getting dropdown block with data:");
|
|
1209
|
-
logger.debug(data);
|
|
1274
|
+
logger.debug("Getting dropdown block with data:", {});
|
|
1275
|
+
logger.debug(data, {});
|
|
1210
1276
|
const optional = data.payloadDropdownBlock.optional || false;
|
|
1211
1277
|
const isMiltiSelect = data.payloadDropdownBlock.multiSelect || false;
|
|
1212
1278
|
const dropdownBlock = {
|
|
@@ -1250,13 +1316,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1250
1316
|
text: data.payloadDropdownBlock.description,
|
|
1251
1317
|
};
|
|
1252
1318
|
}
|
|
1253
|
-
logger.debug("Dropdown block generated:");
|
|
1254
|
-
logger.debug(dropdownBlock);
|
|
1319
|
+
logger.debug("Dropdown block generated:", {});
|
|
1320
|
+
logger.debug(dropdownBlock, {});
|
|
1255
1321
|
return dropdownBlock;
|
|
1256
1322
|
}
|
|
1257
1323
|
static getModalBlock(data) {
|
|
1258
|
-
logger.debug("Getting modal block with data:");
|
|
1259
|
-
logger.debug(data);
|
|
1324
|
+
logger.debug("Getting modal block with data:", {});
|
|
1325
|
+
logger.debug(data, {});
|
|
1260
1326
|
const modalBlock = {
|
|
1261
1327
|
type: "modal",
|
|
1262
1328
|
title: {
|
|
@@ -1277,13 +1343,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1277
1343
|
messageBlocks: data.payloadModalBlock.blocks,
|
|
1278
1344
|
}),
|
|
1279
1345
|
};
|
|
1280
|
-
logger.debug("Modal block generated:");
|
|
1281
|
-
logger.debug(modalBlock);
|
|
1346
|
+
logger.debug("Modal block generated:", {});
|
|
1347
|
+
logger.debug(modalBlock, {});
|
|
1282
1348
|
return modalBlock;
|
|
1283
1349
|
}
|
|
1284
1350
|
static getMarkdownBlock(data) {
|
|
1285
|
-
logger.debug("Getting markdown block with data:");
|
|
1286
|
-
logger.debug(data);
|
|
1351
|
+
logger.debug("Getting markdown block with data:", {});
|
|
1352
|
+
logger.debug(data, {});
|
|
1287
1353
|
const markdownBlock = {
|
|
1288
1354
|
type: "section",
|
|
1289
1355
|
text: {
|
|
@@ -1293,8 +1359,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1293
1359
|
: "",
|
|
1294
1360
|
},
|
|
1295
1361
|
};
|
|
1296
|
-
logger.debug("Markdown block generated:");
|
|
1297
|
-
logger.debug(markdownBlock);
|
|
1362
|
+
logger.debug("Markdown block generated:", {});
|
|
1363
|
+
logger.debug(markdownBlock, {});
|
|
1298
1364
|
return markdownBlock;
|
|
1299
1365
|
}
|
|
1300
1366
|
static async isUserInDirectMessageChannel(data) {
|
|
@@ -1315,14 +1381,22 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1315
1381
|
},
|
|
1316
1382
|
});
|
|
1317
1383
|
if (response instanceof HTTPErrorResponse) {
|
|
1318
|
-
logger.error("Error response from Slack API:"
|
|
1319
|
-
|
|
1384
|
+
logger.error("Error response from Slack API:", {
|
|
1385
|
+
channelId: data.directMessageChannelId,
|
|
1386
|
+
});
|
|
1387
|
+
logger.error(response, {
|
|
1388
|
+
channelId: data.directMessageChannelId,
|
|
1389
|
+
});
|
|
1320
1390
|
throw response;
|
|
1321
1391
|
}
|
|
1322
1392
|
// check for ok response
|
|
1323
1393
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
1324
|
-
logger.error("Invalid response from Slack API:"
|
|
1325
|
-
|
|
1394
|
+
logger.error("Invalid response from Slack API:", {
|
|
1395
|
+
channelId: data.directMessageChannelId,
|
|
1396
|
+
});
|
|
1397
|
+
logger.error(response.jsonData, {
|
|
1398
|
+
channelId: data.directMessageChannelId,
|
|
1399
|
+
});
|
|
1326
1400
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
1327
1401
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
1328
1402
|
}
|
|
@@ -1336,8 +1410,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1336
1410
|
static async isUserInChannel(data) {
|
|
1337
1411
|
var _a, _b, _c;
|
|
1338
1412
|
const members = [];
|
|
1339
|
-
|
|
1340
|
-
|
|
1413
|
+
const isInChannelLogAttributes = {
|
|
1414
|
+
channelId: data.channelId,
|
|
1415
|
+
};
|
|
1416
|
+
logger.debug("Checking if user is in channel with data:", isInChannelLogAttributes);
|
|
1417
|
+
logger.debug(data, isInChannelLogAttributes);
|
|
1341
1418
|
let cursor = undefined;
|
|
1342
1419
|
do {
|
|
1343
1420
|
// check if the user is in the channel, return true if they are, false if they are not
|
|
@@ -1360,17 +1437,17 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1360
1437
|
exponentialBackoff: true,
|
|
1361
1438
|
},
|
|
1362
1439
|
});
|
|
1363
|
-
logger.debug("Response from Slack API for getting channel members:");
|
|
1364
|
-
logger.debug(response);
|
|
1440
|
+
logger.debug("Response from Slack API for getting channel members:", isInChannelLogAttributes);
|
|
1441
|
+
logger.debug(response, isInChannelLogAttributes);
|
|
1365
1442
|
if (response instanceof HTTPErrorResponse) {
|
|
1366
|
-
logger.error("Error response from Slack API:");
|
|
1367
|
-
logger.error(response);
|
|
1443
|
+
logger.error("Error response from Slack API:", isInChannelLogAttributes);
|
|
1444
|
+
logger.error(response, isInChannelLogAttributes);
|
|
1368
1445
|
throw response;
|
|
1369
1446
|
}
|
|
1370
1447
|
// check for ok response
|
|
1371
1448
|
if (((_a = response.jsonData) === null || _a === void 0 ? void 0 : _a["ok"]) !== true) {
|
|
1372
|
-
logger.error("Invalid response from Slack API:");
|
|
1373
|
-
logger.error(response.jsonData);
|
|
1449
|
+
logger.error("Invalid response from Slack API:", isInChannelLogAttributes);
|
|
1450
|
+
logger.error(response.jsonData, isInChannelLogAttributes);
|
|
1374
1451
|
const messageFromSlack = (_b = response.jsonData) === null || _b === void 0 ? void 0 : _b["error"];
|
|
1375
1452
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
1376
1453
|
}
|
|
@@ -1385,8 +1462,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1385
1462
|
return false;
|
|
1386
1463
|
}
|
|
1387
1464
|
static getButtonBlock(data) {
|
|
1388
|
-
logger.debug("Getting button block with data:");
|
|
1389
|
-
logger.debug(data);
|
|
1465
|
+
logger.debug("Getting button block with data:", {});
|
|
1466
|
+
logger.debug(data, {});
|
|
1390
1467
|
const buttonBlock = {
|
|
1391
1468
|
type: "button",
|
|
1392
1469
|
text: {
|
|
@@ -1400,13 +1477,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1400
1477
|
? data.payloadButtonBlock.url.toString()
|
|
1401
1478
|
: undefined,
|
|
1402
1479
|
};
|
|
1403
|
-
logger.debug("Button block generated:");
|
|
1404
|
-
logger.debug(buttonBlock);
|
|
1480
|
+
logger.debug("Button block generated:", {});
|
|
1481
|
+
logger.debug(buttonBlock, {});
|
|
1405
1482
|
return buttonBlock;
|
|
1406
1483
|
}
|
|
1407
1484
|
static async sendMessageToChannelViaIncomingWebhook(data) {
|
|
1408
|
-
logger.debug("Sending message to channel via incoming webhook with data:");
|
|
1409
|
-
logger.debug(data);
|
|
1485
|
+
logger.debug("Sending message to channel via incoming webhook with data:", {});
|
|
1486
|
+
logger.debug(data, {});
|
|
1410
1487
|
const apiResult = await API.post({
|
|
1411
1488
|
url: data.url,
|
|
1412
1489
|
data: {
|
|
@@ -1425,8 +1502,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1425
1502
|
exponentialBackoff: true,
|
|
1426
1503
|
},
|
|
1427
1504
|
});
|
|
1428
|
-
logger.debug("Response from Slack API for sending message via webhook:");
|
|
1429
|
-
logger.debug(apiResult);
|
|
1505
|
+
logger.debug("Response from Slack API for sending message via webhook:", {});
|
|
1506
|
+
logger.debug(apiResult, {});
|
|
1430
1507
|
return apiResult;
|
|
1431
1508
|
}
|
|
1432
1509
|
/**
|
|
@@ -1523,14 +1600,22 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1523
1600
|
},
|
|
1524
1601
|
});
|
|
1525
1602
|
if (response instanceof HTTPErrorResponse) {
|
|
1526
|
-
logger.error("Error response from Slack API for channel history:"
|
|
1527
|
-
|
|
1603
|
+
logger.error("Error response from Slack API for channel history:", {
|
|
1604
|
+
channelId: params.channelId,
|
|
1605
|
+
});
|
|
1606
|
+
logger.error(response, {
|
|
1607
|
+
channelId: params.channelId,
|
|
1608
|
+
});
|
|
1528
1609
|
break;
|
|
1529
1610
|
}
|
|
1530
1611
|
const jsonData = response.jsonData;
|
|
1531
1612
|
if (jsonData["ok"] !== true) {
|
|
1532
|
-
logger.error("Invalid response from Slack API for channel history:"
|
|
1533
|
-
|
|
1613
|
+
logger.error("Invalid response from Slack API for channel history:", {
|
|
1614
|
+
channelId: params.channelId,
|
|
1615
|
+
});
|
|
1616
|
+
logger.error(jsonData, {
|
|
1617
|
+
channelId: params.channelId,
|
|
1618
|
+
});
|
|
1534
1619
|
break;
|
|
1535
1620
|
}
|
|
1536
1621
|
const slackMessages = jsonData["messages"] || [];
|
|
@@ -1570,7 +1655,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1570
1655
|
cursor = (_a = jsonData["response_metadata"]) === null || _a === void 0 ? void 0 : _a["next_cursor"];
|
|
1571
1656
|
pageCount++;
|
|
1572
1657
|
} while (cursor && messages.length < maxMessages && pageCount < maxPages);
|
|
1573
|
-
logger.debug(`Retrieved ${messages.length} messages from Slack channel ${params.channelId}
|
|
1658
|
+
logger.debug(`Retrieved ${messages.length} messages from Slack channel ${params.channelId}`, { channelId: params.channelId });
|
|
1574
1659
|
// Reverse to get chronological order (Slack returns newest first)
|
|
1575
1660
|
messages.reverse();
|
|
1576
1661
|
return messages;
|