@oneuptime/common 10.0.52 → 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/TelemetryAPI.ts +81 -0
- 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/LabelService.ts +14 -1
- package/Server/Services/MonitorFeedService.ts +33 -9
- package/Server/Services/MonitorProbeService.ts +31 -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 +29 -11
- 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/TelemetryAttributeService.ts +117 -4
- 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/BulkUpdate/BulkUpdateForm.tsx +60 -38
- 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/Dictionary/Dictionary.tsx +13 -1
- package/UI/Components/Filters/FiltersForm.tsx +2 -0
- package/UI/Components/Filters/JSONFilter.tsx +5 -1
- package/UI/Components/Filters/Types/Filter.ts +2 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +3 -3
- package/UI/Components/ModelTable/BaseModelTable.tsx +10 -6
- 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/TelemetryAPI.js +39 -0
- package/build/dist/Server/API/TelemetryAPI.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/LabelService.js +10 -1
- package/build/dist/Server/Services/LabelService.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 +23 -3
- 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 +41 -21
- 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/TelemetryAttributeService.js +83 -6
- package/build/dist/Server/Services/TelemetryAttributeService.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/BulkUpdate/BulkUpdateForm.js +31 -30
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.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/Dictionary/Dictionary.js +9 -1
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/Filters/FiltersForm.js +1 -1
- package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
- package/build/dist/UI/Components/Filters/JSONFilter.js +1 -1
- package/build/dist/UI/Components/Filters/JSONFilter.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +3 -3
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +9 -5
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- 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
|
@@ -17,7 +17,7 @@ import WorkspaceMessagePayload, {
|
|
|
17
17
|
WorkspaceTextAreaBlock,
|
|
18
18
|
WorkspaceTextBoxBlock,
|
|
19
19
|
} from "../../../../Types/Workspace/WorkspaceMessagePayload";
|
|
20
|
-
import logger from "../../Logger";
|
|
20
|
+
import logger, { LogAttributes } from "../../Logger";
|
|
21
21
|
import Dictionary from "../../../../Types/Dictionary";
|
|
22
22
|
import BadRequestException from "../../../../Types/Exception/BadRequestException";
|
|
23
23
|
import WorkspaceBase, {
|
|
@@ -50,8 +50,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
50
50
|
userId: string;
|
|
51
51
|
projectId: ObjectID;
|
|
52
52
|
}): Promise<string | null> {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const usernameLogAttributes: LogAttributes = {
|
|
54
|
+
projectId: data.projectId?.toString(),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
logger.debug(
|
|
58
|
+
"Getting username from user ID with data:",
|
|
59
|
+
usernameLogAttributes,
|
|
60
|
+
);
|
|
61
|
+
logger.debug(data, usernameLogAttributes);
|
|
55
62
|
|
|
56
63
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
57
64
|
await API.post<JSONObject>({
|
|
@@ -69,27 +76,30 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
69
76
|
},
|
|
70
77
|
});
|
|
71
78
|
|
|
72
|
-
logger.debug(
|
|
73
|
-
|
|
79
|
+
logger.debug(
|
|
80
|
+
"Response from Slack API for getting user info:",
|
|
81
|
+
usernameLogAttributes,
|
|
82
|
+
);
|
|
83
|
+
logger.debug(response, usernameLogAttributes);
|
|
74
84
|
|
|
75
85
|
if (response instanceof HTTPErrorResponse) {
|
|
76
|
-
logger.error("Error response from Slack API:");
|
|
77
|
-
logger.error(response);
|
|
86
|
+
logger.error("Error response from Slack API:", usernameLogAttributes);
|
|
87
|
+
logger.error(response, usernameLogAttributes);
|
|
78
88
|
throw response;
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
// check for ok response
|
|
82
92
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
83
|
-
logger.error("Invalid response from Slack API:");
|
|
84
|
-
logger.error(response.jsonData);
|
|
93
|
+
logger.error("Invalid response from Slack API:", usernameLogAttributes);
|
|
94
|
+
logger.error(response.jsonData, usernameLogAttributes);
|
|
85
95
|
return null;
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
if (
|
|
89
99
|
!((response.jsonData as JSONObject)?.["user"] as JSONObject)?.["name"]
|
|
90
100
|
) {
|
|
91
|
-
logger.error("Invalid response from Slack API:");
|
|
92
|
-
logger.error(response.jsonData);
|
|
101
|
+
logger.error("Invalid response from Slack API:", usernameLogAttributes);
|
|
102
|
+
logger.error(response.jsonData, usernameLogAttributes);
|
|
93
103
|
return null;
|
|
94
104
|
}
|
|
95
105
|
|
|
@@ -97,8 +107,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
97
107
|
(response.jsonData as JSONObject)["user"] as JSONObject
|
|
98
108
|
)["name"] as string;
|
|
99
109
|
|
|
100
|
-
logger.debug("Username obtained:");
|
|
101
|
-
logger.debug(username);
|
|
110
|
+
logger.debug("Username obtained:", usernameLogAttributes);
|
|
111
|
+
logger.debug(username, usernameLogAttributes);
|
|
102
112
|
return username;
|
|
103
113
|
}
|
|
104
114
|
|
|
@@ -108,15 +118,17 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
108
118
|
triggerId: string;
|
|
109
119
|
modalBlock: WorkspaceModalBlock;
|
|
110
120
|
}): Promise<void> {
|
|
111
|
-
|
|
112
|
-
|
|
121
|
+
const modalLogAttributes: LogAttributes = { triggerId: data.triggerId };
|
|
122
|
+
|
|
123
|
+
logger.debug("Showing modal to user with data:", modalLogAttributes);
|
|
124
|
+
logger.debug(data, modalLogAttributes);
|
|
113
125
|
|
|
114
126
|
const modalJson: JSONObject = this.getModalBlock({
|
|
115
127
|
payloadModalBlock: data.modalBlock,
|
|
116
128
|
});
|
|
117
129
|
|
|
118
|
-
logger.debug("Modal JSON generated:");
|
|
119
|
-
logger.debug(JSON.stringify(modalJson, null, 2));
|
|
130
|
+
logger.debug("Modal JSON generated:", modalLogAttributes);
|
|
131
|
+
logger.debug(JSON.stringify(modalJson, null, 2), modalLogAttributes);
|
|
120
132
|
|
|
121
133
|
// use view.open API to show modal
|
|
122
134
|
const result: HTTPErrorResponse | HTTPResponse<JSONObject> = await API.post(
|
|
@@ -138,21 +150,21 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
138
150
|
);
|
|
139
151
|
|
|
140
152
|
if (result instanceof HTTPErrorResponse) {
|
|
141
|
-
logger.error("Error response from Slack API:");
|
|
142
|
-
logger.error(result);
|
|
153
|
+
logger.error("Error response from Slack API:", modalLogAttributes);
|
|
154
|
+
logger.error(result, modalLogAttributes);
|
|
143
155
|
throw result;
|
|
144
156
|
}
|
|
145
157
|
|
|
146
158
|
if ((result.jsonData as JSONObject)?.["ok"] !== true) {
|
|
147
|
-
logger.error("Invalid response from Slack API:");
|
|
148
|
-
logger.error(result.jsonData);
|
|
159
|
+
logger.error("Invalid response from Slack API:", modalLogAttributes);
|
|
160
|
+
logger.error(result.jsonData, modalLogAttributes);
|
|
149
161
|
const messageFromSlack: string = (result.jsonData as JSONObject)?.[
|
|
150
162
|
"error"
|
|
151
163
|
] as string;
|
|
152
164
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
153
165
|
}
|
|
154
166
|
|
|
155
|
-
logger.debug("Modal shown to user successfully.");
|
|
167
|
+
logger.debug("Modal shown to user successfully.", modalLogAttributes);
|
|
156
168
|
}
|
|
157
169
|
|
|
158
170
|
@CaptureSpan()
|
|
@@ -187,21 +199,29 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
187
199
|
});
|
|
188
200
|
|
|
189
201
|
if (response instanceof HTTPErrorResponse) {
|
|
190
|
-
logger.error("Error response from Slack API for ephemeral message:"
|
|
191
|
-
|
|
202
|
+
logger.error("Error response from Slack API for ephemeral message:", {
|
|
203
|
+
channelId: data.channelId,
|
|
204
|
+
} as LogAttributes);
|
|
205
|
+
logger.error(response, { channelId: data.channelId } as LogAttributes);
|
|
192
206
|
throw response;
|
|
193
207
|
}
|
|
194
208
|
|
|
195
209
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
196
|
-
logger.error("Invalid response from Slack API for ephemeral message:"
|
|
197
|
-
|
|
210
|
+
logger.error("Invalid response from Slack API for ephemeral message:", {
|
|
211
|
+
channelId: data.channelId,
|
|
212
|
+
} as LogAttributes);
|
|
213
|
+
logger.error(response.jsonData, {
|
|
214
|
+
channelId: data.channelId,
|
|
215
|
+
} as LogAttributes);
|
|
198
216
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
199
217
|
"error"
|
|
200
218
|
] as string;
|
|
201
219
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
202
220
|
}
|
|
203
221
|
|
|
204
|
-
logger.debug("Ephemeral message sent successfully."
|
|
222
|
+
logger.debug("Ephemeral message sent successfully.", {
|
|
223
|
+
channelId: data.channelId,
|
|
224
|
+
} as LogAttributes);
|
|
205
225
|
}
|
|
206
226
|
|
|
207
227
|
@CaptureSpan()
|
|
@@ -252,8 +272,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
252
272
|
});
|
|
253
273
|
}
|
|
254
274
|
|
|
255
|
-
|
|
256
|
-
|
|
275
|
+
const archiveLogAttributes: LogAttributes = {
|
|
276
|
+
projectId: data.projectId?.toString(),
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
logger.debug("Archiving channels with data:", archiveLogAttributes);
|
|
280
|
+
logger.debug(data, archiveLogAttributes);
|
|
257
281
|
|
|
258
282
|
for (const channelId of data.channelIds) {
|
|
259
283
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
@@ -272,18 +296,21 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
272
296
|
},
|
|
273
297
|
});
|
|
274
298
|
|
|
275
|
-
logger.debug(
|
|
276
|
-
|
|
299
|
+
logger.debug(
|
|
300
|
+
"Response from Slack API for archiving channel:",
|
|
301
|
+
archiveLogAttributes,
|
|
302
|
+
);
|
|
303
|
+
logger.debug(response, archiveLogAttributes);
|
|
277
304
|
|
|
278
305
|
if (response instanceof HTTPErrorResponse) {
|
|
279
|
-
logger.error("Error response from Slack API:");
|
|
280
|
-
logger.error(response);
|
|
306
|
+
logger.error("Error response from Slack API:", archiveLogAttributes);
|
|
307
|
+
logger.error(response, archiveLogAttributes);
|
|
281
308
|
throw response;
|
|
282
309
|
}
|
|
283
310
|
|
|
284
311
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
285
|
-
logger.error("Invalid response from Slack API:");
|
|
286
|
-
logger.error(response.jsonData);
|
|
312
|
+
logger.error("Invalid response from Slack API:", archiveLogAttributes);
|
|
313
|
+
logger.error(response.jsonData, archiveLogAttributes);
|
|
287
314
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
288
315
|
"error"
|
|
289
316
|
] as string;
|
|
@@ -291,7 +318,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
291
318
|
}
|
|
292
319
|
}
|
|
293
320
|
|
|
294
|
-
logger.debug("Channels archived successfully.");
|
|
321
|
+
logger.debug("Channels archived successfully.", archiveLogAttributes);
|
|
295
322
|
}
|
|
296
323
|
|
|
297
324
|
@CaptureSpan()
|
|
@@ -299,8 +326,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
299
326
|
authToken: string;
|
|
300
327
|
channelId: string;
|
|
301
328
|
}): Promise<void> {
|
|
302
|
-
|
|
303
|
-
|
|
329
|
+
const joinLogAttributes: LogAttributes = { channelId: data.channelId };
|
|
330
|
+
|
|
331
|
+
logger.debug("Joining channel with data:", joinLogAttributes);
|
|
332
|
+
logger.debug(data, joinLogAttributes);
|
|
304
333
|
|
|
305
334
|
// Join channel
|
|
306
335
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
@@ -319,26 +348,29 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
319
348
|
},
|
|
320
349
|
});
|
|
321
350
|
|
|
322
|
-
logger.debug(
|
|
323
|
-
|
|
351
|
+
logger.debug(
|
|
352
|
+
"Response from Slack API for joining channel:",
|
|
353
|
+
joinLogAttributes,
|
|
354
|
+
);
|
|
355
|
+
logger.debug(response, joinLogAttributes);
|
|
324
356
|
|
|
325
357
|
if (response instanceof HTTPErrorResponse) {
|
|
326
|
-
logger.error("Error response from Slack API:");
|
|
327
|
-
logger.error(response);
|
|
358
|
+
logger.error("Error response from Slack API:", joinLogAttributes);
|
|
359
|
+
logger.error(response, joinLogAttributes);
|
|
328
360
|
throw response;
|
|
329
361
|
}
|
|
330
362
|
|
|
331
363
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
332
|
-
logger.error("Invalid response from Slack API:");
|
|
333
|
-
logger.error(response.jsonData);
|
|
364
|
+
logger.error("Invalid response from Slack API:", joinLogAttributes);
|
|
365
|
+
logger.error(response.jsonData, joinLogAttributes);
|
|
334
366
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
335
367
|
"error"
|
|
336
368
|
] as string;
|
|
337
369
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
338
370
|
}
|
|
339
371
|
|
|
340
|
-
logger.debug("Channel joined successfully with data:");
|
|
341
|
-
logger.debug(data);
|
|
372
|
+
logger.debug("Channel joined successfully with data:", joinLogAttributes);
|
|
373
|
+
logger.debug(data, joinLogAttributes);
|
|
342
374
|
}
|
|
343
375
|
|
|
344
376
|
@CaptureSpan()
|
|
@@ -355,12 +387,21 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
355
387
|
});
|
|
356
388
|
|
|
357
389
|
if (isUserInChannel) {
|
|
358
|
-
logger.debug("User already in channel."
|
|
390
|
+
logger.debug("User already in channel.", {
|
|
391
|
+
channelId: data.channelId,
|
|
392
|
+
} as LogAttributes);
|
|
359
393
|
return;
|
|
360
394
|
}
|
|
361
395
|
|
|
362
|
-
|
|
363
|
-
|
|
396
|
+
const inviteByIdLogAttributes: LogAttributes = {
|
|
397
|
+
channelId: data.channelId,
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
logger.debug(
|
|
401
|
+
"Inviting user to channel with data:",
|
|
402
|
+
inviteByIdLogAttributes,
|
|
403
|
+
);
|
|
404
|
+
logger.debug(data, inviteByIdLogAttributes);
|
|
364
405
|
|
|
365
406
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
366
407
|
await API.post({
|
|
@@ -379,25 +420,31 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
379
420
|
},
|
|
380
421
|
});
|
|
381
422
|
|
|
382
|
-
logger.debug(
|
|
383
|
-
|
|
423
|
+
logger.debug(
|
|
424
|
+
"Response from Slack API for inviting user:",
|
|
425
|
+
inviteByIdLogAttributes,
|
|
426
|
+
);
|
|
427
|
+
logger.debug(response, inviteByIdLogAttributes);
|
|
384
428
|
|
|
385
429
|
if (response instanceof HTTPErrorResponse) {
|
|
386
|
-
logger.error("Error response from Slack API:");
|
|
387
|
-
logger.error(response);
|
|
430
|
+
logger.error("Error response from Slack API:", inviteByIdLogAttributes);
|
|
431
|
+
logger.error(response, inviteByIdLogAttributes);
|
|
388
432
|
throw response;
|
|
389
433
|
}
|
|
390
434
|
|
|
391
435
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
392
|
-
logger.error("Invalid response from Slack API:");
|
|
393
|
-
logger.error(response.jsonData);
|
|
436
|
+
logger.error("Invalid response from Slack API:", inviteByIdLogAttributes);
|
|
437
|
+
logger.error(response.jsonData, inviteByIdLogAttributes);
|
|
394
438
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
395
439
|
"error"
|
|
396
440
|
] as string;
|
|
397
441
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
398
442
|
}
|
|
399
443
|
|
|
400
|
-
logger.debug(
|
|
444
|
+
logger.debug(
|
|
445
|
+
"User invited to channel successfully.",
|
|
446
|
+
inviteByIdLogAttributes,
|
|
447
|
+
);
|
|
401
448
|
}
|
|
402
449
|
|
|
403
450
|
@CaptureSpan()
|
|
@@ -412,8 +459,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
412
459
|
data.channelName = data.channelName.substring(1);
|
|
413
460
|
}
|
|
414
461
|
|
|
415
|
-
logger.debug("Inviting user to channel with data:"
|
|
416
|
-
|
|
462
|
+
logger.debug("Inviting user to channel with data:", {
|
|
463
|
+
projectId: data.projectId?.toString(),
|
|
464
|
+
} as LogAttributes);
|
|
465
|
+
logger.debug(data, {
|
|
466
|
+
projectId: data.projectId?.toString(),
|
|
467
|
+
} as LogAttributes);
|
|
417
468
|
|
|
418
469
|
const channelId: string = (
|
|
419
470
|
await this.getWorkspaceChannelFromChannelName({
|
|
@@ -436,8 +487,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
436
487
|
channelNames: Array<string>;
|
|
437
488
|
projectId: ObjectID;
|
|
438
489
|
}): Promise<Array<WorkspaceChannel>> {
|
|
439
|
-
|
|
440
|
-
|
|
490
|
+
const createChLogAttributes: LogAttributes = {
|
|
491
|
+
projectId: data.projectId?.toString(),
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
logger.debug(
|
|
495
|
+
"Creating channels if they do not exist with data:",
|
|
496
|
+
createChLogAttributes,
|
|
497
|
+
);
|
|
498
|
+
logger.debug(data, createChLogAttributes);
|
|
441
499
|
|
|
442
500
|
const workspaceChannels: Array<WorkspaceChannel> = [];
|
|
443
501
|
|
|
@@ -460,12 +518,18 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
460
518
|
});
|
|
461
519
|
|
|
462
520
|
if (existingChannel) {
|
|
463
|
-
logger.debug(
|
|
521
|
+
logger.debug(
|
|
522
|
+
`Channel ${channelName} already exists.`,
|
|
523
|
+
createChLogAttributes,
|
|
524
|
+
);
|
|
464
525
|
workspaceChannels.push(existingChannel);
|
|
465
526
|
continue;
|
|
466
527
|
}
|
|
467
528
|
|
|
468
|
-
logger.debug(
|
|
529
|
+
logger.debug(
|
|
530
|
+
`Channel ${channelName} does not exist. Creating channel.`,
|
|
531
|
+
createChLogAttributes,
|
|
532
|
+
);
|
|
469
533
|
const channel: WorkspaceChannel = await this.createChannel({
|
|
470
534
|
authToken: data.authToken,
|
|
471
535
|
channelName: channelName,
|
|
@@ -473,13 +537,16 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
473
537
|
});
|
|
474
538
|
|
|
475
539
|
if (channel) {
|
|
476
|
-
logger.debug(
|
|
540
|
+
logger.debug(
|
|
541
|
+
`Channel ${channelName} created successfully.`,
|
|
542
|
+
createChLogAttributes,
|
|
543
|
+
);
|
|
477
544
|
workspaceChannels.push(channel);
|
|
478
545
|
}
|
|
479
546
|
}
|
|
480
547
|
|
|
481
|
-
logger.debug("Channels created or found:");
|
|
482
|
-
logger.debug(workspaceChannels);
|
|
548
|
+
logger.debug("Channels created or found:", createChLogAttributes);
|
|
549
|
+
logger.debug(workspaceChannels, createChLogAttributes);
|
|
483
550
|
return workspaceChannels;
|
|
484
551
|
}
|
|
485
552
|
|
|
@@ -489,8 +556,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
489
556
|
channelName: string;
|
|
490
557
|
projectId: ObjectID;
|
|
491
558
|
}): Promise<WorkspaceChannel> {
|
|
492
|
-
|
|
493
|
-
|
|
559
|
+
const getChNameLogAttributes: LogAttributes = {
|
|
560
|
+
projectId: data.projectId?.toString(),
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
logger.debug(
|
|
564
|
+
"Getting workspace channel ID from channel name with data:",
|
|
565
|
+
getChNameLogAttributes,
|
|
566
|
+
);
|
|
567
|
+
logger.debug(data, getChNameLogAttributes);
|
|
494
568
|
|
|
495
569
|
const channel: WorkspaceChannel | null =
|
|
496
570
|
await this.getWorkspaceChannelByName({
|
|
@@ -500,12 +574,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
500
574
|
});
|
|
501
575
|
|
|
502
576
|
if (!channel) {
|
|
503
|
-
logger.error("Channel not found.");
|
|
577
|
+
logger.error("Channel not found.", getChNameLogAttributes);
|
|
504
578
|
throw new BadDataException("Channel not found.");
|
|
505
579
|
}
|
|
506
580
|
|
|
507
|
-
logger.debug("Workspace channel obtained:");
|
|
508
|
-
logger.debug(channel);
|
|
581
|
+
logger.debug("Workspace channel obtained:", getChNameLogAttributes);
|
|
582
|
+
logger.debug(channel, getChNameLogAttributes);
|
|
509
583
|
|
|
510
584
|
return channel;
|
|
511
585
|
}
|
|
@@ -515,8 +589,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
515
589
|
authToken: string;
|
|
516
590
|
channelId: string;
|
|
517
591
|
}): Promise<WorkspaceChannel> {
|
|
518
|
-
|
|
519
|
-
|
|
592
|
+
const getChIdLogAttributes: LogAttributes = { channelId: data.channelId };
|
|
593
|
+
|
|
594
|
+
logger.debug(
|
|
595
|
+
"Getting workspace channel from channel ID with data:",
|
|
596
|
+
getChIdLogAttributes,
|
|
597
|
+
);
|
|
598
|
+
logger.debug(data, getChIdLogAttributes);
|
|
520
599
|
|
|
521
600
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
522
601
|
await API.post<JSONObject>({
|
|
@@ -534,19 +613,22 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
534
613
|
},
|
|
535
614
|
});
|
|
536
615
|
|
|
537
|
-
logger.debug(
|
|
538
|
-
|
|
616
|
+
logger.debug(
|
|
617
|
+
"Response from Slack API for getting channel info:",
|
|
618
|
+
getChIdLogAttributes,
|
|
619
|
+
);
|
|
620
|
+
logger.debug(response, getChIdLogAttributes);
|
|
539
621
|
|
|
540
622
|
if (response instanceof HTTPErrorResponse) {
|
|
541
|
-
logger.error("Error response from Slack API:");
|
|
542
|
-
logger.error(response);
|
|
623
|
+
logger.error("Error response from Slack API:", getChIdLogAttributes);
|
|
624
|
+
logger.error(response, getChIdLogAttributes);
|
|
543
625
|
throw response;
|
|
544
626
|
}
|
|
545
627
|
|
|
546
628
|
// check for ok response
|
|
547
629
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
548
|
-
logger.error("Invalid response from Slack API:");
|
|
549
|
-
logger.error(response.jsonData);
|
|
630
|
+
logger.error("Invalid response from Slack API:", getChIdLogAttributes);
|
|
631
|
+
logger.error(response.jsonData, getChIdLogAttributes);
|
|
550
632
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
551
633
|
"error"
|
|
552
634
|
] as string;
|
|
@@ -556,8 +638,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
556
638
|
if (
|
|
557
639
|
!((response.jsonData as JSONObject)?.["channel"] as JSONObject)?.["name"]
|
|
558
640
|
) {
|
|
559
|
-
logger.error("Invalid response from Slack API:");
|
|
560
|
-
logger.error(response.jsonData);
|
|
641
|
+
logger.error("Invalid response from Slack API:", getChIdLogAttributes);
|
|
642
|
+
logger.error(response.jsonData, getChIdLogAttributes);
|
|
561
643
|
throw new Error("Invalid response");
|
|
562
644
|
}
|
|
563
645
|
|
|
@@ -569,8 +651,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
569
651
|
workspaceType: WorkspaceType.Slack,
|
|
570
652
|
};
|
|
571
653
|
|
|
572
|
-
logger.debug("Workspace channel obtained:");
|
|
573
|
-
logger.debug(channel);
|
|
654
|
+
logger.debug("Workspace channel obtained:", getChIdLogAttributes);
|
|
655
|
+
logger.debug(channel, getChIdLogAttributes);
|
|
574
656
|
return channel;
|
|
575
657
|
}
|
|
576
658
|
|
|
@@ -579,8 +661,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
579
661
|
authToken: string;
|
|
580
662
|
projectId: ObjectID;
|
|
581
663
|
}): Promise<Dictionary<WorkspaceChannel>> {
|
|
582
|
-
|
|
583
|
-
|
|
664
|
+
const getAllChLogAttributes: LogAttributes = {
|
|
665
|
+
projectId: data.projectId?.toString(),
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
logger.debug(
|
|
669
|
+
"Getting all workspace channels with data:",
|
|
670
|
+
getAllChLogAttributes,
|
|
671
|
+
);
|
|
672
|
+
logger.debug(data, getAllChLogAttributes);
|
|
584
673
|
|
|
585
674
|
const channels: Dictionary<WorkspaceChannel> = {};
|
|
586
675
|
let cursor: string | undefined = undefined;
|
|
@@ -614,15 +703,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
614
703
|
});
|
|
615
704
|
|
|
616
705
|
if (response instanceof HTTPErrorResponse) {
|
|
617
|
-
logger.error("Error response from Slack API:");
|
|
618
|
-
logger.error(response);
|
|
706
|
+
logger.error("Error response from Slack API:", getAllChLogAttributes);
|
|
707
|
+
logger.error(response, getAllChLogAttributes);
|
|
619
708
|
throw response;
|
|
620
709
|
}
|
|
621
710
|
|
|
622
711
|
// check for ok response
|
|
623
712
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
624
|
-
logger.error("Invalid response from Slack API:");
|
|
625
|
-
logger.error(response.jsonData);
|
|
713
|
+
logger.error("Invalid response from Slack API:", getAllChLogAttributes);
|
|
714
|
+
logger.error(response.jsonData, getAllChLogAttributes);
|
|
626
715
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
627
716
|
"error"
|
|
628
717
|
] as string;
|
|
@@ -667,12 +756,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
667
756
|
channelCache: localChannelCache,
|
|
668
757
|
});
|
|
669
758
|
} catch (error) {
|
|
670
|
-
logger.error("Error bulk updating channel cache:");
|
|
671
|
-
logger.error(error);
|
|
759
|
+
logger.error("Error bulk updating channel cache:", getAllChLogAttributes);
|
|
760
|
+
logger.error(error, getAllChLogAttributes);
|
|
672
761
|
// Don't fail the request if caching fails
|
|
673
762
|
}
|
|
674
763
|
|
|
675
|
-
logger.debug("All workspace channels obtained:");
|
|
764
|
+
logger.debug("All workspace channels obtained:", getAllChLogAttributes);
|
|
676
765
|
return channels;
|
|
677
766
|
}
|
|
678
767
|
|
|
@@ -687,7 +776,9 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
687
776
|
});
|
|
688
777
|
|
|
689
778
|
if (!projectAuth) {
|
|
690
|
-
logger.debug("No project auth found, cannot update cache"
|
|
779
|
+
logger.debug("No project auth found, cannot update cache", {
|
|
780
|
+
projectId: data.projectId?.toString(),
|
|
781
|
+
} as LogAttributes);
|
|
691
782
|
return;
|
|
692
783
|
}
|
|
693
784
|
|
|
@@ -709,7 +800,9 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
709
800
|
miscData: miscData,
|
|
710
801
|
});
|
|
711
802
|
|
|
712
|
-
logger.debug("Channel cache updated successfully"
|
|
803
|
+
logger.debug("Channel cache updated successfully", {
|
|
804
|
+
projectId: data.projectId?.toString(),
|
|
805
|
+
} as LogAttributes);
|
|
713
806
|
}
|
|
714
807
|
|
|
715
808
|
@CaptureSpan()
|
|
@@ -717,8 +810,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
717
810
|
projectId: ObjectID;
|
|
718
811
|
channelName: string;
|
|
719
812
|
}): Promise<WorkspaceChannel | null> {
|
|
720
|
-
|
|
721
|
-
|
|
813
|
+
const cacheGetLogAttributes: LogAttributes = {
|
|
814
|
+
projectId: data.projectId?.toString(),
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
logger.debug(
|
|
818
|
+
"Getting channel from cache with data:",
|
|
819
|
+
cacheGetLogAttributes,
|
|
820
|
+
);
|
|
821
|
+
logger.debug(data, cacheGetLogAttributes);
|
|
722
822
|
|
|
723
823
|
const projectAuth: any =
|
|
724
824
|
await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
@@ -727,7 +827,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
727
827
|
});
|
|
728
828
|
|
|
729
829
|
if (!projectAuth || !projectAuth.miscData) {
|
|
730
|
-
logger.debug(
|
|
830
|
+
logger.debug(
|
|
831
|
+
"No project auth found or no misc data",
|
|
832
|
+
cacheGetLogAttributes,
|
|
833
|
+
);
|
|
731
834
|
return null;
|
|
732
835
|
}
|
|
733
836
|
|
|
@@ -735,7 +838,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
735
838
|
const channelCache: any = miscData.channelCache;
|
|
736
839
|
|
|
737
840
|
if (!channelCache || !channelCache[data.channelName]) {
|
|
738
|
-
logger.debug("Channel not found in cache");
|
|
841
|
+
logger.debug("Channel not found in cache", cacheGetLogAttributes);
|
|
739
842
|
return null;
|
|
740
843
|
}
|
|
741
844
|
|
|
@@ -748,8 +851,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
748
851
|
workspaceType: WorkspaceType.Slack,
|
|
749
852
|
};
|
|
750
853
|
|
|
751
|
-
logger.debug("Channel found in cache:");
|
|
752
|
-
logger.debug(channel);
|
|
854
|
+
logger.debug("Channel found in cache:", cacheGetLogAttributes);
|
|
855
|
+
logger.debug(channel, cacheGetLogAttributes);
|
|
753
856
|
return channel;
|
|
754
857
|
}
|
|
755
858
|
@CaptureSpan()
|
|
@@ -758,8 +861,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
758
861
|
channelName: string;
|
|
759
862
|
channel: WorkspaceChannel;
|
|
760
863
|
}): Promise<void> {
|
|
761
|
-
|
|
762
|
-
|
|
864
|
+
const cacheUpdateLogAttributes: LogAttributes = {
|
|
865
|
+
projectId: data.projectId?.toString(),
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
logger.debug("Updating channel cache with data:", cacheUpdateLogAttributes);
|
|
869
|
+
logger.debug(data, cacheUpdateLogAttributes);
|
|
763
870
|
|
|
764
871
|
const projectAuth: any =
|
|
765
872
|
await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
@@ -768,7 +875,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
768
875
|
});
|
|
769
876
|
|
|
770
877
|
if (!projectAuth) {
|
|
771
|
-
logger.debug(
|
|
878
|
+
logger.debug(
|
|
879
|
+
"No project auth found, cannot update cache",
|
|
880
|
+
cacheUpdateLogAttributes,
|
|
881
|
+
);
|
|
772
882
|
return;
|
|
773
883
|
}
|
|
774
884
|
|
|
@@ -794,7 +904,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
794
904
|
miscData: miscData,
|
|
795
905
|
});
|
|
796
906
|
|
|
797
|
-
logger.debug(
|
|
907
|
+
logger.debug(
|
|
908
|
+
"Channel cache updated successfully",
|
|
909
|
+
cacheUpdateLogAttributes,
|
|
910
|
+
);
|
|
798
911
|
}
|
|
799
912
|
|
|
800
913
|
@CaptureSpan()
|
|
@@ -803,8 +916,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
803
916
|
channelName: string;
|
|
804
917
|
projectId: ObjectID;
|
|
805
918
|
}): Promise<WorkspaceChannel | null> {
|
|
806
|
-
|
|
807
|
-
|
|
919
|
+
const getByNameLogAttributes: LogAttributes = {
|
|
920
|
+
projectId: data.projectId?.toString(),
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
logger.debug(
|
|
924
|
+
"Getting workspace channel by name with data:",
|
|
925
|
+
getByNameLogAttributes,
|
|
926
|
+
);
|
|
927
|
+
logger.debug(data, getByNameLogAttributes);
|
|
808
928
|
|
|
809
929
|
// Normalize channel name
|
|
810
930
|
let normalizedChannelName: string = data.channelName;
|
|
@@ -821,13 +941,16 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
821
941
|
channelName: normalizedChannelName,
|
|
822
942
|
});
|
|
823
943
|
if (cachedChannel) {
|
|
824
|
-
logger.debug("Channel found in cache:");
|
|
825
|
-
logger.debug(cachedChannel);
|
|
944
|
+
logger.debug("Channel found in cache:", getByNameLogAttributes);
|
|
945
|
+
logger.debug(cachedChannel, getByNameLogAttributes);
|
|
826
946
|
return cachedChannel;
|
|
827
947
|
}
|
|
828
948
|
} catch (error) {
|
|
829
|
-
logger.error(
|
|
830
|
-
|
|
949
|
+
logger.error(
|
|
950
|
+
"Error getting channel from cache, falling back to API:",
|
|
951
|
+
getByNameLogAttributes,
|
|
952
|
+
);
|
|
953
|
+
logger.error(error, getByNameLogAttributes);
|
|
831
954
|
}
|
|
832
955
|
|
|
833
956
|
let cursor: string | undefined = undefined;
|
|
@@ -861,25 +984,35 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
861
984
|
});
|
|
862
985
|
|
|
863
986
|
if (response instanceof HTTPErrorResponse) {
|
|
864
|
-
logger.error("Error response from Slack API:");
|
|
865
|
-
logger.error(response);
|
|
987
|
+
logger.error("Error response from Slack API:", getByNameLogAttributes);
|
|
988
|
+
logger.error(response, getByNameLogAttributes);
|
|
866
989
|
throw response;
|
|
867
990
|
}
|
|
868
991
|
|
|
869
992
|
// check for ok response
|
|
870
993
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
871
|
-
logger.error(
|
|
872
|
-
|
|
994
|
+
logger.error(
|
|
995
|
+
"Invalid response from Slack API:",
|
|
996
|
+
getByNameLogAttributes,
|
|
997
|
+
);
|
|
998
|
+
logger.error(response.jsonData, getByNameLogAttributes);
|
|
873
999
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
874
1000
|
"error"
|
|
875
1001
|
] as string;
|
|
876
1002
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
877
1003
|
}
|
|
878
1004
|
|
|
879
|
-
logger.debug(
|
|
880
|
-
|
|
1005
|
+
logger.debug(
|
|
1006
|
+
"Searching for " + normalizedChannelName,
|
|
1007
|
+
getByNameLogAttributes,
|
|
1008
|
+
);
|
|
1009
|
+
logger.debug(
|
|
1010
|
+
"Searching channels in current page...",
|
|
1011
|
+
getByNameLogAttributes,
|
|
1012
|
+
);
|
|
881
1013
|
logger.debug(
|
|
882
1014
|
JSON.stringify((response.jsonData as JSONObject)["channels"], null, 2),
|
|
1015
|
+
getByNameLogAttributes,
|
|
883
1016
|
);
|
|
884
1017
|
|
|
885
1018
|
for (const channel of (response.jsonData as JSONObject)[
|
|
@@ -906,8 +1039,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
906
1039
|
|
|
907
1040
|
const channelName: string = (channel["name"] as string).toLowerCase();
|
|
908
1041
|
if (channelName === normalizedChannelName) {
|
|
909
|
-
logger.debug("Channel found:");
|
|
910
|
-
logger.debug(channel);
|
|
1042
|
+
logger.debug("Channel found:", getByNameLogAttributes);
|
|
1043
|
+
logger.debug(channel, getByNameLogAttributes);
|
|
911
1044
|
|
|
912
1045
|
// Update cache before returning
|
|
913
1046
|
try {
|
|
@@ -916,8 +1049,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
916
1049
|
channelCache: localChannelCache,
|
|
917
1050
|
});
|
|
918
1051
|
} catch (error) {
|
|
919
|
-
logger.error(
|
|
920
|
-
|
|
1052
|
+
logger.error(
|
|
1053
|
+
"Error bulk updating channel cache:",
|
|
1054
|
+
getByNameLogAttributes,
|
|
1055
|
+
);
|
|
1056
|
+
logger.error(error, getByNameLogAttributes);
|
|
921
1057
|
// Don't fail the request if caching fails
|
|
922
1058
|
}
|
|
923
1059
|
|
|
@@ -938,12 +1074,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
938
1074
|
channelCache: localChannelCache,
|
|
939
1075
|
});
|
|
940
1076
|
} catch (error) {
|
|
941
|
-
logger.error(
|
|
942
|
-
|
|
1077
|
+
logger.error(
|
|
1078
|
+
"Error bulk updating channel cache:",
|
|
1079
|
+
getByNameLogAttributes,
|
|
1080
|
+
);
|
|
1081
|
+
logger.error(error, getByNameLogAttributes);
|
|
943
1082
|
// Don't fail the request if caching fails
|
|
944
1083
|
}
|
|
945
1084
|
|
|
946
|
-
logger.debug("Channel not found:");
|
|
1085
|
+
logger.debug("Channel not found:", getByNameLogAttributes);
|
|
947
1086
|
return null;
|
|
948
1087
|
}
|
|
949
1088
|
|
|
@@ -958,8 +1097,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
958
1097
|
public static getValuesFromView(data: {
|
|
959
1098
|
view: JSONObject;
|
|
960
1099
|
}): Dictionary<string | number | Array<string | number> | Date> {
|
|
961
|
-
logger.debug("Getting values from view with data:");
|
|
962
|
-
logger.debug(JSON.stringify(data, null, 2));
|
|
1100
|
+
logger.debug("Getting values from view with data:", {} as LogAttributes);
|
|
1101
|
+
logger.debug(JSON.stringify(data, null, 2), {} as LogAttributes);
|
|
963
1102
|
|
|
964
1103
|
const slackView: JSONObject = data.view;
|
|
965
1104
|
const values: Dictionary<string | number | Array<string | number> | Date> =
|
|
@@ -1004,8 +1143,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1004
1143
|
}
|
|
1005
1144
|
}
|
|
1006
1145
|
|
|
1007
|
-
logger.debug("Values obtained from view:");
|
|
1008
|
-
logger.debug(values);
|
|
1146
|
+
logger.debug("Values obtained from view:", {} as LogAttributes);
|
|
1147
|
+
logger.debug(values, {} as LogAttributes);
|
|
1009
1148
|
|
|
1010
1149
|
return values;
|
|
1011
1150
|
}
|
|
@@ -1042,15 +1181,22 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1042
1181
|
userId: string;
|
|
1043
1182
|
projectId: ObjectID;
|
|
1044
1183
|
}): Promise<WorkspaceSendMessageResponse> {
|
|
1045
|
-
|
|
1046
|
-
|
|
1184
|
+
const sendMsgLogAttributes: LogAttributes = {
|
|
1185
|
+
projectId: data.projectId?.toString(),
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
logger.debug("Sending message to Slack with data:", sendMsgLogAttributes);
|
|
1189
|
+
logger.debug(data, sendMsgLogAttributes);
|
|
1047
1190
|
|
|
1048
1191
|
const blocks: Array<JSONObject> = this.getBlocksFromWorkspaceMessagePayload(
|
|
1049
1192
|
data.workspaceMessagePayload,
|
|
1050
1193
|
);
|
|
1051
1194
|
|
|
1052
|
-
logger.debug(
|
|
1053
|
-
|
|
1195
|
+
logger.debug(
|
|
1196
|
+
"Blocks generated from workspace message payload:",
|
|
1197
|
+
sendMsgLogAttributes,
|
|
1198
|
+
);
|
|
1199
|
+
logger.debug(blocks, sendMsgLogAttributes);
|
|
1054
1200
|
|
|
1055
1201
|
const workspaceChannelsToPostTo: Array<WorkspaceChannel> = [];
|
|
1056
1202
|
|
|
@@ -1071,7 +1217,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1071
1217
|
if (channel) {
|
|
1072
1218
|
workspaceChannelsToPostTo.push(channel);
|
|
1073
1219
|
} else {
|
|
1074
|
-
logger.debug(
|
|
1220
|
+
logger.debug(
|
|
1221
|
+
`Channel ${channelName} does not exist.`,
|
|
1222
|
+
sendMsgLogAttributes,
|
|
1223
|
+
);
|
|
1075
1224
|
}
|
|
1076
1225
|
}
|
|
1077
1226
|
|
|
@@ -1087,8 +1236,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1087
1236
|
|
|
1088
1237
|
workspaceChannelsToPostTo.push(channel);
|
|
1089
1238
|
} catch (err) {
|
|
1090
|
-
logger.error(
|
|
1091
|
-
|
|
1239
|
+
logger.error(
|
|
1240
|
+
`Error getting channel info for channel ID ${channelId}:`,
|
|
1241
|
+
sendMsgLogAttributes,
|
|
1242
|
+
);
|
|
1243
|
+
logger.error(err, sendMsgLogAttributes);
|
|
1092
1244
|
|
|
1093
1245
|
// Fallback: create channel object with empty name if API call fails
|
|
1094
1246
|
const channel: WorkspaceChannel = {
|
|
@@ -1101,8 +1253,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1101
1253
|
}
|
|
1102
1254
|
}
|
|
1103
1255
|
|
|
1104
|
-
logger.debug("Channel IDs to post to:");
|
|
1105
|
-
logger.debug(workspaceChannelsToPostTo);
|
|
1256
|
+
logger.debug("Channel IDs to post to:", sendMsgLogAttributes);
|
|
1257
|
+
logger.debug(workspaceChannelsToPostTo, sendMsgLogAttributes);
|
|
1106
1258
|
|
|
1107
1259
|
const workspaspaceMessageResponse: WorkspaceSendMessageResponse = {
|
|
1108
1260
|
threads: [],
|
|
@@ -1157,10 +1309,16 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1157
1309
|
workspaspaceMessageResponse.threads.push(lastThread);
|
|
1158
1310
|
}
|
|
1159
1311
|
|
|
1160
|
-
logger.debug(
|
|
1312
|
+
logger.debug(
|
|
1313
|
+
`Message sent to channel ID ${channel.id} successfully.`,
|
|
1314
|
+
sendMsgLogAttributes,
|
|
1315
|
+
);
|
|
1161
1316
|
} catch (e) {
|
|
1162
|
-
logger.error(
|
|
1163
|
-
|
|
1317
|
+
logger.error(
|
|
1318
|
+
`Error sending message to channel ID ${channel.id}:`,
|
|
1319
|
+
sendMsgLogAttributes,
|
|
1320
|
+
);
|
|
1321
|
+
logger.error(e, sendMsgLogAttributes);
|
|
1164
1322
|
workspaspaceMessageResponse.errors!.push({
|
|
1165
1323
|
channel: channel,
|
|
1166
1324
|
error: e instanceof Error ? e.message : String(e),
|
|
@@ -1168,8 +1326,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1168
1326
|
}
|
|
1169
1327
|
}
|
|
1170
1328
|
|
|
1171
|
-
logger.debug("Message sent successfully.");
|
|
1172
|
-
logger.debug(workspaspaceMessageResponse);
|
|
1329
|
+
logger.debug("Message sent successfully.", sendMsgLogAttributes);
|
|
1330
|
+
logger.debug(workspaspaceMessageResponse, sendMsgLogAttributes);
|
|
1173
1331
|
|
|
1174
1332
|
return workspaspaceMessageResponse;
|
|
1175
1333
|
}
|
|
@@ -1180,8 +1338,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1180
1338
|
workspaceChannel: WorkspaceChannel;
|
|
1181
1339
|
blocks: Array<JSONObject>;
|
|
1182
1340
|
}): Promise<WorkspaceThread> {
|
|
1183
|
-
|
|
1184
|
-
|
|
1341
|
+
const payloadBlocksLogAttributes: LogAttributes = {
|
|
1342
|
+
channelId: data.workspaceChannel?.id,
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
logger.debug(
|
|
1346
|
+
"Sending payload blocks to channel with data:",
|
|
1347
|
+
payloadBlocksLogAttributes,
|
|
1348
|
+
);
|
|
1349
|
+
logger.debug(JSON.stringify(data, null, 2), payloadBlocksLogAttributes);
|
|
1185
1350
|
|
|
1186
1351
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
1187
1352
|
await API.post({
|
|
@@ -1201,25 +1366,37 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1201
1366
|
},
|
|
1202
1367
|
});
|
|
1203
1368
|
|
|
1204
|
-
logger.debug(
|
|
1205
|
-
|
|
1369
|
+
logger.debug(
|
|
1370
|
+
"Response from Slack API for sending message:",
|
|
1371
|
+
payloadBlocksLogAttributes,
|
|
1372
|
+
);
|
|
1373
|
+
logger.debug(response, payloadBlocksLogAttributes);
|
|
1206
1374
|
|
|
1207
1375
|
if (response instanceof HTTPErrorResponse) {
|
|
1208
|
-
logger.error(
|
|
1209
|
-
|
|
1376
|
+
logger.error(
|
|
1377
|
+
"Error response from Slack API:",
|
|
1378
|
+
payloadBlocksLogAttributes,
|
|
1379
|
+
);
|
|
1380
|
+
logger.error(response, payloadBlocksLogAttributes);
|
|
1210
1381
|
throw response;
|
|
1211
1382
|
}
|
|
1212
1383
|
|
|
1213
1384
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1214
|
-
logger.error(
|
|
1215
|
-
|
|
1385
|
+
logger.error(
|
|
1386
|
+
"Invalid response from Slack API:",
|
|
1387
|
+
payloadBlocksLogAttributes,
|
|
1388
|
+
);
|
|
1389
|
+
logger.error(response.jsonData, payloadBlocksLogAttributes);
|
|
1216
1390
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1217
1391
|
"error"
|
|
1218
1392
|
] as string;
|
|
1219
1393
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
1220
1394
|
}
|
|
1221
1395
|
|
|
1222
|
-
logger.debug(
|
|
1396
|
+
logger.debug(
|
|
1397
|
+
"Payload blocks sent to channel successfully.",
|
|
1398
|
+
payloadBlocksLogAttributes,
|
|
1399
|
+
);
|
|
1223
1400
|
|
|
1224
1401
|
return {
|
|
1225
1402
|
channel: data.workspaceChannel,
|
|
@@ -1234,8 +1411,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1234
1411
|
threadTs: string;
|
|
1235
1412
|
text: string;
|
|
1236
1413
|
}): Promise<void> {
|
|
1237
|
-
|
|
1238
|
-
|
|
1414
|
+
const threadLogAttributes: LogAttributes = { channelId: data.channelId };
|
|
1415
|
+
|
|
1416
|
+
logger.debug("Sending message to thread with data:", threadLogAttributes);
|
|
1417
|
+
logger.debug(data, threadLogAttributes);
|
|
1239
1418
|
|
|
1240
1419
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
1241
1420
|
await API.post({
|
|
@@ -1255,25 +1434,28 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1255
1434
|
},
|
|
1256
1435
|
});
|
|
1257
1436
|
|
|
1258
|
-
logger.debug(
|
|
1259
|
-
|
|
1437
|
+
logger.debug(
|
|
1438
|
+
"Response from Slack API for sending thread message:",
|
|
1439
|
+
threadLogAttributes,
|
|
1440
|
+
);
|
|
1441
|
+
logger.debug(response, threadLogAttributes);
|
|
1260
1442
|
|
|
1261
1443
|
if (response instanceof HTTPErrorResponse) {
|
|
1262
|
-
logger.error("Error response from Slack API:");
|
|
1263
|
-
logger.error(response);
|
|
1444
|
+
logger.error("Error response from Slack API:", threadLogAttributes);
|
|
1445
|
+
logger.error(response, threadLogAttributes);
|
|
1264
1446
|
throw response;
|
|
1265
1447
|
}
|
|
1266
1448
|
|
|
1267
1449
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1268
|
-
logger.error("Invalid response from Slack API:");
|
|
1269
|
-
logger.error(response.jsonData);
|
|
1450
|
+
logger.error("Invalid response from Slack API:", threadLogAttributes);
|
|
1451
|
+
logger.error(response.jsonData, threadLogAttributes);
|
|
1270
1452
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1271
1453
|
"error"
|
|
1272
1454
|
] as string;
|
|
1273
1455
|
throw new BadRequestException("Error from Slack " + messageFromSlack);
|
|
1274
1456
|
}
|
|
1275
1457
|
|
|
1276
|
-
logger.debug("Thread message sent successfully.");
|
|
1458
|
+
logger.debug("Thread message sent successfully.", threadLogAttributes);
|
|
1277
1459
|
}
|
|
1278
1460
|
|
|
1279
1461
|
@CaptureSpan()
|
|
@@ -1282,8 +1464,13 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1282
1464
|
channelId: string;
|
|
1283
1465
|
messageTs: string;
|
|
1284
1466
|
}): Promise<string | null> {
|
|
1285
|
-
|
|
1286
|
-
|
|
1467
|
+
const getMsgLogAttributes: LogAttributes = { channelId: data.channelId };
|
|
1468
|
+
|
|
1469
|
+
logger.debug(
|
|
1470
|
+
"Getting message by timestamp with data:",
|
|
1471
|
+
getMsgLogAttributes,
|
|
1472
|
+
);
|
|
1473
|
+
logger.debug(data, getMsgLogAttributes);
|
|
1287
1474
|
|
|
1288
1475
|
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
|
1289
1476
|
await API.post({
|
|
@@ -1305,18 +1492,21 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1305
1492
|
},
|
|
1306
1493
|
});
|
|
1307
1494
|
|
|
1308
|
-
logger.debug(
|
|
1309
|
-
|
|
1495
|
+
logger.debug(
|
|
1496
|
+
"Response from Slack API for getting message:",
|
|
1497
|
+
getMsgLogAttributes,
|
|
1498
|
+
);
|
|
1499
|
+
logger.debug(response, getMsgLogAttributes);
|
|
1310
1500
|
|
|
1311
1501
|
if (response instanceof HTTPErrorResponse) {
|
|
1312
|
-
logger.error("Error response from Slack API:");
|
|
1313
|
-
logger.error(response);
|
|
1502
|
+
logger.error("Error response from Slack API:", getMsgLogAttributes);
|
|
1503
|
+
logger.error(response, getMsgLogAttributes);
|
|
1314
1504
|
throw response;
|
|
1315
1505
|
}
|
|
1316
1506
|
|
|
1317
1507
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1318
|
-
logger.error("Invalid response from Slack API:");
|
|
1319
|
-
logger.error(response.jsonData);
|
|
1508
|
+
logger.error("Invalid response from Slack API:", getMsgLogAttributes);
|
|
1509
|
+
logger.error(response.jsonData, getMsgLogAttributes);
|
|
1320
1510
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1321
1511
|
"error"
|
|
1322
1512
|
] as string;
|
|
@@ -1328,14 +1518,14 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1328
1518
|
] as Array<JSONObject>;
|
|
1329
1519
|
|
|
1330
1520
|
if (!messages || messages.length === 0) {
|
|
1331
|
-
logger.debug("No messages found for timestamp.");
|
|
1521
|
+
logger.debug("No messages found for timestamp.", getMsgLogAttributes);
|
|
1332
1522
|
return null;
|
|
1333
1523
|
}
|
|
1334
1524
|
|
|
1335
1525
|
const messageText: string | undefined = messages[0]?.["text"] as string;
|
|
1336
1526
|
|
|
1337
|
-
logger.debug("Message text retrieved:");
|
|
1338
|
-
logger.debug(messageText);
|
|
1527
|
+
logger.debug("Message text retrieved:", getMsgLogAttributes);
|
|
1528
|
+
logger.debug(messageText, getMsgLogAttributes);
|
|
1339
1529
|
|
|
1340
1530
|
return messageText || null;
|
|
1341
1531
|
}
|
|
@@ -1344,8 +1534,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1344
1534
|
public static override getButtonsBlock(data: {
|
|
1345
1535
|
payloadButtonsBlock: WorkspacePayloadButtons;
|
|
1346
1536
|
}): JSONObject {
|
|
1347
|
-
logger.debug("Getting buttons block with data:");
|
|
1348
|
-
logger.debug(data);
|
|
1537
|
+
logger.debug("Getting buttons block with data:", {} as LogAttributes);
|
|
1538
|
+
logger.debug(data, {} as LogAttributes);
|
|
1349
1539
|
|
|
1350
1540
|
const buttonsBlock: JSONObject = {
|
|
1351
1541
|
type: "actions",
|
|
@@ -1356,8 +1546,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1356
1546
|
),
|
|
1357
1547
|
};
|
|
1358
1548
|
|
|
1359
|
-
logger.debug("Buttons block generated:");
|
|
1360
|
-
logger.debug(buttonsBlock);
|
|
1549
|
+
logger.debug("Buttons block generated:", {} as LogAttributes);
|
|
1550
|
+
logger.debug(buttonsBlock, {} as LogAttributes);
|
|
1361
1551
|
return buttonsBlock;
|
|
1362
1552
|
}
|
|
1363
1553
|
|
|
@@ -1375,8 +1565,12 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1375
1565
|
.toLowerCase()
|
|
1376
1566
|
.replace(/[^a-z0-9\-_]/g, "");
|
|
1377
1567
|
|
|
1378
|
-
|
|
1379
|
-
|
|
1568
|
+
const createChannelLogAttributes: LogAttributes = {
|
|
1569
|
+
projectId: data.projectId?.toString(),
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
logger.debug("Creating channel with data:", createChannelLogAttributes);
|
|
1573
|
+
logger.debug(data, createChannelLogAttributes);
|
|
1380
1574
|
|
|
1381
1575
|
const response: HTTPResponse<JSONObject> | HTTPErrorResponse =
|
|
1382
1576
|
await API.post({
|
|
@@ -1394,19 +1588,28 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1394
1588
|
},
|
|
1395
1589
|
});
|
|
1396
1590
|
|
|
1397
|
-
logger.debug(
|
|
1398
|
-
|
|
1591
|
+
logger.debug(
|
|
1592
|
+
"Response from Slack API for creating channel:",
|
|
1593
|
+
createChannelLogAttributes,
|
|
1594
|
+
);
|
|
1595
|
+
logger.debug(response, createChannelLogAttributes);
|
|
1399
1596
|
|
|
1400
1597
|
if (response instanceof HTTPErrorResponse) {
|
|
1401
|
-
logger.error(
|
|
1402
|
-
|
|
1598
|
+
logger.error(
|
|
1599
|
+
"Error response from Slack API:",
|
|
1600
|
+
createChannelLogAttributes,
|
|
1601
|
+
);
|
|
1602
|
+
logger.error(response, createChannelLogAttributes);
|
|
1403
1603
|
throw response;
|
|
1404
1604
|
}
|
|
1405
1605
|
|
|
1406
1606
|
// check for ok response
|
|
1407
1607
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1408
|
-
logger.error(
|
|
1409
|
-
|
|
1608
|
+
logger.error(
|
|
1609
|
+
"Invalid response from Slack API:",
|
|
1610
|
+
createChannelLogAttributes,
|
|
1611
|
+
);
|
|
1612
|
+
logger.error(response.jsonData, createChannelLogAttributes);
|
|
1410
1613
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1411
1614
|
"error"
|
|
1412
1615
|
] as string;
|
|
@@ -1417,8 +1620,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1417
1620
|
!((response.jsonData as JSONObject)?.["channel"] as JSONObject)?.["id"] ||
|
|
1418
1621
|
!((response.jsonData as JSONObject)?.["channel"] as JSONObject)?.["name"]
|
|
1419
1622
|
) {
|
|
1420
|
-
logger.error(
|
|
1421
|
-
|
|
1623
|
+
logger.error(
|
|
1624
|
+
"Invalid response from Slack API:",
|
|
1625
|
+
createChannelLogAttributes,
|
|
1626
|
+
);
|
|
1627
|
+
logger.error(response.jsonData, createChannelLogAttributes);
|
|
1422
1628
|
throw new Error("Invalid response");
|
|
1423
1629
|
}
|
|
1424
1630
|
|
|
@@ -1432,8 +1638,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1432
1638
|
workspaceType: WorkspaceType.Slack,
|
|
1433
1639
|
};
|
|
1434
1640
|
|
|
1435
|
-
logger.debug("Channel created successfully:");
|
|
1436
|
-
logger.debug(channel);
|
|
1641
|
+
logger.debug("Channel created successfully:", createChannelLogAttributes);
|
|
1642
|
+
logger.debug(channel, createChannelLogAttributes);
|
|
1437
1643
|
|
|
1438
1644
|
// Cache the created channel
|
|
1439
1645
|
try {
|
|
@@ -1449,8 +1655,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1449
1655
|
channelCache: localCache,
|
|
1450
1656
|
});
|
|
1451
1657
|
} catch (error) {
|
|
1452
|
-
logger.error(
|
|
1453
|
-
|
|
1658
|
+
logger.error(
|
|
1659
|
+
"Error caching created channel:",
|
|
1660
|
+
createChannelLogAttributes,
|
|
1661
|
+
);
|
|
1662
|
+
logger.error(error, createChannelLogAttributes);
|
|
1454
1663
|
// Don't fail the creation if caching fails
|
|
1455
1664
|
}
|
|
1456
1665
|
|
|
@@ -1461,8 +1670,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1461
1670
|
public static override getHeaderBlock(data: {
|
|
1462
1671
|
payloadHeaderBlock: WorkspacePayloadHeader;
|
|
1463
1672
|
}): JSONObject {
|
|
1464
|
-
logger.debug("Getting header block with data:");
|
|
1465
|
-
logger.debug(data);
|
|
1673
|
+
logger.debug("Getting header block with data:", {} as LogAttributes);
|
|
1674
|
+
logger.debug(data, {} as LogAttributes);
|
|
1466
1675
|
|
|
1467
1676
|
const headerBlock: JSONObject = {
|
|
1468
1677
|
type: "header",
|
|
@@ -1472,8 +1681,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1472
1681
|
},
|
|
1473
1682
|
};
|
|
1474
1683
|
|
|
1475
|
-
logger.debug("Header block generated:");
|
|
1476
|
-
logger.debug(headerBlock);
|
|
1684
|
+
logger.debug("Header block generated:", {} as LogAttributes);
|
|
1685
|
+
logger.debug(headerBlock, {} as LogAttributes);
|
|
1477
1686
|
return headerBlock;
|
|
1478
1687
|
}
|
|
1479
1688
|
|
|
@@ -1481,8 +1690,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1481
1690
|
public static override getCheckboxBlock(data: {
|
|
1482
1691
|
payloadCheckboxBlock: WorkspaceCheckboxBlock;
|
|
1483
1692
|
}): JSONObject {
|
|
1484
|
-
logger.debug("Getting checkbox block with data:");
|
|
1485
|
-
logger.debug(data);
|
|
1693
|
+
logger.debug("Getting checkbox block with data:", {} as LogAttributes);
|
|
1694
|
+
logger.debug(data, {} as LogAttributes);
|
|
1486
1695
|
|
|
1487
1696
|
const checkboxBlock: JSONObject = {
|
|
1488
1697
|
type: "input",
|
|
@@ -1525,8 +1734,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1525
1734
|
};
|
|
1526
1735
|
}
|
|
1527
1736
|
|
|
1528
|
-
logger.debug("Checkbox block generated:");
|
|
1529
|
-
logger.debug(checkboxBlock);
|
|
1737
|
+
logger.debug("Checkbox block generated:", {} as LogAttributes);
|
|
1738
|
+
logger.debug(checkboxBlock, {} as LogAttributes);
|
|
1530
1739
|
return checkboxBlock;
|
|
1531
1740
|
}
|
|
1532
1741
|
|
|
@@ -1534,8 +1743,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1534
1743
|
public static override getDateTimePickerBlock(data: {
|
|
1535
1744
|
payloadDateTimePickerBlock: WorkspaceDateTimePickerBlock;
|
|
1536
1745
|
}): JSONObject {
|
|
1537
|
-
logger.debug(
|
|
1538
|
-
|
|
1746
|
+
logger.debug(
|
|
1747
|
+
"Getting date time picker block with data:",
|
|
1748
|
+
{} as LogAttributes,
|
|
1749
|
+
);
|
|
1750
|
+
logger.debug(data, {} as LogAttributes);
|
|
1539
1751
|
|
|
1540
1752
|
const dateTimePickerBlock: JSONObject = {
|
|
1541
1753
|
type: "input",
|
|
@@ -1550,8 +1762,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1550
1762
|
},
|
|
1551
1763
|
};
|
|
1552
1764
|
|
|
1553
|
-
logger.debug("Date time picker block generated:");
|
|
1554
|
-
logger.debug(dateTimePickerBlock);
|
|
1765
|
+
logger.debug("Date time picker block generated:", {} as LogAttributes);
|
|
1766
|
+
logger.debug(dateTimePickerBlock, {} as LogAttributes);
|
|
1555
1767
|
return dateTimePickerBlock;
|
|
1556
1768
|
}
|
|
1557
1769
|
|
|
@@ -1559,8 +1771,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1559
1771
|
public static override getTextAreaBlock(data: {
|
|
1560
1772
|
payloadTextAreaBlock: WorkspaceTextAreaBlock;
|
|
1561
1773
|
}): JSONObject {
|
|
1562
|
-
logger.debug("Getting text area block with data:");
|
|
1563
|
-
logger.debug(data);
|
|
1774
|
+
logger.debug("Getting text area block with data:", {} as LogAttributes);
|
|
1775
|
+
logger.debug(data, {} as LogAttributes);
|
|
1564
1776
|
|
|
1565
1777
|
const optional: boolean = data.payloadTextAreaBlock.optional || false;
|
|
1566
1778
|
|
|
@@ -1592,8 +1804,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1592
1804
|
};
|
|
1593
1805
|
}
|
|
1594
1806
|
|
|
1595
|
-
logger.debug("Text area block generated:");
|
|
1596
|
-
logger.debug(textAreaBlock);
|
|
1807
|
+
logger.debug("Text area block generated:", {} as LogAttributes);
|
|
1808
|
+
logger.debug(textAreaBlock, {} as LogAttributes);
|
|
1597
1809
|
return textAreaBlock;
|
|
1598
1810
|
}
|
|
1599
1811
|
|
|
@@ -1601,8 +1813,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1601
1813
|
public static override getTextBoxBlock(data: {
|
|
1602
1814
|
payloadTextBoxBlock: WorkspaceTextBoxBlock;
|
|
1603
1815
|
}): JSONObject {
|
|
1604
|
-
logger.debug("Getting text box block with data:");
|
|
1605
|
-
logger.debug(data);
|
|
1816
|
+
logger.debug("Getting text box block with data:", {} as LogAttributes);
|
|
1817
|
+
logger.debug(data, {} as LogAttributes);
|
|
1606
1818
|
|
|
1607
1819
|
const optional: boolean = data.payloadTextBoxBlock.optional || false;
|
|
1608
1820
|
|
|
@@ -1633,8 +1845,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1633
1845
|
};
|
|
1634
1846
|
}
|
|
1635
1847
|
|
|
1636
|
-
logger.debug("Text box block generated:");
|
|
1637
|
-
logger.debug(textBoxBlock);
|
|
1848
|
+
logger.debug("Text box block generated:", {} as LogAttributes);
|
|
1849
|
+
logger.debug(textBoxBlock, {} as LogAttributes);
|
|
1638
1850
|
return textBoxBlock;
|
|
1639
1851
|
}
|
|
1640
1852
|
|
|
@@ -1642,8 +1854,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1642
1854
|
public static override getImageBlock(data: {
|
|
1643
1855
|
payloadImageBlock: WorkspacePayloadImage;
|
|
1644
1856
|
}): JSONObject {
|
|
1645
|
-
logger.debug("Getting image block with data:");
|
|
1646
|
-
logger.debug(data);
|
|
1857
|
+
logger.debug("Getting image block with data:", {} as LogAttributes);
|
|
1858
|
+
logger.debug(data, {} as LogAttributes);
|
|
1647
1859
|
|
|
1648
1860
|
const imageBlock: JSONObject = {
|
|
1649
1861
|
type: "image",
|
|
@@ -1651,8 +1863,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1651
1863
|
alt_text: data.payloadImageBlock.altText,
|
|
1652
1864
|
};
|
|
1653
1865
|
|
|
1654
|
-
logger.debug("Image block generated:");
|
|
1655
|
-
logger.debug(imageBlock);
|
|
1866
|
+
logger.debug("Image block generated:", {} as LogAttributes);
|
|
1867
|
+
logger.debug(imageBlock, {} as LogAttributes);
|
|
1656
1868
|
return imageBlock;
|
|
1657
1869
|
}
|
|
1658
1870
|
|
|
@@ -1660,8 +1872,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1660
1872
|
public static override getDropdownBlock(data: {
|
|
1661
1873
|
payloadDropdownBlock: WorkspaceDropdownBlock;
|
|
1662
1874
|
}): JSONObject {
|
|
1663
|
-
logger.debug("Getting dropdown block with data:");
|
|
1664
|
-
logger.debug(data);
|
|
1875
|
+
logger.debug("Getting dropdown block with data:", {} as LogAttributes);
|
|
1876
|
+
logger.debug(data, {} as LogAttributes);
|
|
1665
1877
|
|
|
1666
1878
|
const optional: boolean = data.payloadDropdownBlock.optional || false;
|
|
1667
1879
|
|
|
@@ -1715,8 +1927,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1715
1927
|
};
|
|
1716
1928
|
}
|
|
1717
1929
|
|
|
1718
|
-
logger.debug("Dropdown block generated:");
|
|
1719
|
-
logger.debug(dropdownBlock);
|
|
1930
|
+
logger.debug("Dropdown block generated:", {} as LogAttributes);
|
|
1931
|
+
logger.debug(dropdownBlock, {} as LogAttributes);
|
|
1720
1932
|
return dropdownBlock;
|
|
1721
1933
|
}
|
|
1722
1934
|
|
|
@@ -1724,8 +1936,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1724
1936
|
public static override getModalBlock(data: {
|
|
1725
1937
|
payloadModalBlock: WorkspaceModalBlock;
|
|
1726
1938
|
}): JSONObject {
|
|
1727
|
-
logger.debug("Getting modal block with data:");
|
|
1728
|
-
logger.debug(data);
|
|
1939
|
+
logger.debug("Getting modal block with data:", {} as LogAttributes);
|
|
1940
|
+
logger.debug(data, {} as LogAttributes);
|
|
1729
1941
|
|
|
1730
1942
|
const modalBlock: JSONObject = {
|
|
1731
1943
|
type: "modal",
|
|
@@ -1748,8 +1960,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1748
1960
|
}),
|
|
1749
1961
|
};
|
|
1750
1962
|
|
|
1751
|
-
logger.debug("Modal block generated:");
|
|
1752
|
-
logger.debug(modalBlock);
|
|
1963
|
+
logger.debug("Modal block generated:", {} as LogAttributes);
|
|
1964
|
+
logger.debug(modalBlock, {} as LogAttributes);
|
|
1753
1965
|
return modalBlock;
|
|
1754
1966
|
}
|
|
1755
1967
|
|
|
@@ -1757,8 +1969,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1757
1969
|
public static override getMarkdownBlock(data: {
|
|
1758
1970
|
payloadMarkdownBlock: WorkspacePayloadMarkdown;
|
|
1759
1971
|
}): JSONObject {
|
|
1760
|
-
logger.debug("Getting markdown block with data:");
|
|
1761
|
-
logger.debug(data);
|
|
1972
|
+
logger.debug("Getting markdown block with data:", {} as LogAttributes);
|
|
1973
|
+
logger.debug(data, {} as LogAttributes);
|
|
1762
1974
|
|
|
1763
1975
|
const markdownBlock: JSONObject = {
|
|
1764
1976
|
type: "section",
|
|
@@ -1770,8 +1982,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1770
1982
|
},
|
|
1771
1983
|
};
|
|
1772
1984
|
|
|
1773
|
-
logger.debug("Markdown block generated:");
|
|
1774
|
-
logger.debug(markdownBlock);
|
|
1985
|
+
logger.debug("Markdown block generated:", {} as LogAttributes);
|
|
1986
|
+
logger.debug(markdownBlock, {} as LogAttributes);
|
|
1775
1987
|
return markdownBlock;
|
|
1776
1988
|
}
|
|
1777
1989
|
|
|
@@ -1799,16 +2011,24 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1799
2011
|
});
|
|
1800
2012
|
|
|
1801
2013
|
if (response instanceof HTTPErrorResponse) {
|
|
1802
|
-
logger.error("Error response from Slack API:"
|
|
1803
|
-
|
|
2014
|
+
logger.error("Error response from Slack API:", {
|
|
2015
|
+
channelId: data.directMessageChannelId,
|
|
2016
|
+
} as LogAttributes);
|
|
2017
|
+
logger.error(response, {
|
|
2018
|
+
channelId: data.directMessageChannelId,
|
|
2019
|
+
} as LogAttributes);
|
|
1804
2020
|
throw response;
|
|
1805
2021
|
}
|
|
1806
2022
|
|
|
1807
2023
|
// check for ok response
|
|
1808
2024
|
|
|
1809
2025
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1810
|
-
logger.error("Invalid response from Slack API:"
|
|
1811
|
-
|
|
2026
|
+
logger.error("Invalid response from Slack API:", {
|
|
2027
|
+
channelId: data.directMessageChannelId,
|
|
2028
|
+
} as LogAttributes);
|
|
2029
|
+
logger.error(response.jsonData, {
|
|
2030
|
+
channelId: data.directMessageChannelId,
|
|
2031
|
+
} as LogAttributes);
|
|
1812
2032
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1813
2033
|
"error"
|
|
1814
2034
|
] as string;
|
|
@@ -1835,8 +2055,15 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1835
2055
|
}): Promise<boolean> {
|
|
1836
2056
|
const members: Array<string> = [];
|
|
1837
2057
|
|
|
1838
|
-
|
|
1839
|
-
|
|
2058
|
+
const isInChannelLogAttributes: LogAttributes = {
|
|
2059
|
+
channelId: data.channelId,
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
logger.debug(
|
|
2063
|
+
"Checking if user is in channel with data:",
|
|
2064
|
+
isInChannelLogAttributes,
|
|
2065
|
+
);
|
|
2066
|
+
logger.debug(data, isInChannelLogAttributes);
|
|
1840
2067
|
|
|
1841
2068
|
let cursor: string | undefined = undefined;
|
|
1842
2069
|
|
|
@@ -1866,20 +2093,29 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1866
2093
|
},
|
|
1867
2094
|
});
|
|
1868
2095
|
|
|
1869
|
-
logger.debug(
|
|
1870
|
-
|
|
2096
|
+
logger.debug(
|
|
2097
|
+
"Response from Slack API for getting channel members:",
|
|
2098
|
+
isInChannelLogAttributes,
|
|
2099
|
+
);
|
|
2100
|
+
logger.debug(response, isInChannelLogAttributes);
|
|
1871
2101
|
|
|
1872
2102
|
if (response instanceof HTTPErrorResponse) {
|
|
1873
|
-
logger.error(
|
|
1874
|
-
|
|
2103
|
+
logger.error(
|
|
2104
|
+
"Error response from Slack API:",
|
|
2105
|
+
isInChannelLogAttributes,
|
|
2106
|
+
);
|
|
2107
|
+
logger.error(response, isInChannelLogAttributes);
|
|
1875
2108
|
throw response;
|
|
1876
2109
|
}
|
|
1877
2110
|
|
|
1878
2111
|
// check for ok response
|
|
1879
2112
|
|
|
1880
2113
|
if ((response.jsonData as JSONObject)?.["ok"] !== true) {
|
|
1881
|
-
logger.error(
|
|
1882
|
-
|
|
2114
|
+
logger.error(
|
|
2115
|
+
"Invalid response from Slack API:",
|
|
2116
|
+
isInChannelLogAttributes,
|
|
2117
|
+
);
|
|
2118
|
+
logger.error(response.jsonData, isInChannelLogAttributes);
|
|
1883
2119
|
const messageFromSlack: string = (response.jsonData as JSONObject)?.[
|
|
1884
2120
|
"error"
|
|
1885
2121
|
] as string;
|
|
@@ -1909,8 +2145,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1909
2145
|
public static override getButtonBlock(data: {
|
|
1910
2146
|
payloadButtonBlock: WorkspaceMessagePayloadButton;
|
|
1911
2147
|
}): JSONObject {
|
|
1912
|
-
logger.debug("Getting button block with data:");
|
|
1913
|
-
logger.debug(data);
|
|
2148
|
+
logger.debug("Getting button block with data:", {} as LogAttributes);
|
|
2149
|
+
logger.debug(data, {} as LogAttributes);
|
|
1914
2150
|
|
|
1915
2151
|
const buttonBlock: JSONObject = {
|
|
1916
2152
|
type: "button",
|
|
@@ -1926,8 +2162,8 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1926
2162
|
: undefined,
|
|
1927
2163
|
};
|
|
1928
2164
|
|
|
1929
|
-
logger.debug("Button block generated:");
|
|
1930
|
-
logger.debug(buttonBlock);
|
|
2165
|
+
logger.debug("Button block generated:", {} as LogAttributes);
|
|
2166
|
+
logger.debug(buttonBlock, {} as LogAttributes);
|
|
1931
2167
|
return buttonBlock;
|
|
1932
2168
|
}
|
|
1933
2169
|
|
|
@@ -1936,8 +2172,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1936
2172
|
url: URL;
|
|
1937
2173
|
text: string;
|
|
1938
2174
|
}): Promise<HTTPResponse<JSONObject> | HTTPErrorResponse> {
|
|
1939
|
-
logger.debug(
|
|
1940
|
-
|
|
2175
|
+
logger.debug(
|
|
2176
|
+
"Sending message to channel via incoming webhook with data:",
|
|
2177
|
+
{} as LogAttributes,
|
|
2178
|
+
);
|
|
2179
|
+
logger.debug(data, {} as LogAttributes);
|
|
1941
2180
|
|
|
1942
2181
|
const apiResult: HTTPResponse<JSONObject> | HTTPErrorResponse | null =
|
|
1943
2182
|
await API.post({
|
|
@@ -1959,8 +2198,11 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1959
2198
|
},
|
|
1960
2199
|
});
|
|
1961
2200
|
|
|
1962
|
-
logger.debug(
|
|
1963
|
-
|
|
2201
|
+
logger.debug(
|
|
2202
|
+
"Response from Slack API for sending message via webhook:",
|
|
2203
|
+
{} as LogAttributes,
|
|
2204
|
+
);
|
|
2205
|
+
logger.debug(apiResult, {} as LogAttributes);
|
|
1964
2206
|
return apiResult;
|
|
1965
2207
|
}
|
|
1966
2208
|
|
|
@@ -2108,16 +2350,24 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
2108
2350
|
});
|
|
2109
2351
|
|
|
2110
2352
|
if (response instanceof HTTPErrorResponse) {
|
|
2111
|
-
logger.error("Error response from Slack API for channel history:"
|
|
2112
|
-
|
|
2353
|
+
logger.error("Error response from Slack API for channel history:", {
|
|
2354
|
+
channelId: params.channelId,
|
|
2355
|
+
} as LogAttributes);
|
|
2356
|
+
logger.error(response, {
|
|
2357
|
+
channelId: params.channelId,
|
|
2358
|
+
} as LogAttributes);
|
|
2113
2359
|
break;
|
|
2114
2360
|
}
|
|
2115
2361
|
|
|
2116
2362
|
const jsonData: JSONObject = response.jsonData as JSONObject;
|
|
2117
2363
|
|
|
2118
2364
|
if (jsonData["ok"] !== true) {
|
|
2119
|
-
logger.error("Invalid response from Slack API for channel history:"
|
|
2120
|
-
|
|
2365
|
+
logger.error("Invalid response from Slack API for channel history:", {
|
|
2366
|
+
channelId: params.channelId,
|
|
2367
|
+
} as LogAttributes);
|
|
2368
|
+
logger.error(jsonData, {
|
|
2369
|
+
channelId: params.channelId,
|
|
2370
|
+
} as LogAttributes);
|
|
2121
2371
|
break;
|
|
2122
2372
|
}
|
|
2123
2373
|
|
|
@@ -2174,6 +2424,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
2174
2424
|
|
|
2175
2425
|
logger.debug(
|
|
2176
2426
|
`Retrieved ${messages.length} messages from Slack channel ${params.channelId}`,
|
|
2427
|
+
{ channelId: params.channelId } as LogAttributes,
|
|
2177
2428
|
);
|
|
2178
2429
|
|
|
2179
2430
|
// Reverse to get chronological order (Slack returns newest first)
|