@oneuptime/common 12.0.18 → 12.0.19

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 (206) hide show
  1. package/Models/DatabaseModels/EnterpriseLicense.ts +23 -0
  2. package/Models/DatabaseModels/Index.ts +4 -2
  3. package/Models/DatabaseModels/Monitor.ts +39 -9
  4. package/Models/DatabaseModels/UserMicrosoftTeams.ts +344 -0
  5. package/Models/DatabaseModels/UserNotificationRule.ts +144 -8
  6. package/Models/DatabaseModels/UserNotificationSetting.ts +34 -0
  7. package/Models/DatabaseModels/UserOnCallLogTimeline.ts +95 -0
  8. package/Models/DatabaseModels/UserSlack.ts +341 -0
  9. package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +9 -0
  10. package/Server/API/UserMicrosoftTeamsAPI.ts +127 -0
  11. package/Server/API/UserSlackAPI.ts +125 -0
  12. package/Server/EnvironmentConfig.ts +12 -107
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1788700000000-RemoveMarketingConversionUploadState.ts +33 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1788800000000-DropMarketingConversionAddEnterpriseLicenseEmail.ts +51 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1788900000000-RedactStoredMonitorIngestSecrets.ts +117 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1789000000000-AddUserSlackAndMicrosoftTeams.ts +197 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  18. package/Server/Infrastructure/Queue.ts +7 -0
  19. package/Server/Services/EnterpriseLicenseService.ts +60 -0
  20. package/Server/Services/Index.ts +6 -2
  21. package/Server/Services/LlmLogService.ts +25 -9
  22. package/Server/Services/OnCallReadinessService.ts +86 -2
  23. package/Server/Services/ProjectService.ts +67 -0
  24. package/Server/Services/UserMicrosoftTeamsService.ts +208 -0
  25. package/Server/Services/UserNotificationMethodAdminService.ts +167 -5
  26. package/Server/Services/UserNotificationRuleAdminService.ts +40 -6
  27. package/Server/Services/UserNotificationRuleService.ts +589 -11
  28. package/Server/Services/UserNotificationSettingService.ts +138 -0
  29. package/Server/Services/UserService.ts +28 -0
  30. package/Server/Services/UserSlackService.ts +218 -0
  31. package/Server/Services/WorkspaceProjectAuthTokenService.ts +67 -1
  32. package/Server/Services/WorkspaceUserAuthTokenService.ts +73 -0
  33. package/Server/Services/WorkspaceUserNotificationService.ts +190 -0
  34. package/Server/Utils/Marketing/MarketingEventUtil.ts +145 -0
  35. package/Server/Utils/Marketing/MarketingEventWebhook.ts +114 -0
  36. package/Server/Utils/Monitor/MonitorLogUtil.ts +14 -1
  37. package/Server/Utils/Monitor/MonitorPayloadRedaction.ts +321 -0
  38. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +191 -4
  39. package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +22 -14
  40. package/Tests/App/Dashboard/AdminUserNotificationMethodsPage.test.tsx +22 -11
  41. package/Tests/App/Dashboard/OnCallPreventionGuards.test.tsx +37 -1
  42. package/Tests/App/Dashboard/OnCallRulesTable.test.tsx +18 -10
  43. package/Tests/Models/DatabaseModels/DomainRoleTierCoverage.test.ts +27 -1
  44. package/Tests/Models/DatabaseModels/MonitorSecretKeyColumnAccessControl.test.ts +214 -0
  45. package/Tests/Server/API/OnCallReadinessAPI.test.ts +145 -26
  46. package/Tests/Server/API/UserNotificationMethodAdminAPI.test.ts +2 -2
  47. package/Tests/Server/Services/AIServiceDailyBudget.test.ts +11 -1
  48. package/Tests/Server/Services/AdminRuleEditGuards.test.ts +22 -8
  49. package/Tests/Server/Services/DeliverNotificationForRuleExtraction.test.ts +18 -2
  50. package/Tests/Server/Services/EpisodeRuleSeverityRepair.test.ts +5 -1
  51. package/Tests/Server/Services/LlmLogServiceTokenAggregateParams.test.ts +640 -0
  52. package/Tests/Server/Services/NotificationChannelEventCoverage.test.ts +246 -22
  53. package/Tests/Server/Services/NotificationDeletionImpact.test.ts +136 -8
  54. package/Tests/Server/Services/OnCallNotificationFallback.test.ts +191 -8
  55. package/Tests/Server/Services/OnCallReadinessService.test.ts +343 -18
  56. package/Tests/Server/Services/SeverityRuleBackfill.test.ts +5 -1
  57. package/Tests/Server/Services/UserMicrosoftTeamsService.test.ts +343 -0
  58. package/Tests/Server/Services/UserNotificationMethodAdminService.test.ts +209 -8
  59. package/Tests/Server/Services/UserNotificationRuleAdminGuards.test.ts +22 -6
  60. package/Tests/Server/Services/UserNotificationRuleDefaultCreation.test.ts +12 -6
  61. package/Tests/Server/Services/UserNotificationRuleExecuteItem.test.ts +37 -3
  62. package/Tests/Server/Services/UserNotificationRuleWorkspaceDelivery.test.ts +669 -0
  63. package/Tests/Server/Services/UserNotificationSettingWorkspaceChannels.test.ts +410 -0
  64. package/Tests/Server/Services/UserSlackService.test.ts +407 -0
  65. package/Tests/Server/Services/WorkspaceProjectAuthTokenDisconnectCascade.test.ts +224 -0
  66. package/Tests/Server/Services/WorkspaceUserAuthTokenNotificationMethodCascade.test.ts +189 -0
  67. package/Tests/Server/Services/WorkspaceUserNotificationService.test.ts +496 -0
  68. package/Tests/Server/Types/Database/Permissions/AdminNotificationRuleAccess.test.ts +30 -17
  69. package/Tests/Server/Types/Database/Permissions/CreateOwnershipScoping.test.ts +8 -3
  70. package/Tests/Server/Types/Database/Permissions/OwnerOnlyColumns.test.ts +72 -3
  71. package/Tests/Server/Types/Database/Permissions/UserNotificationRuleScoping.test.ts +22 -18
  72. package/Tests/Server/Types/Database/Permissions/WorkspaceMethodStampedColumnCreate.test.ts +178 -0
  73. package/Tests/Server/Utils/Marketing/MarketingEventUtil.test.ts +259 -0
  74. package/Tests/Server/Utils/Marketing/MarketingEventWebhook.test.ts +257 -0
  75. package/Tests/Server/Utils/Monitor/MonitorLogUtilRedaction.test.ts +300 -0
  76. package/Tests/Server/Utils/Monitor/MonitorPayloadRedaction.test.ts +381 -0
  77. package/Tests/Server/Utils/Runbook/RunbookExecutePermission.test.ts +228 -0
  78. package/Tests/Server/Utils/SessionReplay/SessionReplayErasureTombstone.test.ts +189 -0
  79. package/Tests/Server/Utils/SessionReplay/SessionReplayUsage.test.ts +205 -0
  80. package/Tests/Server/Utils/Telemetry/AppMetrics.test.ts +275 -0
  81. package/Tests/Server/Utils/Telemetry/TelemetryContext.test.ts +279 -0
  82. package/Tests/Server/Utils/Workspace/MicrosoftTeamsDirectMessage.test.ts +454 -0
  83. package/Tests/UI/Utils/NotificationMethodUtil.test.ts +137 -9
  84. package/Tests/UI/Utils/PermissionGate.test.ts +105 -0
  85. package/Types/Marketing/MarketingEvent.ts +97 -0
  86. package/UI/Utils/NotificationMethodUtil.ts +41 -1
  87. package/UI/Utils/PermissionGate.ts +56 -0
  88. package/build/dist/Models/DatabaseModels/EnterpriseLicense.js +24 -0
  89. package/build/dist/Models/DatabaseModels/EnterpriseLicense.js.map +1 -1
  90. package/build/dist/Models/DatabaseModels/Index.js +4 -2
  91. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  92. package/build/dist/Models/DatabaseModels/Monitor.js +39 -9
  93. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  94. package/build/dist/Models/DatabaseModels/UserMicrosoftTeams.js +363 -0
  95. package/build/dist/Models/DatabaseModels/UserMicrosoftTeams.js.map +1 -0
  96. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +145 -8
  97. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  98. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +38 -0
  99. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
  100. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +96 -0
  101. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
  102. package/build/dist/Models/DatabaseModels/UserSlack.js +361 -0
  103. package/build/dist/Models/DatabaseModels/UserSlack.js.map +1 -0
  104. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
  105. package/build/dist/Server/API/UserMicrosoftTeamsAPI.js +82 -0
  106. package/build/dist/Server/API/UserMicrosoftTeamsAPI.js.map +1 -0
  107. package/build/dist/Server/API/UserSlackAPI.js +81 -0
  108. package/build/dist/Server/API/UserSlackAPI.js.map +1 -0
  109. package/build/dist/Server/EnvironmentConfig.js +10 -70
  110. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  111. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788700000000-RemoveMarketingConversionUploadState.js +26 -0
  112. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788700000000-RemoveMarketingConversionUploadState.js.map +1 -0
  113. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788800000000-DropMarketingConversionAddEnterpriseLicenseEmail.js +37 -0
  114. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788800000000-DropMarketingConversionAddEnterpriseLicenseEmail.js.map +1 -0
  115. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788900000000-RedactStoredMonitorIngestSecrets.js +106 -0
  116. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1788900000000-RedactStoredMonitorIngestSecrets.js.map +1 -0
  117. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789000000000-AddUserSlackAndMicrosoftTeams.js +78 -0
  118. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789000000000-AddUserSlackAndMicrosoftTeams.js.map +1 -0
  119. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  120. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  121. package/build/dist/Server/Infrastructure/Queue.js +7 -0
  122. package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
  123. package/build/dist/Server/Services/EnterpriseLicenseService.js +65 -0
  124. package/build/dist/Server/Services/EnterpriseLicenseService.js.map +1 -1
  125. package/build/dist/Server/Services/Index.js +6 -2
  126. package/build/dist/Server/Services/Index.js.map +1 -1
  127. package/build/dist/Server/Services/LlmLogService.js +25 -9
  128. package/build/dist/Server/Services/LlmLogService.js.map +1 -1
  129. package/build/dist/Server/Services/OnCallReadinessService.js +74 -2
  130. package/build/dist/Server/Services/OnCallReadinessService.js.map +1 -1
  131. package/build/dist/Server/Services/ProjectService.js +56 -0
  132. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  133. package/build/dist/Server/Services/UserMicrosoftTeamsService.js +183 -0
  134. package/build/dist/Server/Services/UserMicrosoftTeamsService.js.map +1 -0
  135. package/build/dist/Server/Services/UserNotificationMethodAdminService.js +138 -2
  136. package/build/dist/Server/Services/UserNotificationMethodAdminService.js.map +1 -1
  137. package/build/dist/Server/Services/UserNotificationRuleAdminService.js +32 -4
  138. package/build/dist/Server/Services/UserNotificationRuleAdminService.js.map +1 -1
  139. package/build/dist/Server/Services/UserNotificationRuleService.js +499 -67
  140. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  141. package/build/dist/Server/Services/UserNotificationSettingService.js +118 -0
  142. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  143. package/build/dist/Server/Services/UserService.js +26 -1
  144. package/build/dist/Server/Services/UserService.js.map +1 -1
  145. package/build/dist/Server/Services/UserSlackService.js +195 -0
  146. package/build/dist/Server/Services/UserSlackService.js.map +1 -0
  147. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +64 -1
  148. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  149. package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js +70 -0
  150. package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js.map +1 -1
  151. package/build/dist/Server/Services/WorkspaceUserNotificationService.js +129 -0
  152. package/build/dist/Server/Services/WorkspaceUserNotificationService.js.map +1 -0
  153. package/build/dist/Server/Utils/Marketing/MarketingEventUtil.js +94 -0
  154. package/build/dist/Server/Utils/Marketing/MarketingEventUtil.js.map +1 -0
  155. package/build/dist/Server/Utils/Marketing/MarketingEventWebhook.js +93 -0
  156. package/build/dist/Server/Utils/Marketing/MarketingEventWebhook.js.map +1 -0
  157. package/build/dist/Server/Utils/Monitor/MonitorLogUtil.js +12 -1
  158. package/build/dist/Server/Utils/Monitor/MonitorLogUtil.js.map +1 -1
  159. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js +233 -0
  160. package/build/dist/Server/Utils/Monitor/MonitorPayloadRedaction.js.map +1 -0
  161. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +141 -4
  162. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  163. package/build/dist/Types/Marketing/MarketingEvent.js +43 -0
  164. package/build/dist/Types/Marketing/MarketingEvent.js.map +1 -0
  165. package/build/dist/UI/Utils/NotificationMethodUtil.js +33 -1
  166. package/build/dist/UI/Utils/NotificationMethodUtil.js.map +1 -1
  167. package/build/dist/UI/Utils/PermissionGate.js +32 -0
  168. package/build/dist/UI/Utils/PermissionGate.js.map +1 -1
  169. package/package.json +1 -1
  170. package/Models/DatabaseModels/MarketingConversion.ts +0 -410
  171. package/Server/Services/MarketingConversionService.ts +0 -10
  172. package/Server/Utils/Marketing/ConversionUploadProvider.ts +0 -215
  173. package/Server/Utils/Marketing/ConversionUploadProviders.ts +0 -22
  174. package/Server/Utils/Marketing/Providers/GoogleAds.ts +0 -333
  175. package/Server/Utils/Marketing/Providers/LinkedIn.ts +0 -185
  176. package/Server/Utils/Marketing/Providers/Meta.ts +0 -182
  177. package/Server/Utils/Marketing/Providers/MicrosoftAds.ts +0 -223
  178. package/Server/Utils/Marketing/Providers/Reddit.ts +0 -208
  179. package/Tests/Server/Utils/Marketing/AdUploadableConversionTypes.test.ts +0 -315
  180. package/Tests/Server/Utils/Marketing/ConversionUploadProvider.test.ts +0 -300
  181. package/Tests/Server/Utils/Marketing/GoogleAds.test.ts +0 -592
  182. package/Tests/Server/Utils/Marketing/LinkedIn.test.ts +0 -282
  183. package/Tests/Server/Utils/Marketing/Meta.test.ts +0 -304
  184. package/Tests/Server/Utils/Marketing/MicrosoftAds.test.ts +0 -263
  185. package/Tests/Server/Utils/Marketing/Reddit.test.ts +0 -259
  186. package/Types/Marketing/MarketingConversion.ts +0 -53
  187. package/build/dist/Models/DatabaseModels/MarketingConversion.js +0 -445
  188. package/build/dist/Models/DatabaseModels/MarketingConversion.js.map +0 -1
  189. package/build/dist/Server/Services/MarketingConversionService.js +0 -9
  190. package/build/dist/Server/Services/MarketingConversionService.js.map +0 -1
  191. package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js +0 -93
  192. package/build/dist/Server/Utils/Marketing/ConversionUploadProvider.js.map +0 -1
  193. package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js +0 -20
  194. package/build/dist/Server/Utils/Marketing/ConversionUploadProviders.js.map +0 -1
  195. package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js +0 -221
  196. package/build/dist/Server/Utils/Marketing/Providers/GoogleAds.js.map +0 -1
  197. package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js +0 -137
  198. package/build/dist/Server/Utils/Marketing/Providers/LinkedIn.js.map +0 -1
  199. package/build/dist/Server/Utils/Marketing/Providers/Meta.js +0 -133
  200. package/build/dist/Server/Utils/Marketing/Providers/Meta.js.map +0 -1
  201. package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js +0 -143
  202. package/build/dist/Server/Utils/Marketing/Providers/MicrosoftAds.js.map +0 -1
  203. package/build/dist/Server/Utils/Marketing/Providers/Reddit.js +0 -145
  204. package/build/dist/Server/Utils/Marketing/Providers/Reddit.js.map +0 -1
  205. package/build/dist/Types/Marketing/MarketingConversion.js +0 -52
  206. package/build/dist/Types/Marketing/MarketingConversion.js.map +0 -1
@@ -11,8 +11,10 @@ import UserNotificationRuleService, {
11
11
  } from "../../../Server/Services/UserNotificationRuleService";
12
12
  import UserOnCallLogService from "../../../Server/Services/UserOnCallLogService";
13
13
  import UserOnCallLogTimelineService from "../../../Server/Services/UserOnCallLogTimelineService";
14
+ import UserMicrosoftTeamsService from "../../../Server/Services/UserMicrosoftTeamsService";
14
15
  import UserPushService from "../../../Server/Services/UserPushService";
15
16
  import UserService from "../../../Server/Services/UserService";
17
+ import UserSlackService from "../../../Server/Services/UserSlackService";
16
18
  import UserSmsService from "../../../Server/Services/UserSmsService";
17
19
  import UserTelegramService from "../../../Server/Services/UserTelegramService";
18
20
  import UserWebhookService from "../../../Server/Services/UserWebhookService";
@@ -74,7 +76,7 @@ import { afterEach, beforeEach, describe, expect, test } from "@jest/globals";
74
76
  * a user id is global.
75
77
  * R3 a rule's method FK must point at a method row owned by the rule's own
76
78
  * user - on create, on update, through the FK column and through the
77
- * relation slot, on every one of the seven channels, and on update with
79
+ * relation slot, on every one of the nine channels, and on update with
78
80
  * the owner re-read from the DATABASE because the body is written by the
79
81
  * party under suspicion.
80
82
  * R6 the audit line and the owner's warning email are keyed on the actor the
@@ -135,14 +137,14 @@ const ADMIN_EMAIL: string = "ada.admin@example.test";
135
137
  const VICTIM_EMAIL: string = "vic.responder@example.test";
136
138
 
137
139
  /*
138
- * The seven channels, each named by the FK column that carries it, the relation
140
+ * The nine channels, each named by the FK column that carries it, the relation
139
141
  * slot that is the same write spelled differently, the service the guard has to
140
142
  * consult for that channel's owner, and the word that must appear in the
141
143
  * refusal so an operator can tell WHICH method was wrong.
142
144
  *
143
145
  * Everything about method ownership is driven off this table on purpose. The
144
- * one realistic way for the guard to be wrong is to cover six channels and
145
- * forget the seventh, and an attacker choosing between seven doors will always
146
+ * one realistic way for the guard to be wrong is to cover eight channels and
147
+ * forget the ninth, and an attacker choosing between nine doors will always
146
148
  * choose the unlocked one - so a per-channel loop is the only shape of test
147
149
  * that means anything here.
148
150
  */
@@ -188,6 +190,18 @@ const CHANNELS: Array<ChannelFixture> = [
188
190
  label: "Telegram",
189
191
  service: UserTelegramService as unknown as MethodServiceLike,
190
192
  },
193
+ {
194
+ idColumn: "userSlackId",
195
+ relationColumn: "userSlack",
196
+ label: "Slack",
197
+ service: UserSlackService as unknown as MethodServiceLike,
198
+ },
199
+ {
200
+ idColumn: "userMicrosoftTeamsId",
201
+ relationColumn: "userMicrosoftTeams",
202
+ label: "Microsoft Teams",
203
+ service: UserMicrosoftTeamsService as unknown as MethodServiceLike,
204
+ },
191
205
  {
192
206
  idColumn: "userPushId",
193
207
  relationColumn: "userPush",
@@ -860,7 +874,7 @@ describe("Administrative notification rule edit guards", () => {
860
874
  describe("R3 on create: a rule's method must belong to the rule's user", () => {
861
875
  test("the guard covers exactly the notification method columns the model declares", () => {
862
876
  /*
863
- * Derived from the model rather than restated, so that an eighth channel
877
+ * Derived from the model rather than restated, so that a tenth channel
864
878
  * added to UserNotificationRule and forgotten in the guard fails HERE,
865
879
  * loudly, instead of quietly becoming the one unlocked door.
866
880
  */
@@ -873,7 +887,7 @@ describe("Administrative notification rule edit guards", () => {
873
887
  });
874
888
 
875
889
  // If the derivation itself ever breaks, fail rather than pass vacuously.
876
- expect(columnsOnModel).toHaveLength(7);
890
+ expect(columnsOnModel).toHaveLength(9);
877
891
 
878
892
  expect(
879
893
  [
@@ -1783,7 +1797,7 @@ describe("Administrative notification rule edit guards", () => {
1783
1797
  }),
1784
1798
  ),
1785
1799
  ).rejects.toThrow(
1786
- "Call, SMS, WhatsApp, Telegram, Webhook, Email, or Push notification is required",
1800
+ "Call, SMS, WhatsApp, Telegram, Slack, Microsoft Teams, Webhook, Email, or Push notification is required",
1787
1801
  );
1788
1802
  });
1789
1803
 
@@ -1995,7 +2009,7 @@ describe("Administrative notification rule edit guards", () => {
1995
2009
  updatePayload({ patch: { userEmailId: null } }),
1996
2010
  ),
1997
2011
  ).rejects.toThrow(
1998
- "Call, SMS, WhatsApp, Telegram, Webhook, Email, or Push notification is required",
2012
+ "Call, SMS, WhatsApp, Telegram, Slack, Microsoft Teams, Webhook, Email, or Push notification is required",
1999
2013
  );
2000
2014
  });
2001
2015
 
@@ -46,7 +46,7 @@ import { describe, expect, test, beforeEach, afterEach } from "@jest/globals";
46
46
  * with a UserNotificationRule it assembled in memory and never saved: there is
47
47
  * no rule row to claim and no id to look up, so the first half is meaningless
48
48
  * to it while the second half is exactly what it needs. That makes the SEAM
49
- * between the two halves — not the seven channel blocks, which
49
+ * between the two halves — not the nine channel blocks, which
50
50
  * NotificationChannelEventCoverage.test.ts owns — the thing worth pinning, and
51
51
  * this file pins five properties of it:
52
52
  *
@@ -731,7 +731,7 @@ describe("UserNotificationRuleService - the deliverNotificationForRule extractio
731
731
  * the loaded relation's userId against the rule's, and it can only report
732
732
  * a mismatch it can SEE - an unselected column arrives as `undefined` and
733
733
  * is deliberately read as "no evidence", so dropping any one of these
734
- * seven silently disables the backstop for that channel.
734
+ * nine silently disables the backstop for that channel.
735
735
  *
736
736
  * Kept as an exact-shape assertion on purpose. This test caught the
737
737
  * column being added, which is the whole argument for not relaxing it
@@ -762,6 +762,18 @@ describe("UserNotificationRuleService - the deliverNotificationForRule extractio
762
762
  isVerified: true,
763
763
  userId: true,
764
764
  },
765
+ userSlack: {
766
+ slackUserId: true,
767
+ slackUserName: true,
768
+ isVerified: true,
769
+ userId: true,
770
+ },
771
+ userMicrosoftTeams: {
772
+ microsoftTeamsUserId: true,
773
+ microsoftTeamsUserName: true,
774
+ isVerified: true,
775
+ userId: true,
776
+ },
765
777
  userWebhook: {
766
778
  webhookUrl: true,
767
779
  name: true,
@@ -788,6 +800,8 @@ describe("UserNotificationRuleService - the deliverNotificationForRule extractio
788
800
  ["userSms"],
789
801
  ["userWhatsApp"],
790
802
  ["userTelegram"],
803
+ ["userSlack"],
804
+ ["userMicrosoftTeams"],
791
805
  ["userEmail"],
792
806
  ["userPush"],
793
807
  ])(
@@ -806,6 +820,8 @@ describe("UserNotificationRuleService - the deliverNotificationForRule extractio
806
820
  ["userSms", "phone"],
807
821
  ["userWhatsApp", "phone"],
808
822
  ["userTelegram", "telegramChatId"],
823
+ ["userSlack", "slackUserId"],
824
+ ["userMicrosoftTeams", "microsoftTeamsUserId"],
809
825
  ["userEmail", "email"],
810
826
  ["userPush", "deviceToken"],
811
827
  ])(
@@ -161,13 +161,15 @@ const TELEGRAM_METHOD_ID: ObjectID = new ObjectID(
161
161
  "ccccccc2-cccc-4ccc-8ccc-cccccccccccc",
162
162
  );
163
163
 
164
- /* The seven FK columns a rule can name a notification method through. */
164
+ /* The nine FK columns a rule can name a notification method through. */
165
165
  type MethodColumn =
166
166
  | "userEmailId"
167
167
  | "userSmsId"
168
168
  | "userCallId"
169
169
  | "userWhatsAppId"
170
170
  | "userTelegramId"
171
+ | "userSlackId"
172
+ | "userMicrosoftTeamsId"
171
173
  | "userWebhookId"
172
174
  | "userPushId";
173
175
 
@@ -177,6 +179,8 @@ const ALL_METHOD_COLUMNS: Array<MethodColumn> = [
177
179
  "userCallId",
178
180
  "userWhatsAppId",
179
181
  "userTelegramId",
182
+ "userSlackId",
183
+ "userMicrosoftTeamsId",
180
184
  "userWebhookId",
181
185
  "userPushId",
182
186
  ];