@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.
Files changed (405) hide show
  1. package/Models/AnalyticsModels/Metric.ts +78 -0
  2. package/Server/API/AIAgentDataAPI.ts +6 -1
  3. package/Server/API/BillingAPI.ts +28 -6
  4. package/Server/API/CommonAPI.ts +11 -0
  5. package/Server/API/DashboardAPI.ts +6 -2
  6. package/Server/API/DashboardDomainAPI.ts +10 -3
  7. package/Server/API/GitHubAPI.ts +58 -14
  8. package/Server/API/MicrosoftTeamsAPI.ts +97 -33
  9. package/Server/API/OpenSourceDeploymentAPI.ts +2 -2
  10. package/Server/API/SlackAPI.ts +107 -36
  11. package/Server/API/StatusAPI.ts +37 -16
  12. package/Server/API/StatusPageAPI.ts +97 -23
  13. package/Server/API/StatusPageDomainAPI.ts +6 -3
  14. package/Server/API/TelemetryAPI.ts +81 -0
  15. package/Server/API/UserAPI.ts +3 -3
  16. package/Server/API/UserCallAPI.ts +5 -2
  17. package/Server/API/UserEmailAPI.ts +5 -2
  18. package/Server/API/UserPushAPI.ts +9 -3
  19. package/Server/API/UserSmsAPI.ts +5 -2
  20. package/Server/API/UserWhatsAppAPI.ts +5 -2
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.ts +47 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.ts +35 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  24. package/Server/Middleware/NotificationMiddleware.ts +2 -2
  25. package/Server/Middleware/ProjectAuthorization.ts +6 -0
  26. package/Server/Middleware/SCIMAuthorization.ts +2 -1
  27. package/Server/Middleware/SlackAuthorization.ts +28 -10
  28. package/Server/Middleware/TelemetryIngest.ts +16 -3
  29. package/Server/Middleware/UserAuthorization.ts +22 -5
  30. package/Server/Middleware/WhatsAppAuthorization.ts +15 -4
  31. package/Server/Services/AIAgentService.ts +13 -6
  32. package/Server/Services/AIService.ts +9 -3
  33. package/Server/Services/AlertEpisodeFeedService.ts +17 -5
  34. package/Server/Services/AlertEpisodeService.ts +34 -3
  35. package/Server/Services/AlertEpisodeStateTimelineService.ts +80 -22
  36. package/Server/Services/AlertFeedService.ts +17 -5
  37. package/Server/Services/AlertGroupingEngineService.ts +36 -7
  38. package/Server/Services/AlertService.ts +60 -8
  39. package/Server/Services/AlertStateTimelineService.ts +29 -7
  40. package/Server/Services/AnalyticsDatabaseService.ts +59 -25
  41. package/Server/Services/BillingInvoiceService.ts +7 -3
  42. package/Server/Services/BillingService.ts +9 -2
  43. package/Server/Services/DashboardDomainService.ts +56 -22
  44. package/Server/Services/DashboardService.ts +11 -4
  45. package/Server/Services/DatabaseService.ts +31 -11
  46. package/Server/Services/IncidentEpisodeFeedService.ts +17 -5
  47. package/Server/Services/IncidentEpisodeService.ts +34 -3
  48. package/Server/Services/IncidentEpisodeStateTimelineService.ts +80 -22
  49. package/Server/Services/IncidentFeedService.ts +33 -9
  50. package/Server/Services/IncidentGroupingEngineService.ts +35 -6
  51. package/Server/Services/IncidentService.ts +103 -9
  52. package/Server/Services/IncidentSlaRuleService.ts +16 -4
  53. package/Server/Services/IncidentSlaService.ts +20 -4
  54. package/Server/Services/IncidentStateTimelineService.ts +120 -31
  55. package/Server/Services/KubernetesClusterService.ts +62 -14
  56. package/Server/Services/LabelService.ts +14 -1
  57. package/Server/Services/MonitorFeedService.ts +33 -9
  58. package/Server/Services/MonitorProbeService.ts +31 -2
  59. package/Server/Services/MonitorService.ts +35 -4
  60. package/Server/Services/MonitorStatusTimelineService.ts +68 -20
  61. package/Server/Services/NotificationService.ts +4 -2
  62. package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +53 -9
  63. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +9 -2
  64. package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +29 -8
  65. package/Server/Services/OnCallDutyPolicyFeedService.ts +33 -8
  66. package/Server/Services/OnCallDutyPolicyScheduleService.ts +97 -24
  67. package/Server/Services/OnCallDutyPolicyService.ts +2 -1
  68. package/Server/Services/OpenTelemetryIngestService.ts +51 -20
  69. package/Server/Services/ProbeService.ts +16 -7
  70. package/Server/Services/ProjectService.ts +29 -11
  71. package/Server/Services/ScheduledMaintenanceFeedService.ts +17 -4
  72. package/Server/Services/ScheduledMaintenanceService.ts +52 -6
  73. package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +72 -20
  74. package/Server/Services/StatusPageDomainService.ts +59 -23
  75. package/Server/Services/StatusPageService.ts +26 -8
  76. package/Server/Services/StatusPageSubscriberService.ts +382 -111
  77. package/Server/Services/TeamMemberService.ts +9 -3
  78. package/Server/Services/TelemetryAttributeService.ts +117 -4
  79. package/Server/Services/UserNotificationRuleService.ts +9 -3
  80. package/Server/Services/UserService.ts +6 -4
  81. package/Server/Services/UserWhatsAppService.ts +9 -3
  82. package/Server/Services/WorkflowService.ts +7 -3
  83. package/Server/Services/WorkspaceNotificationRuleService.ts +398 -156
  84. package/Server/Types/Domain.ts +15 -5
  85. package/Server/Types/Workflow/Components/API/Post.ts +22 -8
  86. package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +12 -4
  87. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +10 -0
  88. package/Server/Utils/CodeRepository/CodeRepository.ts +62 -13
  89. package/Server/Utils/Express.ts +1 -0
  90. package/Server/Utils/Greenlock/Greenlock.ts +75 -20
  91. package/Server/Utils/LLM/LLMService.ts +22 -7
  92. package/Server/Utils/Logger.ts +93 -13
  93. package/Server/Utils/Monitor/MonitorAlert.ts +15 -3
  94. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +15 -5
  95. package/Server/Utils/Monitor/MonitorIncident.ts +17 -3
  96. package/Server/Utils/Monitor/MonitorStatusTimeline.ts +6 -1
  97. package/Server/Utils/Profiling.ts +11 -5
  98. package/Server/Utils/Realtime.ts +90 -31
  99. package/Server/Utils/Response.ts +2 -2
  100. package/Server/Utils/StartServer.ts +43 -9
  101. package/Server/Utils/Telemetry/SpanUtil.ts +90 -0
  102. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +58 -15
  103. package/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.ts +58 -15
  104. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +19 -3
  105. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +87 -22
  106. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +12 -3
  107. package/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.ts +25 -7
  108. package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +55 -8
  109. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +100 -22
  110. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +35 -9
  111. package/Server/Utils/Workspace/Slack/Actions/AlertEpisode.ts +32 -8
  112. package/Server/Utils/Workspace/Slack/Actions/Auth.ts +3 -1
  113. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +52 -11
  114. package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +4 -1
  115. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +89 -20
  116. package/Server/Utils/Workspace/Slack/Slack.ts +498 -247
  117. package/Server/Utils/Workspace/Workspace.ts +33 -11
  118. package/Server/Utils/Workspace/WorkspaceBase.ts +3 -1
  119. package/Server/Utils/Workspace/WorkspaceMessages/Alert.ts +8 -2
  120. package/Tests/Server/Middleware/UserAuthorization.test.ts +1 -1
  121. package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +12 -3
  122. package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +60 -38
  123. package/UI/Components/Charts/Area/AreaChart.tsx +35 -1
  124. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +7 -0
  125. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +33 -0
  126. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +33 -0
  127. package/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.ts +14 -0
  128. package/UI/Components/Charts/Line/LineChart.tsx +35 -1
  129. package/UI/Components/Charts/Types/ExemplarPoint.ts +6 -0
  130. package/UI/Components/Dictionary/Dictionary.tsx +13 -1
  131. package/UI/Components/Filters/FiltersForm.tsx +2 -0
  132. package/UI/Components/Filters/JSONFilter.tsx +5 -1
  133. package/UI/Components/Filters/Types/Filter.ts +2 -0
  134. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +3 -3
  135. package/UI/Components/ModelTable/BaseModelTable.tsx +10 -6
  136. package/UI/Components/Navbar/NavBar.tsx +10 -0
  137. package/build/dist/Models/AnalyticsModels/Metric.js +70 -0
  138. package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
  139. package/build/dist/Server/API/AIAgentDataAPI.js +6 -6
  140. package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
  141. package/build/dist/Server/API/BillingAPI.js +13 -13
  142. package/build/dist/Server/API/BillingAPI.js.map +1 -1
  143. package/build/dist/Server/API/CommonAPI.js +5 -0
  144. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  145. package/build/dist/Server/API/DashboardAPI.js +2 -2
  146. package/build/dist/Server/API/DashboardAPI.js.map +1 -1
  147. package/build/dist/Server/API/DashboardDomainAPI.js +3 -3
  148. package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -1
  149. package/build/dist/Server/API/GitHubAPI.js +19 -19
  150. package/build/dist/Server/API/GitHubAPI.js.map +1 -1
  151. package/build/dist/Server/API/MicrosoftTeamsAPI.js +34 -34
  152. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  153. package/build/dist/Server/API/OpenSourceDeploymentAPI.js +2 -2
  154. package/build/dist/Server/API/OpenSourceDeploymentAPI.js.map +1 -1
  155. package/build/dist/Server/API/SlackAPI.js +38 -38
  156. package/build/dist/Server/API/SlackAPI.js.map +1 -1
  157. package/build/dist/Server/API/StatusAPI.js +16 -16
  158. package/build/dist/Server/API/StatusAPI.js.map +1 -1
  159. package/build/dist/Server/API/StatusPageAPI.js +52 -52
  160. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  161. package/build/dist/Server/API/StatusPageDomainAPI.js +3 -3
  162. package/build/dist/Server/API/StatusPageDomainAPI.js.map +1 -1
  163. package/build/dist/Server/API/TelemetryAPI.js +39 -0
  164. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  165. package/build/dist/Server/API/UserAPI.js +3 -3
  166. package/build/dist/Server/API/UserAPI.js.map +1 -1
  167. package/build/dist/Server/API/UserCallAPI.js +2 -2
  168. package/build/dist/Server/API/UserCallAPI.js.map +1 -1
  169. package/build/dist/Server/API/UserEmailAPI.js +2 -2
  170. package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
  171. package/build/dist/Server/API/UserPushAPI.js +3 -3
  172. package/build/dist/Server/API/UserPushAPI.js.map +1 -1
  173. package/build/dist/Server/API/UserSmsAPI.js +2 -2
  174. package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
  175. package/build/dist/Server/API/UserWhatsAppAPI.js +2 -2
  176. package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -1
  177. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js +40 -0
  178. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064921-MigrationName.js.map +1 -0
  179. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js +18 -0
  180. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1775735059360-MigrationName.js.map +1 -0
  181. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  182. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  183. package/build/dist/Server/Middleware/NotificationMiddleware.js +2 -2
  184. package/build/dist/Server/Middleware/NotificationMiddleware.js.map +1 -1
  185. package/build/dist/Server/Middleware/ProjectAuthorization.js +5 -0
  186. package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
  187. package/build/dist/Server/Middleware/SCIMAuthorization.js +2 -2
  188. package/build/dist/Server/Middleware/SCIMAuthorization.js.map +1 -1
  189. package/build/dist/Server/Middleware/SlackAuthorization.js +10 -10
  190. package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
  191. package/build/dist/Server/Middleware/TelemetryIngest.js +9 -4
  192. package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
  193. package/build/dist/Server/Middleware/UserAuthorization.js +10 -5
  194. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  195. package/build/dist/Server/Middleware/WhatsAppAuthorization.js +6 -6
  196. package/build/dist/Server/Middleware/WhatsAppAuthorization.js.map +1 -1
  197. package/build/dist/Server/Services/AIAgentService.js +13 -7
  198. package/build/dist/Server/Services/AIAgentService.js.map +1 -1
  199. package/build/dist/Server/Services/AIService.js +9 -2
  200. package/build/dist/Server/Services/AIService.js.map +1 -1
  201. package/build/dist/Server/Services/AlertEpisodeFeedService.js +17 -5
  202. package/build/dist/Server/Services/AlertEpisodeFeedService.js.map +1 -1
  203. package/build/dist/Server/Services/AlertEpisodeService.js +40 -10
  204. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  205. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js +81 -24
  206. package/build/dist/Server/Services/AlertEpisodeStateTimelineService.js.map +1 -1
  207. package/build/dist/Server/Services/AlertFeedService.js +17 -5
  208. package/build/dist/Server/Services/AlertFeedService.js.map +1 -1
  209. package/build/dist/Server/Services/AlertGroupingEngineService.js +44 -28
  210. package/build/dist/Server/Services/AlertGroupingEngineService.js.map +1 -1
  211. package/build/dist/Server/Services/AlertService.js +72 -20
  212. package/build/dist/Server/Services/AlertService.js.map +1 -1
  213. package/build/dist/Server/Services/AlertStateTimelineService.js +36 -13
  214. package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
  215. package/build/dist/Server/Services/AnalyticsDatabaseService.js +52 -28
  216. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  217. package/build/dist/Server/Services/BillingInvoiceService.js +7 -2
  218. package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
  219. package/build/dist/Server/Services/BillingService.js +8 -8
  220. package/build/dist/Server/Services/BillingService.js.map +1 -1
  221. package/build/dist/Server/Services/DashboardDomainService.js +49 -27
  222. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
  223. package/build/dist/Server/Services/DashboardService.js +11 -4
  224. package/build/dist/Server/Services/DashboardService.js.map +1 -1
  225. package/build/dist/Server/Services/DatabaseService.js +32 -12
  226. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  227. package/build/dist/Server/Services/IncidentEpisodeFeedService.js +17 -5
  228. package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -1
  229. package/build/dist/Server/Services/IncidentEpisodeService.js +40 -10
  230. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  231. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +81 -24
  232. package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -1
  233. package/build/dist/Server/Services/IncidentFeedService.js +34 -10
  234. package/build/dist/Server/Services/IncidentFeedService.js.map +1 -1
  235. package/build/dist/Server/Services/IncidentGroupingEngineService.js +43 -29
  236. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  237. package/build/dist/Server/Services/IncidentService.js +116 -28
  238. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  239. package/build/dist/Server/Services/IncidentSlaRuleService.js +19 -11
  240. package/build/dist/Server/Services/IncidentSlaRuleService.js.map +1 -1
  241. package/build/dist/Server/Services/IncidentSlaService.js +21 -14
  242. package/build/dist/Server/Services/IncidentSlaService.js.map +1 -1
  243. package/build/dist/Server/Services/IncidentStateTimelineService.js +130 -37
  244. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  245. package/build/dist/Server/Services/KubernetesClusterService.js +51 -14
  246. package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -1
  247. package/build/dist/Server/Services/LabelService.js +10 -1
  248. package/build/dist/Server/Services/LabelService.js.map +1 -1
  249. package/build/dist/Server/Services/MonitorFeedService.js +34 -10
  250. package/build/dist/Server/Services/MonitorFeedService.js.map +1 -1
  251. package/build/dist/Server/Services/MonitorProbeService.js +23 -3
  252. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  253. package/build/dist/Server/Services/MonitorService.js +42 -11
  254. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  255. package/build/dist/Server/Services/MonitorStatusTimelineService.js +69 -21
  256. package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
  257. package/build/dist/Server/Services/NotificationService.js +4 -3
  258. package/build/dist/Server/Services/NotificationService.js.map +1 -1
  259. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +49 -12
  260. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
  261. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +9 -3
  262. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  263. package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +26 -11
  264. package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
  265. package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js +34 -10
  266. package/build/dist/Server/Services/OnCallDutyPolicyFeedService.js.map +1 -1
  267. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +94 -37
  268. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  269. package/build/dist/Server/Services/OnCallDutyPolicyService.js +1 -1
  270. package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
  271. package/build/dist/Server/Services/OpenTelemetryIngestService.js +45 -17
  272. package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
  273. package/build/dist/Server/Services/ProbeService.js +13 -7
  274. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  275. package/build/dist/Server/Services/ProjectService.js +41 -21
  276. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  277. package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js +17 -5
  278. package/build/dist/Server/Services/ScheduledMaintenanceFeedService.js.map +1 -1
  279. package/build/dist/Server/Services/ScheduledMaintenanceService.js +71 -24
  280. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  281. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +72 -24
  282. package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
  283. package/build/dist/Server/Services/StatusPageDomainService.js +55 -29
  284. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  285. package/build/dist/Server/Services/StatusPageService.js +29 -9
  286. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  287. package/build/dist/Server/Services/StatusPageSubscriberService.js +393 -130
  288. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  289. package/build/dist/Server/Services/TeamMemberService.js +10 -2
  290. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  291. package/build/dist/Server/Services/TelemetryAttributeService.js +83 -6
  292. package/build/dist/Server/Services/TelemetryAttributeService.js.map +1 -1
  293. package/build/dist/Server/Services/UserNotificationRuleService.js +10 -2
  294. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  295. package/build/dist/Server/Services/UserService.js +8 -3
  296. package/build/dist/Server/Services/UserService.js.map +1 -1
  297. package/build/dist/Server/Services/UserWhatsAppService.js +10 -2
  298. package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -1
  299. package/build/dist/Server/Services/WorkflowService.js +7 -2
  300. package/build/dist/Server/Services/WorkflowService.js.map +1 -1
  301. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +367 -180
  302. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  303. package/build/dist/Server/Types/Domain.js +12 -6
  304. package/build/dist/Server/Types/Domain.js.map +1 -1
  305. package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -7
  306. package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
  307. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +11 -4
  308. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
  309. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +7 -0
  310. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  311. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +45 -17
  312. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
  313. package/build/dist/Server/Utils/Express.js.map +1 -1
  314. package/build/dist/Server/Utils/Greenlock/Greenlock.js +36 -29
  315. package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
  316. package/build/dist/Server/Utils/LLM/LLMService.js +18 -6
  317. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  318. package/build/dist/Server/Utils/Logger.js +61 -13
  319. package/build/dist/Server/Utils/Logger.js.map +1 -1
  320. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +23 -20
  321. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  322. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +13 -4
  323. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  324. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +25 -22
  325. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  326. package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +6 -3
  327. package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
  328. package/build/dist/Server/Utils/Profiling.js +9 -6
  329. package/build/dist/Server/Utils/Profiling.js.map +1 -1
  330. package/build/dist/Server/Utils/Realtime.js +50 -34
  331. package/build/dist/Server/Utils/Realtime.js.map +1 -1
  332. package/build/dist/Server/Utils/Response.js +2 -2
  333. package/build/dist/Server/Utils/Response.js.map +1 -1
  334. package/build/dist/Server/Utils/StartServer.js +23 -11
  335. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  336. package/build/dist/Server/Utils/Telemetry/SpanUtil.js +52 -0
  337. package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -0
  338. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +58 -15
  339. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -1
  340. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js +58 -15
  341. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/AlertEpisode.js.map +1 -1
  342. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +19 -5
  343. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -1
  344. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +90 -26
  345. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  346. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +12 -3
  347. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -1
  348. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js +25 -7
  349. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js.map +1 -1
  350. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +58 -19
  351. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -1
  352. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +102 -29
  353. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  354. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +38 -9
  355. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  356. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js +34 -8
  357. package/build/dist/Server/Utils/Workspace/Slack/Actions/AlertEpisode.js.map +1 -1
  358. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +3 -1
  359. package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
  360. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +55 -13
  361. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  362. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +5 -1
  363. package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -1
  364. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +91 -26
  365. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  366. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +355 -270
  367. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  368. package/build/dist/Server/Utils/Workspace/Workspace.js +21 -12
  369. package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
  370. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +3 -1
  371. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  372. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js +9 -2
  373. package/build/dist/Server/Utils/Workspace/WorkspaceMessages/Alert.js.map +1 -1
  374. package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js +1 -1
  375. package/build/dist/Tests/Server/Middleware/UserAuthorization.test.js.map +1 -1
  376. package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js +12 -6
  377. package/build/dist/Tests/Server/Services/AnalyticsDatabaseService.test.js.map +1 -1
  378. package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js +31 -30
  379. package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js.map +1 -1
  380. package/build/dist/UI/Components/Charts/Area/AreaChart.js +20 -2
  381. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  382. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
  383. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  384. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +9 -2
  385. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  386. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +9 -2
  387. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  388. package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js +2 -0
  389. package/build/dist/UI/Components/Charts/ChartLibrary/Types/FormattedExemplarPoint.js.map +1 -0
  390. package/build/dist/UI/Components/Charts/Line/LineChart.js +20 -2
  391. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  392. package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js +2 -0
  393. package/build/dist/UI/Components/Charts/Types/ExemplarPoint.js.map +1 -0
  394. package/build/dist/UI/Components/Dictionary/Dictionary.js +9 -1
  395. package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
  396. package/build/dist/UI/Components/Filters/FiltersForm.js +1 -1
  397. package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
  398. package/build/dist/UI/Components/Filters/JSONFilter.js +1 -1
  399. package/build/dist/UI/Components/Filters/JSONFilter.js.map +1 -1
  400. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +3 -3
  401. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +9 -5
  402. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  403. package/build/dist/UI/Components/Navbar/NavBar.js +9 -1
  404. package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
  405. package/package.json +1 -1
@@ -311,6 +311,7 @@ export class Service extends DatabaseService {
311
311
  }
312
312
  }
313
313
  async archiveWorkspaceChannels(data) {
314
+ var _a;
314
315
  const workspaceTypes = Service.getAllWorkspaceTypes();
315
316
  for (const workspaceType of workspaceTypes) {
316
317
  const notificationRules = await this.getMatchingNotificationRules({
@@ -354,7 +355,9 @@ export class Service extends DatabaseService {
354
355
  },
355
356
  });
356
357
  if (!projectAuth || !projectAuth.authToken) {
357
- logger.debug("No project auth found for workspace type");
358
+ logger.debug("No project auth found for workspace type", {
359
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
360
+ });
358
361
  continue;
359
362
  }
360
363
  await WorkspaceUtil.getWorkspaceTypeUtil(workspaceType).archiveChannels({
@@ -482,8 +485,13 @@ export class Service extends DatabaseService {
482
485
  }
483
486
  }
484
487
  async getWorkspaceChannelsByNotificationFor(data) {
485
- logger.debug("getWorkspaceChannelsByNotificationFor called with data:");
486
- logger.debug(JSON.stringify(data, null, 2));
488
+ var _a, _b, _c, _d;
489
+ logger.debug("getWorkspaceChannelsByNotificationFor called with data:", {
490
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
491
+ });
492
+ logger.debug(JSON.stringify(data, null, 2), {
493
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
494
+ });
487
495
  let monitorChannels = [];
488
496
  if (data.notificationFor.monitorId) {
489
497
  monitorChannels = await MonitorService.getWorkspaceChannelForMonitor({
@@ -535,8 +543,12 @@ export class Service extends DatabaseService {
535
543
  workspaceType: data.workspaceType,
536
544
  });
537
545
  }
538
- logger.debug("Workspace channels found:");
539
- logger.debug(monitorChannels);
546
+ logger.debug("Workspace channels found:", {
547
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
548
+ });
549
+ logger.debug(monitorChannels, {
550
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
551
+ });
540
552
  return monitorChannels;
541
553
  }
542
554
  getNotificationRuleEventType(notificationFor) {
@@ -581,36 +593,56 @@ export class Service extends DatabaseService {
581
593
  throw new BadDataException("Workspace type not supported");
582
594
  }
583
595
  async getExistingChannelNamesBasedOnEventType(data) {
584
- logger.debug("getExistingChannelNamesBasedOnEventType called with data:");
585
- logger.debug(data);
596
+ var _a, _b, _c, _d, _e, _f;
597
+ logger.debug("getExistingChannelNamesBasedOnEventType called with data:", {
598
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
599
+ });
600
+ logger.debug(data, {
601
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
602
+ });
586
603
  const notificationRules = await this.getMatchingNotificationRules({
587
604
  projectId: data.projectId,
588
605
  workspaceType: data.workspaceType,
589
606
  notificationRuleEventType: data.notificationRuleEventType,
590
607
  notificationFor: data.notificationFor,
591
608
  });
592
- logger.debug("Notification rules retrieved:");
593
- logger.debug(notificationRules);
609
+ logger.debug("Notification rules retrieved:", {
610
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
611
+ });
612
+ logger.debug(notificationRules, {
613
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
614
+ });
594
615
  const existingChannels = this.getExistingChannelNamesFromNotificationRules({
595
616
  notificationRules: notificationRules.map((rule) => {
596
617
  return rule.notificationRule;
597
618
  }),
598
619
  workspaceType: data.workspaceType,
599
620
  }) || [];
600
- logger.debug("Existing channels:");
601
- logger.debug(existingChannels);
621
+ logger.debug("Existing channels:", {
622
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
623
+ });
624
+ logger.debug(existingChannels, {
625
+ projectId: (_f = data.projectId) === null || _f === void 0 ? void 0 : _f.toString(),
626
+ });
602
627
  return existingChannels;
603
628
  }
604
629
  async createChannelsAndInviteUsersToChannelsBasedOnRules(data) {
630
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
605
631
  try {
606
- logger.debug("WorkspaceNotificationRuleService.createInviteAndPostToChannelsBasedOnRules");
607
- logger.debug(data);
632
+ logger.debug("WorkspaceNotificationRuleService.createInviteAndPostToChannelsBasedOnRules", { projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString() });
633
+ logger.debug(data, {
634
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
635
+ });
608
636
  const channelsCreated = [];
609
637
  const projectAuths = await WorkspaceProjectAuthTokenService.getProjectAuths({
610
638
  projectId: data.projectId,
611
639
  });
612
- logger.debug("projectAuths");
613
- logger.debug(projectAuths);
640
+ logger.debug("projectAuths", {
641
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
642
+ });
643
+ logger.debug(projectAuths, {
644
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
645
+ });
614
646
  if (!projectAuths || projectAuths.length === 0) {
615
647
  // do nothing.
616
648
  return null;
@@ -631,12 +663,18 @@ export class Service extends DatabaseService {
631
663
  notificationRuleEventType: data.notificationRuleEventType,
632
664
  notificationFor: data.notificationFor,
633
665
  });
634
- logger.debug("notificationRules");
635
- logger.debug(notificationRules);
666
+ logger.debug("notificationRules", {
667
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
668
+ });
669
+ logger.debug(notificationRules, {
670
+ projectId: (_f = data.projectId) === null || _f === void 0 ? void 0 : _f.toString(),
671
+ });
636
672
  if (!notificationRules || notificationRules.length === 0) {
637
673
  return null;
638
674
  }
639
- logger.debug("Creating channels based on rules");
675
+ logger.debug("Creating channels based on rules", {
676
+ projectId: (_g = data.projectId) === null || _g === void 0 ? void 0 : _g.toString(),
677
+ });
640
678
  const createdWorkspaceChannels = await this.createChannelsBasedOnRules({
641
679
  projectId: data.projectId,
642
680
  projectOrUserAuthTokenForWorkspace: authToken,
@@ -646,9 +684,15 @@ export class Service extends DatabaseService {
646
684
  notificationEventType: data.notificationRuleEventType,
647
685
  notificationFor: data.notificationFor,
648
686
  });
649
- logger.debug("createdWorkspaceChannels");
650
- logger.debug(createdWorkspaceChannels);
651
- logger.debug("Inviting users and teams to channels based on rules");
687
+ logger.debug("createdWorkspaceChannels", {
688
+ projectId: (_h = data.projectId) === null || _h === void 0 ? void 0 : _h.toString(),
689
+ });
690
+ logger.debug(createdWorkspaceChannels, {
691
+ projectId: (_j = data.projectId) === null || _j === void 0 ? void 0 : _j.toString(),
692
+ });
693
+ logger.debug("Inviting users and teams to channels based on rules", {
694
+ projectId: (_k = data.projectId) === null || _k === void 0 ? void 0 : _k.toString(),
695
+ });
652
696
  await this.inviteUsersAndTeamsToChannelsBasedOnRules({
653
697
  projectId: data.projectId,
654
698
  projectAuth: projectAuth,
@@ -656,16 +700,20 @@ export class Service extends DatabaseService {
656
700
  notificationRules: notificationRules,
657
701
  notificationChannels: createdWorkspaceChannels,
658
702
  });
659
- logger.debug("Getting existing channel names from notification rules");
703
+ logger.debug("Getting existing channel names from notification rules", { projectId: (_l = data.projectId) === null || _l === void 0 ? void 0 : _l.toString() });
660
704
  const existingChannels = this.getExistingChannelNamesFromNotificationRules({
661
705
  notificationRules: notificationRules.map((rule) => {
662
706
  return rule.notificationRule;
663
707
  }),
664
708
  workspaceType: workspaceType,
665
709
  }) || [];
666
- logger.debug("Existing channels:");
667
- logger.debug(existingChannels);
668
- logger.debug("Adding created channel names to existing channel names");
710
+ logger.debug("Existing channels:", {
711
+ projectId: (_m = data.projectId) === null || _m === void 0 ? void 0 : _m.toString(),
712
+ });
713
+ logger.debug(existingChannels, {
714
+ projectId: (_o = data.projectId) === null || _o === void 0 ? void 0 : _o.toString(),
715
+ });
716
+ logger.debug("Adding created channel names to existing channel names", { projectId: (_p = data.projectId) === null || _p === void 0 ? void 0 : _p.toString() });
669
717
  const allChannelNames = existingChannels.map((c) => {
670
718
  return c.name;
671
719
  });
@@ -674,27 +722,43 @@ export class Service extends DatabaseService {
674
722
  allChannelNames.push(channel.name);
675
723
  }
676
724
  }
677
- logger.debug("Final list of channel names to post messages to:");
678
- logger.debug(allChannelNames);
679
- logger.debug("Posting messages to workspace channels");
680
- logger.debug("Channels created:");
681
- logger.debug(createdWorkspaceChannels);
725
+ logger.debug("Final list of channel names to post messages to:", {
726
+ projectId: (_q = data.projectId) === null || _q === void 0 ? void 0 : _q.toString(),
727
+ });
728
+ logger.debug(allChannelNames, {
729
+ projectId: (_r = data.projectId) === null || _r === void 0 ? void 0 : _r.toString(),
730
+ });
731
+ logger.debug("Posting messages to workspace channels", {
732
+ projectId: (_s = data.projectId) === null || _s === void 0 ? void 0 : _s.toString(),
733
+ });
734
+ logger.debug("Channels created:", {
735
+ projectId: (_t = data.projectId) === null || _t === void 0 ? void 0 : _t.toString(),
736
+ });
737
+ logger.debug(createdWorkspaceChannels, {
738
+ projectId: (_u = data.projectId) === null || _u === void 0 ? void 0 : _u.toString(),
739
+ });
682
740
  channelsCreated.push(...createdWorkspaceChannels);
683
741
  }
684
742
  catch (err) {
685
743
  logger.error("Error in creating channels and inviting users to channels for workspace type " +
686
- projectAuth.workspaceType);
687
- logger.error(err);
744
+ projectAuth.workspaceType, { projectId: (_v = data.projectId) === null || _v === void 0 ? void 0 : _v.toString() });
745
+ logger.error(err, {
746
+ projectId: (_w = data.projectId) === null || _w === void 0 ? void 0 : _w.toString(),
747
+ });
688
748
  }
689
749
  }
690
- logger.debug("Returning created channels");
750
+ logger.debug("Returning created channels", {
751
+ projectId: (_x = data.projectId) === null || _x === void 0 ? void 0 : _x.toString(),
752
+ });
691
753
  return {
692
754
  channelsCreated: channelsCreated,
693
755
  };
694
756
  }
695
757
  catch (err) {
696
- logger.error("Error in createChannelsAndInviteUsersToChannelsBasedOnRules:");
697
- logger.error(err);
758
+ logger.error("Error in createChannelsAndInviteUsersToChannelsBasedOnRules:", { projectId: (_y = data.projectId) === null || _y === void 0 ? void 0 : _y.toString() });
759
+ logger.error(err, {
760
+ projectId: (_z = data.projectId) === null || _z === void 0 ? void 0 : _z.toString(),
761
+ });
698
762
  return null;
699
763
  }
700
764
  }
@@ -737,14 +801,20 @@ export class Service extends DatabaseService {
737
801
  return result;
738
802
  }
739
803
  async inviteUsersAndTeamsToChannelsBasedOnRules(data) {
740
- var _a, _b, _c;
741
- logger.debug("inviteUsersAndTeamsToChannelsBasedOnRules called with data:");
742
- logger.debug(data);
804
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
805
+ logger.debug("inviteUsersAndTeamsToChannelsBasedOnRules called with data:", { projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString() });
806
+ logger.debug(data, {
807
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
808
+ });
743
809
  const inviteUserPayloads = await this.getUsersIdsToInviteToChannel({
744
810
  notificationRules: data.notificationRules,
745
811
  });
746
- logger.debug("User IDs to invite by Workspace Notification Rule ID:");
747
- logger.debug(inviteUserPayloads);
812
+ logger.debug("User IDs to invite by Workspace Notification Rule ID:", {
813
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
814
+ });
815
+ logger.debug(inviteUserPayloads, {
816
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
817
+ });
748
818
  for (const inviteUserPayload of inviteUserPayloads) {
749
819
  const userIds = inviteUserPayload.userIds;
750
820
  const workspaceUserIds = [];
@@ -760,14 +830,18 @@ export class Service extends DatabaseService {
760
830
  else {
761
831
  try {
762
832
  // send a message to channel that user cannot be invited because the account is not connected to workspace.
763
- const channelIds = ((_b = (_a = data.notificationChannels) === null || _a === void 0 ? void 0 : _a.filter((channel) => {
833
+ const channelIds = ((_f = (_e = data.notificationChannels) === null || _e === void 0 ? void 0 : _e.filter((channel) => {
764
834
  return (channel.notificationRuleId ===
765
835
  inviteUserPayload.notificationRuleId);
766
- })) === null || _b === void 0 ? void 0 : _b.map((channel) => {
836
+ })) === null || _f === void 0 ? void 0 : _f.map((channel) => {
767
837
  return channel.id;
768
838
  })) || [];
769
- logger.debug("Channel IDs to send message to:");
770
- logger.debug(channelIds);
839
+ logger.debug("Channel IDs to send message to:", {
840
+ projectId: (_g = data.projectId) === null || _g === void 0 ? void 0 : _g.toString(),
841
+ });
842
+ logger.debug(channelIds, {
843
+ projectId: (_h = data.projectId) === null || _h === void 0 ? void 0 : _h.toString(),
844
+ });
771
845
  const sendMessageData = {
772
846
  userId: data.projectAuth.workspaceProjectId,
773
847
  authToken: data.projectAuth.authToken,
@@ -790,18 +864,26 @@ export class Service extends DatabaseService {
790
864
  };
791
865
  // Add teamId for Microsoft Teams
792
866
  if (data.workspaceType === WorkspaceType.MicrosoftTeams &&
793
- ((_c = data.projectAuth.miscData) === null || _c === void 0 ? void 0 : _c["teamId"])) {
867
+ ((_j = data.projectAuth.miscData) === null || _j === void 0 ? void 0 : _j["teamId"])) {
794
868
  sendMessageData.teamId = data.projectAuth.miscData["teamId"];
795
869
  }
796
870
  await WorkspaceUtil.getWorkspaceTypeUtil(data.workspaceType).sendMessage(sendMessageData);
797
871
  }
798
872
  catch (e) {
799
- logger.error("Error in sending message to channel");
800
- logger.error(e);
873
+ logger.error("Error in sending message to channel", {
874
+ projectId: (_k = data.projectId) === null || _k === void 0 ? void 0 : _k.toString(),
875
+ });
876
+ logger.error(e, {
877
+ projectId: (_l = data.projectId) === null || _l === void 0 ? void 0 : _l.toString(),
878
+ });
801
879
  }
802
880
  }
803
- logger.debug("Workspace User IDs to invite:");
804
- logger.debug(workspaceUserIds);
881
+ logger.debug("Workspace User IDs to invite:", {
882
+ projectId: (_m = data.projectId) === null || _m === void 0 ? void 0 : _m.toString(),
883
+ });
884
+ logger.debug(workspaceUserIds, {
885
+ projectId: (_o = data.projectId) === null || _o === void 0 ? void 0 : _o.toString(),
886
+ });
805
887
  await WorkspaceUtil.getWorkspaceTypeUtil(data.workspaceType).inviteUsersToChannels({
806
888
  authToken: data.projectAuth.authToken,
807
889
  workspaceChannelInvitationPayload: {
@@ -819,20 +901,30 @@ export class Service extends DatabaseService {
819
901
  });
820
902
  }
821
903
  }
822
- logger.debug("Users invited to channels successfully");
904
+ logger.debug("Users invited to channels successfully", {
905
+ projectId: (_p = data.projectId) === null || _p === void 0 ? void 0 : _p.toString(),
906
+ });
823
907
  }
824
908
  async inviteUsersBasedOnRulesAndWorkspaceChannels(data) {
825
- var _a;
909
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
826
910
  // if no rules then return.
827
911
  if (data.notificationRules.length === 0) {
828
- logger.debug("No notification rules found. Returning.");
912
+ logger.debug("No notification rules found. Returning.", {
913
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
914
+ });
829
915
  return;
830
916
  }
831
- logger.debug("inviteUsersBasedOnRulesAndWorkspaceChannels called with data:");
832
- logger.debug(data);
917
+ logger.debug("inviteUsersBasedOnRulesAndWorkspaceChannels called with data:", { projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString() });
918
+ logger.debug(data, {
919
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
920
+ });
833
921
  const userIds = data.userIds;
834
- logger.debug("Users:");
835
- logger.debug(userIds);
922
+ logger.debug("Users:", {
923
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
924
+ });
925
+ logger.debug(userIds, {
926
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
927
+ });
836
928
  // get all Workspaces.
837
929
  const workspaceTypes = Service.getAllWorkspaceTypes();
838
930
  for (const workspaceType of workspaceTypes) {
@@ -840,18 +932,28 @@ export class Service extends DatabaseService {
840
932
  const notificationRules = data.notificationRules.filter((rule) => {
841
933
  return rule.workspaceType === workspaceType;
842
934
  });
843
- logger.debug("Notification rules for workspace type:");
844
- logger.debug(notificationRules);
935
+ logger.debug("Notification rules for workspace type:", {
936
+ projectId: (_f = data.projectId) === null || _f === void 0 ? void 0 : _f.toString(),
937
+ });
938
+ logger.debug(notificationRules, {
939
+ projectId: (_g = data.projectId) === null || _g === void 0 ? void 0 : _g.toString(),
940
+ });
845
941
  const channelsToInviteToBasedOnRule = data.workspaceChannels.filter((channel) => {
846
942
  return notificationRules.find((rule) => {
847
943
  var _a;
848
944
  return ((_a = rule.id) === null || _a === void 0 ? void 0 : _a.toString()) === channel.notificationRuleId;
849
945
  });
850
946
  });
851
- logger.debug("Channels to invite to based on rule:");
852
- logger.debug(channelsToInviteToBasedOnRule);
947
+ logger.debug("Channels to invite to based on rule:", {
948
+ projectId: (_h = data.projectId) === null || _h === void 0 ? void 0 : _h.toString(),
949
+ });
950
+ logger.debug(channelsToInviteToBasedOnRule, {
951
+ projectId: (_j = data.projectId) === null || _j === void 0 ? void 0 : _j.toString(),
952
+ });
853
953
  if (channelsToInviteToBasedOnRule.length === 0) {
854
- logger.debug("No channels to invite to based on rule.");
954
+ logger.debug("No channels to invite to based on rule.", {
955
+ projectId: (_k = data.projectId) === null || _k === void 0 ? void 0 : _k.toString(),
956
+ });
855
957
  continue;
856
958
  }
857
959
  // get auth token for workspace.
@@ -868,7 +970,9 @@ export class Service extends DatabaseService {
868
970
  },
869
971
  });
870
972
  if (!projectAuth) {
871
- logger.debug("No project auth found for workspace type");
973
+ logger.debug("No project auth found for workspace type", {
974
+ projectId: (_l = data.projectId) === null || _l === void 0 ? void 0 : _l.toString(),
975
+ });
872
976
  continue;
873
977
  }
874
978
  // inivte users to channels.
@@ -888,8 +992,12 @@ export class Service extends DatabaseService {
888
992
  const channelIds = channelsToInviteToBasedOnRule.map((channel) => {
889
993
  return channel.id;
890
994
  });
891
- logger.debug("Channel IDs to send message to:");
892
- logger.debug(channelIds);
995
+ logger.debug("Channel IDs to send message to:", {
996
+ projectId: (_m = data.projectId) === null || _m === void 0 ? void 0 : _m.toString(),
997
+ });
998
+ logger.debug(channelIds, {
999
+ projectId: (_o = data.projectId) === null || _o === void 0 ? void 0 : _o.toString(),
1000
+ });
893
1001
  const sendMessageData = {
894
1002
  userId: projectAuth.workspaceProjectId,
895
1003
  authToken: projectAuth.authToken,
@@ -912,24 +1020,36 @@ export class Service extends DatabaseService {
912
1020
  };
913
1021
  // Add teamId for Microsoft Teams
914
1022
  if (workspaceType === WorkspaceType.MicrosoftTeams &&
915
- ((_a = projectAuth.miscData) === null || _a === void 0 ? void 0 : _a["teamId"])) {
1023
+ ((_p = projectAuth.miscData) === null || _p === void 0 ? void 0 : _p["teamId"])) {
916
1024
  sendMessageData.teamId = projectAuth.miscData["teamId"];
917
1025
  }
918
1026
  await WorkspaceUtil.getWorkspaceTypeUtil(workspaceType).sendMessage(sendMessageData);
919
1027
  }
920
1028
  catch (e) {
921
- logger.error("Error in sending message to channel");
922
- logger.error(e);
1029
+ logger.error("Error in sending message to channel", {
1030
+ projectId: (_q = data.projectId) === null || _q === void 0 ? void 0 : _q.toString(),
1031
+ });
1032
+ logger.error(e, {
1033
+ projectId: (_r = data.projectId) === null || _r === void 0 ? void 0 : _r.toString(),
1034
+ });
923
1035
  }
924
1036
  }
925
1037
  }
926
- logger.debug("Workspace User IDs to invite:");
927
- logger.debug(workspaceUserIds);
1038
+ logger.debug("Workspace User IDs to invite:", {
1039
+ projectId: (_s = data.projectId) === null || _s === void 0 ? void 0 : _s.toString(),
1040
+ });
1041
+ logger.debug(workspaceUserIds, {
1042
+ projectId: (_t = data.projectId) === null || _t === void 0 ? void 0 : _t.toString(),
1043
+ });
928
1044
  const channelNames = channelsToInviteToBasedOnRule.map((channel) => {
929
1045
  return channel.name;
930
1046
  });
931
- logger.debug("Channel names to invite to:");
932
- logger.debug(channelNames);
1047
+ logger.debug("Channel names to invite to:", {
1048
+ projectId: (_u = data.projectId) === null || _u === void 0 ? void 0 : _u.toString(),
1049
+ });
1050
+ logger.debug(channelNames, {
1051
+ projectId: (_v = data.projectId) === null || _v === void 0 ? void 0 : _v.toString(),
1052
+ });
933
1053
  await WorkspaceUtil.getWorkspaceTypeUtil(workspaceType).inviteUsersToChannels({
934
1054
  authToken: projectAuth.authToken,
935
1055
  workspaceChannelInvitationPayload: {
@@ -956,21 +1076,32 @@ export class Service extends DatabaseService {
956
1076
  }
957
1077
  }
958
1078
  catch (err) {
959
- logger.error("Error logging user invitations:");
960
- logger.error(err);
1079
+ logger.error("Error logging user invitations:", {
1080
+ projectId: (_w = data.projectId) === null || _w === void 0 ? void 0 : _w.toString(),
1081
+ });
1082
+ logger.error(err, {
1083
+ projectId: (_x = data.projectId) === null || _x === void 0 ? void 0 : _x.toString(),
1084
+ });
961
1085
  // Don't throw the error, just log it so the main flow continues
962
1086
  }
963
1087
  }
964
1088
  }
965
1089
  async inviteTeamsBasedOnRulesAndWorkspaceChannels(data) {
1090
+ var _a, _b, _c;
966
1091
  // if no rules then return.
967
1092
  if (data.notificationRules.length === 0) {
968
- logger.debug("No notification rules found. Returning.");
1093
+ logger.debug("No notification rules found. Returning.", {
1094
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
1095
+ });
969
1096
  return;
970
1097
  }
971
1098
  const usersInTeam = await TeamMemberService.getUsersInTeams(data.teamIds);
972
- logger.debug("Users in teams:");
973
- logger.debug(usersInTeam);
1099
+ logger.debug("Users in teams:", {
1100
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
1101
+ });
1102
+ logger.debug(usersInTeam, {
1103
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
1104
+ });
974
1105
  return this.inviteUsersBasedOnRulesAndWorkspaceChannels({
975
1106
  workspaceChannels: data.workspaceChannels,
976
1107
  projectId: data.projectId,
@@ -981,9 +1112,13 @@ export class Service extends DatabaseService {
981
1112
  });
982
1113
  }
983
1114
  async getWorkspaceUserIdFromOneUptimeUserId(data) {
984
- var _a;
985
- logger.debug("getWorkspaceUserIdFromOneUptimeUserId called with data:");
986
- logger.debug(data);
1115
+ var _a, _b, _c, _d, _e, _f;
1116
+ logger.debug("getWorkspaceUserIdFromOneUptimeUserId called with data:", {
1117
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
1118
+ });
1119
+ logger.debug(data, {
1120
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
1121
+ });
987
1122
  const userAuth = await WorkspaceUserAuthTokenService.findOneBy({
988
1123
  query: {
989
1124
  projectId: data.projectId,
@@ -998,17 +1133,27 @@ export class Service extends DatabaseService {
998
1133
  },
999
1134
  });
1000
1135
  if (!userAuth) {
1001
- logger.debug("No userAuth found for given data");
1136
+ logger.debug("No userAuth found for given data", {
1137
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
1138
+ });
1002
1139
  return null;
1003
1140
  }
1004
- logger.debug("Found userAuth:");
1005
- logger.debug(userAuth);
1006
- return ((_a = userAuth.workspaceUserId) === null || _a === void 0 ? void 0 : _a.toString()) || null;
1141
+ logger.debug("Found userAuth:", {
1142
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
1143
+ });
1144
+ logger.debug(userAuth, {
1145
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
1146
+ });
1147
+ return ((_f = userAuth.workspaceUserId) === null || _f === void 0 ? void 0 : _f.toString()) || null;
1007
1148
  }
1008
1149
  async createChannelsBasedOnRules(data) {
1009
- var _a, _b, _c, _d, _e;
1010
- logger.debug("createChannelsBasedOnRules called with data:");
1011
- logger.debug(data);
1150
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1151
+ logger.debug("createChannelsBasedOnRules called with data:", {
1152
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
1153
+ });
1154
+ logger.debug(data, {
1155
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
1156
+ });
1012
1157
  const createdWorkspaceChannels = [];
1013
1158
  const createdChannelNames = [];
1014
1159
  const notificationChannels = this.getnotificationChannelssFromNotificationRules({
@@ -1016,8 +1161,12 @@ export class Service extends DatabaseService {
1016
1161
  channelNameSiffix: data.channelNameSiffix,
1017
1162
  notificationEventType: data.notificationEventType,
1018
1163
  });
1019
- logger.debug("New channel names to be created:");
1020
- logger.debug(notificationChannels);
1164
+ logger.debug("New channel names to be created:", {
1165
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
1166
+ });
1167
+ logger.debug(notificationChannels, {
1168
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
1169
+ });
1021
1170
  // Get project auth to access teamId for Microsoft Teams
1022
1171
  const projectAuth = await WorkspaceProjectAuthTokenService.getProjectAuth({
1023
1172
  projectId: data.projectId,
@@ -1027,17 +1176,19 @@ export class Service extends DatabaseService {
1027
1176
  throw new BadDataException("Project auth not found for workspace type " + data.workspaceType);
1028
1177
  }
1029
1178
  if (!notificationChannels || notificationChannels.length === 0) {
1030
- logger.debug("No new channel names found. Returning empty array.");
1179
+ logger.debug("No new channel names found. Returning empty array.", {
1180
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
1181
+ });
1031
1182
  return [];
1032
1183
  }
1033
1184
  for (const notificationChannel of notificationChannels) {
1034
1185
  if (createdChannelNames.filter((name) => {
1035
1186
  return name === notificationChannel.channelName;
1036
1187
  }).length > 0) {
1037
- logger.debug(`Channel name ${notificationChannel.channelName} already created. Skipping.`);
1188
+ logger.debug(`Channel name ${notificationChannel.channelName} already created. Skipping.`, { projectId: (_f = data.projectId) === null || _f === void 0 ? void 0 : _f.toString() });
1038
1189
  continue;
1039
1190
  }
1040
- logger.debug(`Creating new channel with name: ${notificationChannel.channelName}`);
1191
+ logger.debug(`Creating new channel with name: ${notificationChannel.channelName}`, { projectId: (_g = data.projectId) === null || _g === void 0 ? void 0 : _g.toString() });
1041
1192
  const createChannelData = {
1042
1193
  authToken: data.projectOrUserAuthTokenForWorkspace,
1043
1194
  channelName: notificationChannel.channelName,
@@ -1047,7 +1198,7 @@ export class Service extends DatabaseService {
1047
1198
  createChannelData.teamId = notificationChannel.teamId;
1048
1199
  }
1049
1200
  else if (data.workspaceType === WorkspaceType.MicrosoftTeams &&
1050
- ((_a = projectAuth.miscData) === null || _a === void 0 ? void 0 : _a["teamId"])) {
1201
+ ((_h = projectAuth.miscData) === null || _h === void 0 ? void 0 : _h["teamId"])) {
1051
1202
  createChannelData.teamId = projectAuth.miscData["teamId"];
1052
1203
  }
1053
1204
  // Ensure teamId is set for Microsoft Teams
@@ -1057,8 +1208,12 @@ export class Service extends DatabaseService {
1057
1208
  }
1058
1209
  const channel = await WorkspaceUtil.getWorkspaceTypeUtil(data.workspaceType).createChannel(createChannelData);
1059
1210
  const notificationWorkspaceChannel = Object.assign(Object.assign({}, channel), { notificationRuleId: notificationChannel.notificationRuleId });
1060
- logger.debug("Channel created:");
1061
- logger.debug(channel);
1211
+ logger.debug("Channel created:", {
1212
+ projectId: (_j = data.projectId) === null || _j === void 0 ? void 0 : _j.toString(),
1213
+ });
1214
+ logger.debug(channel, {
1215
+ projectId: (_k = data.projectId) === null || _k === void 0 ? void 0 : _k.toString(),
1216
+ });
1062
1217
  // Log the channel creation
1063
1218
  try {
1064
1219
  const logData = {
@@ -1068,17 +1223,17 @@ export class Service extends DatabaseService {
1068
1223
  channelName: channel.name,
1069
1224
  };
1070
1225
  // Add resource associations only if they exist
1071
- if ((_b = data.notificationFor) === null || _b === void 0 ? void 0 : _b.incidentId) {
1226
+ if ((_l = data.notificationFor) === null || _l === void 0 ? void 0 : _l.incidentId) {
1072
1227
  logData.incidentId = data.notificationFor.incidentId;
1073
1228
  }
1074
- if ((_c = data.notificationFor) === null || _c === void 0 ? void 0 : _c.alertId) {
1229
+ if ((_m = data.notificationFor) === null || _m === void 0 ? void 0 : _m.alertId) {
1075
1230
  logData.alertId = data.notificationFor.alertId;
1076
1231
  }
1077
- if ((_d = data.notificationFor) === null || _d === void 0 ? void 0 : _d.scheduledMaintenanceId) {
1232
+ if ((_o = data.notificationFor) === null || _o === void 0 ? void 0 : _o.scheduledMaintenanceId) {
1078
1233
  logData.scheduledMaintenanceId =
1079
1234
  data.notificationFor.scheduledMaintenanceId;
1080
1235
  }
1081
- if ((_e = data.notificationFor) === null || _e === void 0 ? void 0 : _e.onCallDutyPolicyId) {
1236
+ if ((_p = data.notificationFor) === null || _p === void 0 ? void 0 : _p.onCallDutyPolicyId) {
1082
1237
  logData.onCallDutyPolicyId = data.notificationFor.onCallDutyPolicyId;
1083
1238
  }
1084
1239
  await WorkspaceNotificationLogService.logCreateChannel(logData, {
@@ -1086,15 +1241,23 @@ export class Service extends DatabaseService {
1086
1241
  });
1087
1242
  }
1088
1243
  catch (err) {
1089
- logger.error("Error logging channel creation:");
1090
- logger.error(err);
1244
+ logger.error("Error logging channel creation:", {
1245
+ projectId: (_q = data.projectId) === null || _q === void 0 ? void 0 : _q.toString(),
1246
+ });
1247
+ logger.error(err, {
1248
+ projectId: (_r = data.projectId) === null || _r === void 0 ? void 0 : _r.toString(),
1249
+ });
1091
1250
  // Don't throw the error, just log it so the main flow continues
1092
1251
  }
1093
1252
  createdChannelNames.push(channel.name);
1094
1253
  createdWorkspaceChannels.push(notificationWorkspaceChannel);
1095
1254
  }
1096
- logger.debug("Returning created workspace channels:");
1097
- logger.debug(createdWorkspaceChannels);
1255
+ logger.debug("Returning created workspace channels:", {
1256
+ projectId: (_s = data.projectId) === null || _s === void 0 ? void 0 : _s.toString(),
1257
+ });
1258
+ logger.debug(createdWorkspaceChannels, {
1259
+ projectId: (_t = data.projectId) === null || _t === void 0 ? void 0 : _t.toString(),
1260
+ });
1098
1261
  return createdWorkspaceChannels;
1099
1262
  }
1100
1263
  async getUsersIdsToInviteToChannel(data) {
@@ -1109,8 +1272,8 @@ export class Service extends DatabaseService {
1109
1272
  if (workspaceRules.inviteUsersToNewChannel &&
1110
1273
  workspaceRules.inviteUsersToNewChannel.length > 0) {
1111
1274
  const userIds = workspaceRules.inviteUsersToNewChannel || [];
1112
- logger.debug("User IDs to invite from rule:");
1113
- logger.debug(userIds);
1275
+ logger.debug("User IDs to invite from rule:", {});
1276
+ logger.debug(userIds, {});
1114
1277
  for (const userId of userIds) {
1115
1278
  if (!inviteUserIds.find((id) => {
1116
1279
  return id.toString() === userId.toString();
@@ -1125,11 +1288,11 @@ export class Service extends DatabaseService {
1125
1288
  teamIds = teamIds.map((teamId) => {
1126
1289
  return new ObjectID(teamId.toString());
1127
1290
  });
1128
- logger.debug("Team IDs to invite from rule:");
1129
- logger.debug(teamIds);
1291
+ logger.debug("Team IDs to invite from rule:", {});
1292
+ logger.debug(teamIds, {});
1130
1293
  const usersInTeam = await TeamMemberService.getUsersInTeams(teamIds);
1131
- logger.debug("Users in teams:");
1132
- logger.debug(usersInTeam);
1294
+ logger.debug("Users in teams:", {});
1295
+ logger.debug(usersInTeam, {});
1133
1296
  for (const user of usersInTeam) {
1134
1297
  if (!inviteUserIds.find((id) => {
1135
1298
  var _a;
@@ -1150,23 +1313,23 @@ export class Service extends DatabaseService {
1150
1313
  });
1151
1314
  }
1152
1315
  }
1153
- logger.debug("Final list of user IDs to invite:");
1154
- logger.debug(result);
1316
+ logger.debug("Final list of user IDs to invite:", {});
1317
+ logger.debug(result, {});
1155
1318
  return result;
1156
1319
  }
1157
1320
  getExistingChannelNamesFromNotificationRules(data) {
1158
- logger.debug("getExistingChannelNamesFromNotificationRules called with data:");
1159
- logger.debug(data);
1321
+ logger.debug("getExistingChannelNamesFromNotificationRules called with data:", {});
1322
+ logger.debug(data, {});
1160
1323
  const channels = [];
1161
1324
  for (const notificationRule of data.notificationRules) {
1162
1325
  const workspaceRules = notificationRule;
1163
1326
  if (workspaceRules.shouldPostToExistingChannel) {
1164
1327
  const existingChannelNames = workspaceRules.existingChannelNames.split(",");
1165
- logger.debug("Existing channel names from rule:");
1166
- logger.debug(existingChannelNames);
1328
+ logger.debug("Existing channel names from rule:", {});
1329
+ logger.debug(existingChannelNames, {});
1167
1330
  for (const channelName of existingChannelNames) {
1168
1331
  if (!channelName) {
1169
- logger.debug("Empty channel name found. Skipping.");
1332
+ logger.debug("Empty channel name found. Skipping.", {});
1170
1333
  continue;
1171
1334
  }
1172
1335
  const channel = Object.assign({ id: channelName, name: channelName, workspaceType: data.workspaceType }, (workspaceRules.existingTeam && {
@@ -1180,23 +1343,23 @@ export class Service extends DatabaseService {
1180
1343
  }
1181
1344
  }
1182
1345
  }
1183
- logger.debug("Final list of existing channels:");
1184
- logger.debug(channels);
1346
+ logger.debug("Final list of existing channels:", {});
1347
+ logger.debug(channels, {});
1185
1348
  return channels;
1186
1349
  }
1187
1350
  getnotificationChannelssFromNotificationRules(data) {
1188
- logger.debug("getnotificationChannelssFromNotificationRules called with data:");
1189
- logger.debug(data);
1351
+ logger.debug("getnotificationChannelssFromNotificationRules called with data:", {});
1352
+ logger.debug(data, {});
1190
1353
  const channels = [];
1191
1354
  for (const notificationRule of data.notificationRules) {
1192
1355
  const workspaceRules = notificationRule.notificationRule;
1193
- logger.debug("Processing notification rule:");
1194
- logger.debug(workspaceRules);
1356
+ logger.debug("Processing notification rule:", {});
1357
+ logger.debug(workspaceRules, {});
1195
1358
  if (workspaceRules.shouldCreateNewChannel) {
1196
1359
  const notificationChannels = workspaceRules.newChannelTemplateName ||
1197
1360
  `oneuptime-${data.notificationEventType.toLowerCase()}-`;
1198
- logger.debug("New channel template name:");
1199
- logger.debug(notificationChannels);
1361
+ logger.debug("New channel template name:", {});
1362
+ logger.debug(notificationChannels, {});
1200
1363
  /*
1201
1364
  * Sanitize the suffix for workspace channel names.
1202
1365
  * When no custom prefix is set, the default "#" prefix (e.g. "#42") produces
@@ -1208,8 +1371,8 @@ export class Service extends DatabaseService {
1208
1371
  .replace(/[^a-z0-9\-_]/g, "");
1209
1372
  // add suffix and then check if it is already added or not.
1210
1373
  const channelName = notificationChannels + sanitizedSuffix;
1211
- logger.debug("Final channel name with suffix:");
1212
- logger.debug(channelName);
1374
+ logger.debug("Final channel name with suffix:", {});
1375
+ logger.debug(channelName, {});
1213
1376
  if (channels.filter((name) => {
1214
1377
  return name.channelName === channelName;
1215
1378
  }).length === 0) {
@@ -1222,20 +1385,25 @@ export class Service extends DatabaseService {
1222
1385
  channelData.teamId = workspaceRules.teamToCreateChannelIn;
1223
1386
  }
1224
1387
  channels.push(channelData);
1225
- logger.debug(`Channel name ${channelName} added to the list.`);
1388
+ logger.debug(`Channel name ${channelName} added to the list.`, {});
1226
1389
  }
1227
1390
  else {
1228
- logger.debug(`Channel name ${channelName} already exists in the list. Skipping.`);
1391
+ logger.debug(`Channel name ${channelName} already exists in the list. Skipping.`, {});
1229
1392
  }
1230
1393
  }
1231
1394
  }
1232
- logger.debug("Final list of new channel names:");
1233
- logger.debug(channels);
1395
+ logger.debug("Final list of new channel names:", {});
1396
+ logger.debug(channels, {});
1234
1397
  return channels;
1235
1398
  }
1236
1399
  async getNotificationRules(data) {
1237
- logger.debug("getNotificationRules called with data:");
1238
- logger.debug(data);
1400
+ var _a, _b, _c, _d;
1401
+ logger.debug("getNotificationRules called with data:", {
1402
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
1403
+ });
1404
+ logger.debug(data, {
1405
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
1406
+ });
1239
1407
  const notificationRules = await this.findBy({
1240
1408
  query: {
1241
1409
  projectId: data.projectId,
@@ -1253,17 +1421,21 @@ export class Service extends DatabaseService {
1253
1421
  skip: 0,
1254
1422
  limit: LIMIT_PER_PROJECT,
1255
1423
  });
1256
- logger.debug("Notification rules retrieved:");
1257
- logger.debug(notificationRules);
1424
+ logger.debug("Notification rules retrieved:", {
1425
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
1426
+ });
1427
+ logger.debug(notificationRules, {
1428
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
1429
+ });
1258
1430
  return notificationRules;
1259
1431
  }
1260
1432
  async getValuesBasedOnNotificationFor(data) {
1261
1433
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
1262
- logger.debug("getValuesBasedOnNotificationFor called with data:");
1263
- logger.debug(data);
1434
+ logger.debug("getValuesBasedOnNotificationFor called with data:", {});
1435
+ logger.debug(data, {});
1264
1436
  if (data.notificationFor.incidentId) {
1265
- logger.debug("Fetching incident details for incident ID:");
1266
- logger.debug(data.notificationFor.incidentId);
1437
+ logger.debug("Fetching incident details for incident ID:", {});
1438
+ logger.debug(data.notificationFor.incidentId, {});
1267
1439
  const incident = await IncidentService.findOneById({
1268
1440
  id: data.notificationFor.incidentId,
1269
1441
  select: {
@@ -1279,19 +1451,19 @@ export class Service extends DatabaseService {
1279
1451
  },
1280
1452
  });
1281
1453
  if (!incident) {
1282
- logger.debug("Incident not found for ID:");
1283
- logger.debug(data.notificationFor.incidentId);
1454
+ logger.debug("Incident not found for ID:", {});
1455
+ logger.debug(data.notificationFor.incidentId, {});
1284
1456
  throw new BadDataException("Incident ID not found");
1285
1457
  }
1286
- logger.debug("Incident details retrieved:");
1287
- logger.debug(incident);
1458
+ logger.debug("Incident details retrieved:", {});
1459
+ logger.debug(incident, {});
1288
1460
  const monitorLabels = await MonitorService.getLabelsForMonitors({
1289
1461
  monitorIds: ((_a = incident.monitors) === null || _a === void 0 ? void 0 : _a.map((monitor) => {
1290
1462
  return monitor.id;
1291
1463
  })) || [],
1292
1464
  });
1293
- logger.debug("Monitor labels retrieved:");
1294
- logger.debug(monitorLabels);
1465
+ logger.debug("Monitor labels retrieved:", {});
1466
+ logger.debug(monitorLabels, {});
1295
1467
  return {
1296
1468
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
1297
1469
  [NotificationRuleConditionCheckOn.IncidentTitle]: incident.title || "",
@@ -1337,8 +1509,8 @@ export class Service extends DatabaseService {
1337
1509
  };
1338
1510
  }
1339
1511
  if (data.notificationFor.alertId) {
1340
- logger.debug("Fetching alert details for alert ID:");
1341
- logger.debug(data.notificationFor.alertId);
1512
+ logger.debug("Fetching alert details for alert ID:", {});
1513
+ logger.debug(data.notificationFor.alertId, {});
1342
1514
  const alert = await AlertService.findOneById({
1343
1515
  id: data.notificationFor.alertId,
1344
1516
  select: {
@@ -1354,17 +1526,17 @@ export class Service extends DatabaseService {
1354
1526
  },
1355
1527
  });
1356
1528
  if (!alert) {
1357
- logger.debug("Alert not found for ID:");
1358
- logger.debug(data.notificationFor.alertId);
1529
+ logger.debug("Alert not found for ID:", {});
1530
+ logger.debug(data.notificationFor.alertId, {});
1359
1531
  throw new BadDataException("Alert ID not found");
1360
1532
  }
1361
- logger.debug("Alert details retrieved:");
1362
- logger.debug(alert);
1533
+ logger.debug("Alert details retrieved:", {});
1534
+ logger.debug(alert, {});
1363
1535
  const monitorLabels = await MonitorService.getLabelsForMonitors({
1364
1536
  monitorIds: ((_h = alert === null || alert === void 0 ? void 0 : alert.monitor) === null || _h === void 0 ? void 0 : _h.id) ? [(_j = alert === null || alert === void 0 ? void 0 : alert.monitor) === null || _j === void 0 ? void 0 : _j.id] : [],
1365
1537
  });
1366
- logger.debug("Monitor labels retrieved:");
1367
- logger.debug(monitorLabels);
1538
+ logger.debug("Monitor labels retrieved:", {});
1539
+ logger.debug(monitorLabels, {});
1368
1540
  return {
1369
1541
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
1370
1542
  [NotificationRuleConditionCheckOn.IncidentTitle]: undefined,
@@ -1409,8 +1581,8 @@ export class Service extends DatabaseService {
1409
1581
  };
1410
1582
  }
1411
1583
  if (data.notificationFor.scheduledMaintenanceId) {
1412
- logger.debug("Fetching scheduled maintenance details for ID:");
1413
- logger.debug(data.notificationFor.scheduledMaintenanceId);
1584
+ logger.debug("Fetching scheduled maintenance details for ID:", {});
1585
+ logger.debug(data.notificationFor.scheduledMaintenanceId, {});
1414
1586
  const scheduledMaintenance = await ScheduledMaintenanceService.findOneById({
1415
1587
  id: data.notificationFor.scheduledMaintenanceId,
1416
1588
  select: {
@@ -1425,19 +1597,19 @@ export class Service extends DatabaseService {
1425
1597
  },
1426
1598
  });
1427
1599
  if (!scheduledMaintenance) {
1428
- logger.debug("Scheduled maintenance not found for ID:");
1429
- logger.debug(data.notificationFor.scheduledMaintenanceId);
1600
+ logger.debug("Scheduled maintenance not found for ID:", {});
1601
+ logger.debug(data.notificationFor.scheduledMaintenanceId, {});
1430
1602
  throw new BadDataException("Scheduled Maintenance ID not found");
1431
1603
  }
1432
- logger.debug("Scheduled maintenance details retrieved:");
1433
- logger.debug(scheduledMaintenance);
1604
+ logger.debug("Scheduled maintenance details retrieved:", {});
1605
+ logger.debug(scheduledMaintenance, {});
1434
1606
  const monitorLabels = await MonitorService.getLabelsForMonitors({
1435
1607
  monitorIds: ((_r = scheduledMaintenance.monitors) === null || _r === void 0 ? void 0 : _r.map((monitor) => {
1436
1608
  return monitor.id;
1437
1609
  })) || [],
1438
1610
  });
1439
- logger.debug("Monitor labels retrieved:");
1440
- logger.debug(monitorLabels);
1611
+ logger.debug("Monitor labels retrieved:", {});
1612
+ logger.debug(monitorLabels, {});
1441
1613
  return {
1442
1614
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
1443
1615
  [NotificationRuleConditionCheckOn.IncidentTitle]: undefined,
@@ -1484,8 +1656,8 @@ export class Service extends DatabaseService {
1484
1656
  };
1485
1657
  }
1486
1658
  if (data.notificationFor.monitorId) {
1487
- logger.debug("Fetching monitor status timeline details for ID:");
1488
- logger.debug(data.notificationFor.monitorId);
1659
+ logger.debug("Fetching monitor status timeline details for ID:", {});
1660
+ logger.debug(data.notificationFor.monitorId, {});
1489
1661
  const monitor = await MonitorService.findOneById({
1490
1662
  id: data.notificationFor.monitorId,
1491
1663
  select: {
@@ -1499,8 +1671,8 @@ export class Service extends DatabaseService {
1499
1671
  },
1500
1672
  });
1501
1673
  if (!monitor) {
1502
- logger.debug("Monitor not found for ID:");
1503
- logger.debug(data.notificationFor.monitorId);
1674
+ logger.debug("Monitor not found for ID:", {});
1675
+ logger.debug(data.notificationFor.monitorId, {});
1504
1676
  throw new BadDataException(ExceptionMessages.MonitorNotFound);
1505
1677
  }
1506
1678
  const monitorLabels = (monitor === null || monitor === void 0 ? void 0 : monitor.labels) || [];
@@ -1545,8 +1717,8 @@ export class Service extends DatabaseService {
1545
1717
  };
1546
1718
  }
1547
1719
  if (data.notificationFor.onCallDutyPolicyId) {
1548
- logger.debug("Fetching on call policy details for ID:");
1549
- logger.debug(data.notificationFor.onCallDutyPolicyId);
1720
+ logger.debug("Fetching on call policy details for ID:", {});
1721
+ logger.debug(data.notificationFor.onCallDutyPolicyId, {});
1550
1722
  const onCallDutyPolicy = await OnCallDutyPolicyService.findOneById({
1551
1723
  id: data.notificationFor.onCallDutyPolicyId,
1552
1724
  select: {
@@ -1559,8 +1731,8 @@ export class Service extends DatabaseService {
1559
1731
  },
1560
1732
  });
1561
1733
  if (!onCallDutyPolicy) {
1562
- logger.debug("On Call Duty Policy not found for ID:");
1563
- logger.debug(data.notificationFor.onCallDutyPolicyId);
1734
+ logger.debug("On Call Duty Policy not found for ID:", {});
1735
+ logger.debug(data.notificationFor.onCallDutyPolicyId, {});
1564
1736
  throw new BadDataException("On Call Duty Policy ID not found");
1565
1737
  }
1566
1738
  const onCallDutyPolicyLabels = (onCallDutyPolicy === null || onCallDutyPolicy === void 0 ? void 0 : onCallDutyPolicy.labels) || [];
@@ -1604,8 +1776,8 @@ export class Service extends DatabaseService {
1604
1776
  }
1605
1777
  // Handle Incident Episode
1606
1778
  if (data.notificationFor.incidentEpisodeId) {
1607
- logger.debug("Fetching incident episode details for ID:");
1608
- logger.debug(data.notificationFor.incidentEpisodeId);
1779
+ logger.debug("Fetching incident episode details for ID:", {});
1780
+ logger.debug(data.notificationFor.incidentEpisodeId, {});
1609
1781
  const incidentEpisode = await IncidentEpisodeService.findOneById({
1610
1782
  id: data.notificationFor.incidentEpisodeId,
1611
1783
  select: {
@@ -1620,12 +1792,12 @@ export class Service extends DatabaseService {
1620
1792
  },
1621
1793
  });
1622
1794
  if (!incidentEpisode) {
1623
- logger.debug("Incident Episode not found for ID:");
1624
- logger.debug(data.notificationFor.incidentEpisodeId);
1795
+ logger.debug("Incident Episode not found for ID:", {});
1796
+ logger.debug(data.notificationFor.incidentEpisodeId, {});
1625
1797
  throw new BadDataException("Incident Episode ID not found");
1626
1798
  }
1627
- logger.debug("Incident Episode details retrieved:");
1628
- logger.debug(incidentEpisode);
1799
+ logger.debug("Incident Episode details retrieved:", {});
1800
+ logger.debug(incidentEpisode, {});
1629
1801
  return {
1630
1802
  [NotificationRuleConditionCheckOn.MonitorName]: undefined,
1631
1803
  [NotificationRuleConditionCheckOn.IncidentTitle]: undefined,
@@ -1667,30 +1839,45 @@ export class Service extends DatabaseService {
1667
1839
  throw new BadDataException("NotificationFor is not supported");
1668
1840
  }
1669
1841
  async getMatchingNotificationRules(data) {
1842
+ var _a, _b, _c, _d, _e, _f, _g;
1670
1843
  const notificationRules = await this.getNotificationRules({
1671
1844
  projectId: data.projectId,
1672
1845
  workspaceType: data.workspaceType,
1673
1846
  notificationRuleEventType: data.notificationRuleEventType,
1674
1847
  });
1675
- logger.debug("Notification rules retrieved:");
1676
- logger.debug(notificationRules);
1848
+ logger.debug("Notification rules retrieved:", {
1849
+ projectId: (_a = data.projectId) === null || _a === void 0 ? void 0 : _a.toString(),
1850
+ });
1851
+ logger.debug(notificationRules, {
1852
+ projectId: (_b = data.projectId) === null || _b === void 0 ? void 0 : _b.toString(),
1853
+ });
1677
1854
  const values = await this.getValuesBasedOnNotificationFor({
1678
1855
  notificationFor: data.notificationFor,
1679
1856
  });
1680
- logger.debug("Values based on notification for:");
1681
- logger.debug(values);
1857
+ logger.debug("Values based on notification for:", {
1858
+ projectId: (_c = data.projectId) === null || _c === void 0 ? void 0 : _c.toString(),
1859
+ });
1860
+ logger.debug(values, {
1861
+ projectId: (_d = data.projectId) === null || _d === void 0 ? void 0 : _d.toString(),
1862
+ });
1682
1863
  const matchingNotificationRules = [];
1683
1864
  for (const notificationRule of notificationRules) {
1684
- logger.debug("Checking if rule matches:");
1865
+ logger.debug("Checking if rule matches:", {
1866
+ projectId: (_e = data.projectId) === null || _e === void 0 ? void 0 : _e.toString(),
1867
+ });
1685
1868
  if (WorkspaceNotificationRuleUtil.isRuleMatching({
1686
1869
  notificationRule: notificationRule.notificationRule,
1687
1870
  values: values,
1688
1871
  })) {
1689
- logger.debug("Rule matches. Adding to the list.");
1872
+ logger.debug("Rule matches. Adding to the list.", {
1873
+ projectId: (_f = data.projectId) === null || _f === void 0 ? void 0 : _f.toString(),
1874
+ });
1690
1875
  matchingNotificationRules.push(notificationRule);
1691
1876
  }
1692
1877
  else {
1693
- logger.debug("Rule does not match. Skipping.");
1878
+ logger.debug("Rule does not match. Skipping.", {
1879
+ projectId: (_g = data.projectId) === null || _g === void 0 ? void 0 : _g.toString(),
1880
+ });
1694
1881
  }
1695
1882
  }
1696
1883
  return matchingNotificationRules;