@oneuptime/common 11.7.3 → 11.7.4

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 (365) hide show
  1. package/Models/DatabaseModels/AlertEpisodeStateTimeline.ts +1 -0
  2. package/Models/DatabaseModels/AlertStateTimeline.ts +1 -0
  3. package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +1 -0
  4. package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -0
  5. package/Models/DatabaseModels/Index.ts +5 -0
  6. package/Models/DatabaseModels/LogDropFilter.ts +89 -0
  7. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +13 -3
  8. package/Models/DatabaseModels/RecommendationDismissal.ts +463 -0
  9. package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.ts +1 -0
  10. package/Models/DatabaseModels/StatusPageGroup.ts +95 -0
  11. package/Models/DatabaseModels/TraceDropFilter.ts +89 -0
  12. package/Models/DatabaseModels/WorkflowVariable.ts +5 -1
  13. package/Server/API/AlertAPI.ts +32 -17
  14. package/Server/API/BaseAPI.ts +31 -2
  15. package/Server/API/BaseAnalyticsAPI.ts +36 -2
  16. package/Server/API/CommonAPI.ts +57 -0
  17. package/Server/API/IncidentAPI.ts +60 -33
  18. package/Server/API/IncidentEpisodeAPI.ts +31 -16
  19. package/Server/API/MonitorAPI.ts +30 -0
  20. package/Server/API/MonitorTemplateAPI.ts +8 -0
  21. package/Server/API/ProbeAPI.ts +196 -15
  22. package/Server/API/ProjectAPI.ts +79 -1
  23. package/Server/API/ScheduledMaintenanceAPI.ts +33 -18
  24. package/Server/API/StatusPageAPI.ts +74 -37
  25. package/Server/API/WorkspaceNotificationRuleAPI.ts +34 -4
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.ts +527 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.ts +31 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.ts +55 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.ts +53 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  31. package/Server/Services/AlertEpisodeService.ts +47 -0
  32. package/Server/Services/AlertService.ts +125 -0
  33. package/Server/Services/BillingService.ts +98 -0
  34. package/Server/Services/DatabaseService.ts +184 -20
  35. package/Server/Services/IncidentEpisodeService.ts +47 -0
  36. package/Server/Services/IncidentService.ts +123 -0
  37. package/Server/Services/IncidentTemplateService.ts +123 -1
  38. package/Server/Services/Index.ts +2 -0
  39. package/Server/Services/LogDropFilterService.ts +133 -0
  40. package/Server/Services/MonitorProbeService.ts +94 -4
  41. package/Server/Services/MonitorService.ts +48 -43
  42. package/Server/Services/NetworkDeviceDiscoveryScanService.ts +70 -0
  43. package/Server/Services/ProbeService.ts +66 -0
  44. package/Server/Services/ProjectService.ts +131 -7
  45. package/Server/Services/RecommendationDismissalService.ts +52 -0
  46. package/Server/Services/RunbookAgentJobService.ts +68 -7
  47. package/Server/Services/ScheduledMaintenanceService.ts +103 -0
  48. package/Server/Services/ScheduledMaintenanceTemplateService.ts +90 -0
  49. package/Server/Services/StatusPageGroupService.ts +186 -0
  50. package/Server/Services/TraceDropFilterService.ts +133 -0
  51. package/Server/Types/Workflow/Components/API/Delete.ts +12 -0
  52. package/Server/Types/Workflow/Components/API/Get.ts +12 -0
  53. package/Server/Types/Workflow/Components/API/Patch.ts +12 -0
  54. package/Server/Types/Workflow/Components/API/Post.ts +12 -0
  55. package/Server/Types/Workflow/Components/API/Put.ts +13 -0
  56. package/Server/Utils/Database/ProjectScopedReferenceValidator.ts +212 -0
  57. package/Server/Utils/DropFilterValidation.ts +127 -0
  58. package/Server/Utils/Errors.ts +5 -0
  59. package/Server/Utils/Monitor/MonitorAlert.ts +28 -1
  60. package/Server/Utils/Monitor/MonitorIncident.ts +31 -2
  61. package/Server/Utils/Telemetry/AppMetrics.ts +31 -0
  62. package/Tests/Models/DatabaseModels/MonitorProbeColumnAccessControl.test.ts +196 -0
  63. package/Tests/Models/RecommendationDismissalModel.test.ts +269 -0
  64. package/Tests/Server/API/BaseAPIUpdatePayloadValidation.test.ts +320 -0
  65. package/Tests/Server/API/BaseAnalyticsAPIUpdatePayloadValidation.test.ts +293 -0
  66. package/Tests/Server/API/CommonAPIAuthGuard.test.ts +164 -0
  67. package/Tests/Server/API/ProbeAPI.test.ts +422 -53
  68. package/Tests/Server/API/ProjectAPI.test.ts +180 -0
  69. package/Tests/Server/API/ProjectAPIExtendTrialBillingDisabled.test.ts +138 -0
  70. package/Tests/Server/API/ProjectScopedCustomRouteAuth.test.ts +458 -0
  71. package/Tests/Server/Infrastructure/ContainerBootConfiguration.test.ts +359 -0
  72. package/Tests/Server/Infrastructure/ProcessSignalDelivery.test.ts +427 -0
  73. package/Tests/Server/Services/BillingServiceExtendTrial.test.ts +439 -0
  74. package/Tests/Server/Services/CrossProjectReferenceWriteGuard.test.ts +810 -0
  75. package/Tests/Server/Services/DatabaseServiceAtomicAddToColumns.test.ts +269 -0
  76. package/Tests/Server/Services/DatabaseServiceEmptyUpdate.test.ts +277 -0
  77. package/Tests/Server/Services/DatabaseServiceSortColumnSelect.test.ts +201 -0
  78. package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +81 -23
  79. package/Tests/Server/Services/DropFilterSaveValidation.test.ts +398 -0
  80. package/Tests/Server/Services/MonitorProbeDeleteHooks.test.ts +280 -0
  81. package/Tests/Server/Services/MonitorProbeServiceProbeTenancy.test.ts +304 -0
  82. package/Tests/Server/Services/NetworkDeviceDiscoveryScanService.test.ts +262 -0
  83. package/Tests/Server/Services/ProjectServiceExtendTrial.test.ts +614 -0
  84. package/Tests/Server/Services/RecommendationDismissalService.test.ts +306 -0
  85. package/Tests/Server/Services/RepairCrossProjectIncidentReferencesMigration.test.ts +528 -0
  86. package/Tests/Server/Services/StatusPageGroupNesting.test.ts +395 -0
  87. package/Tests/Server/TestingUtils/Services/BillingServiceHelper.ts +26 -21
  88. package/Tests/Server/Types/Database/Permissions/WorkflowVariableColumnPermission.test.ts +227 -0
  89. package/Tests/Server/Types/Workflow/Components/ApiComponentErrorPort.test.ts +285 -0
  90. package/Tests/Server/Utils/Database/ProjectScopedReferenceValidator.test.ts +463 -0
  91. package/Tests/Server/Utils/DropFilterValidation.test.ts +269 -0
  92. package/Tests/Server/Utils/Telemetry/SpanUtil.test.ts +94 -0
  93. package/Tests/Types/DateUserTimezone.test.ts +52 -0
  94. package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +177 -9
  95. package/Tests/Types/Monitor/MonitorStepDnsMonitor.test.ts +105 -0
  96. package/Tests/Types/Monitor/MonitorStepDnssecMonitor.test.ts +131 -0
  97. package/Tests/Types/Monitor/MonitorStepDomainMonitor.test.ts +60 -0
  98. package/Tests/Types/Monitor/MonitorStepExternalStatusPageMonitor.test.ts +82 -0
  99. package/Tests/Types/Monitor/MonitorStepInfrastructureMonitors.test.ts +268 -0
  100. package/Tests/Types/Monitor/MonitorStepMetricMonitor.test.ts +386 -0
  101. package/Tests/Types/Monitor/MonitorStepProfileMonitor.test.ts +185 -0
  102. package/Tests/Types/Monitor/MonitorStepSnmpMonitor.test.ts +156 -0
  103. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +371 -0
  104. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +901 -0
  105. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +607 -0
  106. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.test.ts +754 -0
  107. package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +960 -0
  108. package/Tests/Types/RollingTime/RollingTimeUtil.test.ts +186 -0
  109. package/Tests/Types/Runbook/RunbookStepTimeout.test.ts +410 -0
  110. package/Tests/Types/Telemetry/DropFilterSampling.test.ts +241 -0
  111. package/Tests/Types/Workspace/NotificationRuleConditionUtil.test.ts +353 -0
  112. package/Tests/Types/Workspace/NotificationRuleUtil.test.ts +566 -0
  113. package/Tests/UI/Components/CodeEditor.test.tsx +174 -0
  114. package/Tests/UI/Components/ErrorBoundary.test.tsx +555 -24
  115. package/Tests/UI/Components/InfoCard.test.tsx +358 -0
  116. package/Tests/UI/Components/LogTimeRangePicker.test.tsx +138 -0
  117. package/Tests/UI/Components/Modal.test.tsx +43 -5
  118. package/Tests/UI/Components/ModelTable/BaseModelTableSearchLabels.test.tsx +397 -0
  119. package/Tests/UI/Components/ModelTable/ColumnCustomizationModal.test.tsx +427 -0
  120. package/Tests/UI/Components/Runbook/StepTimeoutInput.test.tsx +386 -0
  121. package/Tests/UI/Components/StatusPage/ResourceGroupSection.test.tsx +671 -0
  122. package/Tests/UI/Components/TelemetryTimeRangePicker.test.tsx +404 -0
  123. package/Tests/UI/Utils/DropdownAlignment.test.ts +306 -0
  124. package/Tests/UI/Utils/TableFilterUrlState.test.ts +292 -0
  125. package/Tests/Utils/Monitor/MonitorSummaryProbeUtil.test.ts +263 -0
  126. package/Tests/Utils/NetworkDiscovery/ScanTargetUtil.test.ts +583 -0
  127. package/Tests/Utils/StatusPage/GroupNestingLayout.test.ts +1072 -0
  128. package/Tests/Utils/StatusPage/GroupTree.test.ts +583 -0
  129. package/Tests/Utils/StatusPage/ResourceUptime.test.ts +411 -0
  130. package/Types/Date.ts +15 -6
  131. package/Types/Monitor/KubernetesAlertTemplates.ts +205 -0
  132. package/Types/Monitor/MonitorStep.ts +10 -1
  133. package/Types/Monitor/MonitorStepMetricMonitor.ts +46 -1
  134. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +413 -0
  135. package/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.ts +168 -0
  136. package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +175 -0
  137. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +743 -0
  138. package/Types/Permission.ts +45 -0
  139. package/Types/Recommendation/RecommendationType.ts +20 -0
  140. package/Types/Runbook/RunbookExecutionDeadline.ts +129 -0
  141. package/Types/Runbook/RunbookStepTimeout.ts +202 -0
  142. package/Types/Telemetry/DropFilterSampling.ts +92 -0
  143. package/UI/Components/AI/GenerateFromAIModal.tsx +0 -2
  144. package/UI/Components/Accordion/Accordion.tsx +10 -2
  145. package/UI/Components/BulkUpdate/BulkLabelActions.tsx +0 -1
  146. package/UI/Components/CodeEditor/CodeEditor.tsx +34 -20
  147. package/UI/Components/Date/RangeStartAndEndDateView.tsx +0 -1
  148. package/UI/Components/EditionLabel/EditionLabel.tsx +1 -27
  149. package/UI/Components/Error/PageError.tsx +0 -4
  150. package/UI/Components/ErrorBoundary.tsx +252 -15
  151. package/UI/Components/InfoCard/InfoCard.tsx +58 -1
  152. package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +34 -1
  153. package/UI/Components/Modal/Modal.tsx +16 -60
  154. package/UI/Components/ModelFormModal/ModelFormModal.tsx +0 -8
  155. package/UI/Components/ModelTable/BaseModelTable.tsx +116 -67
  156. package/UI/Components/ModelTable/ColumnCustomizationModal.tsx +150 -47
  157. package/UI/Components/Runbook/StepTimeoutInput.tsx +173 -0
  158. package/UI/Components/StatusPage/ResourceGroupSection.tsx +231 -0
  159. package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +34 -1
  160. package/UI/Utils/DropdownAlignment.ts +162 -0
  161. package/UI/Utils/TableFilterUrlState.ts +59 -20
  162. package/Utils/API.ts +106 -2
  163. package/Utils/Monitor/MonitorSummaryProbeUtil.ts +130 -0
  164. package/Utils/NetworkDiscovery/ScanTargetUtil.ts +434 -0
  165. package/Utils/StatusPage/GroupNestingLayout.ts +343 -0
  166. package/Utils/StatusPage/GroupTree.ts +307 -0
  167. package/Utils/StatusPage/ResourceUptime.ts +90 -17
  168. package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js +1 -0
  169. package/build/dist/Models/DatabaseModels/AlertEpisodeStateTimeline.js.map +1 -1
  170. package/build/dist/Models/DatabaseModels/AlertStateTimeline.js +1 -0
  171. package/build/dist/Models/DatabaseModels/AlertStateTimeline.js.map +1 -1
  172. package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +1 -0
  173. package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -1
  174. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -0
  175. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
  176. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  177. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  178. package/build/dist/Models/DatabaseModels/LogDropFilter.js +91 -0
  179. package/build/dist/Models/DatabaseModels/LogDropFilter.js.map +1 -1
  180. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +14 -4
  181. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  182. package/build/dist/Models/DatabaseModels/RecommendationDismissal.js +484 -0
  183. package/build/dist/Models/DatabaseModels/RecommendationDismissal.js.map +1 -0
  184. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -0
  185. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js.map +1 -1
  186. package/build/dist/Models/DatabaseModels/StatusPageGroup.js +94 -0
  187. package/build/dist/Models/DatabaseModels/StatusPageGroup.js.map +1 -1
  188. package/build/dist/Models/DatabaseModels/TraceDropFilter.js +91 -0
  189. package/build/dist/Models/DatabaseModels/TraceDropFilter.js.map +1 -1
  190. package/build/dist/Models/DatabaseModels/WorkflowVariable.js +5 -1
  191. package/build/dist/Models/DatabaseModels/WorkflowVariable.js.map +1 -1
  192. package/build/dist/Server/API/AlertAPI.js +22 -13
  193. package/build/dist/Server/API/AlertAPI.js.map +1 -1
  194. package/build/dist/Server/API/BaseAPI.js +22 -1
  195. package/build/dist/Server/API/BaseAPI.js.map +1 -1
  196. package/build/dist/Server/API/BaseAnalyticsAPI.js +24 -1
  197. package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
  198. package/build/dist/Server/API/CommonAPI.js +42 -0
  199. package/build/dist/Server/API/CommonAPI.js.map +1 -1
  200. package/build/dist/Server/API/IncidentAPI.js +43 -26
  201. package/build/dist/Server/API/IncidentAPI.js.map +1 -1
  202. package/build/dist/Server/API/IncidentEpisodeAPI.js +21 -12
  203. package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -1
  204. package/build/dist/Server/API/MonitorAPI.js +23 -0
  205. package/build/dist/Server/API/MonitorAPI.js.map +1 -1
  206. package/build/dist/Server/API/MonitorTemplateAPI.js +4 -0
  207. package/build/dist/Server/API/MonitorTemplateAPI.js.map +1 -1
  208. package/build/dist/Server/API/ProbeAPI.js +131 -15
  209. package/build/dist/Server/API/ProbeAPI.js.map +1 -1
  210. package/build/dist/Server/API/ProjectAPI.js +62 -3
  211. package/build/dist/Server/API/ProjectAPI.js.map +1 -1
  212. package/build/dist/Server/API/ScheduledMaintenanceAPI.js +23 -14
  213. package/build/dist/Server/API/ScheduledMaintenanceAPI.js.map +1 -1
  214. package/build/dist/Server/API/StatusPageAPI.js +61 -33
  215. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  216. package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js +26 -2
  217. package/build/dist/Server/API/WorkspaceNotificationRuleAPI.js.map +1 -1
  218. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js +397 -0
  219. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785320000000-RepairCrossProjectIncidentReferences.js.map +1 -0
  220. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js +16 -0
  221. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785329453269-AddParentGroupToStatusPageGroup.js.map +1 -0
  222. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js +30 -0
  223. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785397674289-AddRecommendationDismissalTable.js.map +1 -0
  224. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.js +34 -0
  225. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785405581596-AddDroppedCountersToDropFilters.js.map +1 -0
  226. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  227. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  228. package/build/dist/Server/Services/AlertEpisodeService.js +39 -0
  229. package/build/dist/Server/Services/AlertEpisodeService.js.map +1 -1
  230. package/build/dist/Server/Services/AlertService.js +95 -0
  231. package/build/dist/Server/Services/AlertService.js.map +1 -1
  232. package/build/dist/Server/Services/BillingService.js +71 -0
  233. package/build/dist/Server/Services/BillingService.js.map +1 -1
  234. package/build/dist/Server/Services/DatabaseService.js +140 -17
  235. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  236. package/build/dist/Server/Services/IncidentEpisodeService.js +39 -0
  237. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  238. package/build/dist/Server/Services/IncidentService.js +100 -0
  239. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  240. package/build/dist/Server/Services/IncidentTemplateService.js +97 -0
  241. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  242. package/build/dist/Server/Services/Index.js +2 -0
  243. package/build/dist/Server/Services/Index.js.map +1 -1
  244. package/build/dist/Server/Services/LogDropFilterService.js +93 -0
  245. package/build/dist/Server/Services/LogDropFilterService.js.map +1 -1
  246. package/build/dist/Server/Services/MonitorProbeService.js +73 -5
  247. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  248. package/build/dist/Server/Services/MonitorService.js +34 -39
  249. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  250. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +71 -0
  251. package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
  252. package/build/dist/Server/Services/ProbeService.js +64 -0
  253. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  254. package/build/dist/Server/Services/ProjectService.js +103 -7
  255. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  256. package/build/dist/Server/Services/RecommendationDismissalService.js +50 -0
  257. package/build/dist/Server/Services/RecommendationDismissalService.js.map +1 -0
  258. package/build/dist/Server/Services/RunbookAgentJobService.js +63 -5
  259. package/build/dist/Server/Services/RunbookAgentJobService.js.map +1 -1
  260. package/build/dist/Server/Services/ScheduledMaintenanceService.js +83 -0
  261. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  262. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +65 -0
  263. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -1
  264. package/build/dist/Server/Services/StatusPageGroupService.js +136 -0
  265. package/build/dist/Server/Services/StatusPageGroupService.js.map +1 -1
  266. package/build/dist/Server/Services/TraceDropFilterService.js +93 -0
  267. package/build/dist/Server/Services/TraceDropFilterService.js.map +1 -1
  268. package/build/dist/Server/Types/Workflow/Components/API/Delete.js +11 -0
  269. package/build/dist/Server/Types/Workflow/Components/API/Delete.js.map +1 -1
  270. package/build/dist/Server/Types/Workflow/Components/API/Get.js +11 -0
  271. package/build/dist/Server/Types/Workflow/Components/API/Get.js.map +1 -1
  272. package/build/dist/Server/Types/Workflow/Components/API/Patch.js +11 -0
  273. package/build/dist/Server/Types/Workflow/Components/API/Patch.js.map +1 -1
  274. package/build/dist/Server/Types/Workflow/Components/API/Post.js +11 -0
  275. package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
  276. package/build/dist/Server/Types/Workflow/Components/API/Put.js +12 -0
  277. package/build/dist/Server/Types/Workflow/Components/API/Put.js.map +1 -1
  278. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js +132 -0
  279. package/build/dist/Server/Utils/Database/ProjectScopedReferenceValidator.js.map +1 -0
  280. package/build/dist/Server/Utils/DropFilterValidation.js +80 -0
  281. package/build/dist/Server/Utils/DropFilterValidation.js.map +1 -0
  282. package/build/dist/Server/Utils/Errors.js +3 -0
  283. package/build/dist/Server/Utils/Errors.js.map +1 -1
  284. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +30 -12
  285. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  286. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +38 -18
  287. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  288. package/build/dist/Server/Utils/Telemetry/AppMetrics.js +26 -0
  289. package/build/dist/Server/Utils/Telemetry/AppMetrics.js.map +1 -1
  290. package/build/dist/Types/Date.js +14 -4
  291. package/build/dist/Types/Date.js.map +1 -1
  292. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +192 -0
  293. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  294. package/build/dist/Types/Monitor/MonitorStep.js +6 -1
  295. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  296. package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js +32 -1
  297. package/build/dist/Types/Monitor/MonitorStepMetricMonitor.js.map +1 -1
  298. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +294 -0
  299. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -0
  300. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js +110 -0
  301. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationSeverityMapper.js.map +1 -0
  302. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +58 -0
  303. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -0
  304. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +451 -0
  305. package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -0
  306. package/build/dist/Types/Permission.js +40 -0
  307. package/build/dist/Types/Permission.js.map +1 -1
  308. package/build/dist/Types/Recommendation/RecommendationType.js +21 -0
  309. package/build/dist/Types/Recommendation/RecommendationType.js.map +1 -0
  310. package/build/dist/Types/Runbook/RunbookExecutionDeadline.js +93 -0
  311. package/build/dist/Types/Runbook/RunbookExecutionDeadline.js.map +1 -0
  312. package/build/dist/Types/Runbook/RunbookStepTimeout.js +142 -0
  313. package/build/dist/Types/Runbook/RunbookStepTimeout.js.map +1 -0
  314. package/build/dist/Types/Telemetry/DropFilterSampling.js +75 -0
  315. package/build/dist/Types/Telemetry/DropFilterSampling.js.map +1 -0
  316. package/build/dist/UI/Components/AI/GenerateFromAIModal.js +1 -2
  317. package/build/dist/UI/Components/AI/GenerateFromAIModal.js.map +1 -1
  318. package/build/dist/UI/Components/Accordion/Accordion.js +9 -2
  319. package/build/dist/UI/Components/Accordion/Accordion.js.map +1 -1
  320. package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js +1 -1
  321. package/build/dist/UI/Components/BulkUpdate/BulkLabelActions.js.map +1 -1
  322. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +27 -14
  323. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  324. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js +1 -1
  325. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js.map +1 -1
  326. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +2 -20
  327. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  328. package/build/dist/UI/Components/Error/PageError.js +1 -3
  329. package/build/dist/UI/Components/Error/PageError.js.map +1 -1
  330. package/build/dist/UI/Components/ErrorBoundary.js +145 -11
  331. package/build/dist/UI/Components/ErrorBoundary.js.map +1 -1
  332. package/build/dist/UI/Components/InfoCard/InfoCard.js +28 -1
  333. package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
  334. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +13 -2
  335. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
  336. package/build/dist/UI/Components/Modal/Modal.js +4 -32
  337. package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
  338. package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
  339. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +69 -33
  340. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  341. package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js +73 -32
  342. package/build/dist/UI/Components/ModelTable/ColumnCustomizationModal.js.map +1 -1
  343. package/build/dist/UI/Components/Runbook/StepTimeoutInput.js +101 -0
  344. package/build/dist/UI/Components/Runbook/StepTimeoutInput.js.map +1 -0
  345. package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js +73 -0
  346. package/build/dist/UI/Components/StatusPage/ResourceGroupSection.js.map +1 -0
  347. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +13 -2
  348. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
  349. package/build/dist/UI/Utils/DropdownAlignment.js +98 -0
  350. package/build/dist/UI/Utils/DropdownAlignment.js.map +1 -0
  351. package/build/dist/UI/Utils/TableFilterUrlState.js +48 -15
  352. package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
  353. package/build/dist/Utils/API.js +39 -2
  354. package/build/dist/Utils/API.js.map +1 -1
  355. package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js +97 -0
  356. package/build/dist/Utils/Monitor/MonitorSummaryProbeUtil.js.map +1 -0
  357. package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js +330 -0
  358. package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js.map +1 -0
  359. package/build/dist/Utils/StatusPage/GroupNestingLayout.js +280 -0
  360. package/build/dist/Utils/StatusPage/GroupNestingLayout.js.map +1 -0
  361. package/build/dist/Utils/StatusPage/GroupTree.js +214 -0
  362. package/build/dist/Utils/StatusPage/GroupTree.js.map +1 -0
  363. package/build/dist/Utils/StatusPage/ResourceUptime.js +60 -16
  364. package/build/dist/Utils/StatusPage/ResourceUptime.js.map +1 -1
  365. package/package.json +1 -1
@@ -0,0 +1,458 @@
1
+ import CommonAPI from "../../../Server/API/CommonAPI";
2
+ import MonitorAPI from "../../../Server/API/MonitorAPI";
3
+ import WorkspaceNotificationRuleAPI from "../../../Server/API/WorkspaceNotificationRuleAPI";
4
+ import MonitorService from "../../../Server/Services/MonitorService";
5
+ import WorkspaceNotificationRuleService from "../../../Server/Services/WorkspaceNotificationRuleService";
6
+ import Monitor from "../../../Models/DatabaseModels/Monitor";
7
+ import WorkspaceNotificationRule from "../../../Models/DatabaseModels/WorkspaceNotificationRule";
8
+ import {
9
+ ExpressRequest,
10
+ ExpressResponse,
11
+ NextFunction,
12
+ } from "../../../Server/Utils/Express";
13
+ import Response from "../../../Server/Utils/Response";
14
+ import { mockRouter } from "./Helpers";
15
+ import DatabaseCommonInteractionProps from "../../../Types/BaseDatabase/DatabaseCommonInteractionProps";
16
+ import Dictionary from "../../../Types/Dictionary";
17
+ import BadDataException from "../../../Types/Exception/BadDataException";
18
+ import NotAuthorizedException from "../../../Types/Exception/NotAuthorizedException";
19
+ import ObjectID from "../../../Types/ObjectID";
20
+ import Permission, {
21
+ UserPermission,
22
+ UserTenantAccessPermission,
23
+ } from "../../../Types/Permission";
24
+ import {
25
+ afterEach,
26
+ beforeAll,
27
+ beforeEach,
28
+ describe,
29
+ expect,
30
+ test,
31
+ } from "@jest/globals";
32
+
33
+ /*
34
+ * Both routes covered here are custom (non-CRUD) routes mounted with only
35
+ * UserMiddleware.getUserMiddleware, which lets unauthenticated requests
36
+ * through as "public" and takes the project from a caller-supplied
37
+ * `tenantid` header. The work they trigger runs as root:
38
+ *
39
+ * - /workspace-notification-rule/test/:id loads the rule as root, takes the
40
+ * project from the rule itself, and posts a test message into that
41
+ * project's Slack / Teams channels (it can even create channels).
42
+ * - /monitor/refresh-status/:id reads and writes the monitor as root.
43
+ *
44
+ * So each route has to prove two things itself: the caller is an
45
+ * authenticated member of the project it claimed, AND the resource in the
46
+ * path belongs to that same project. Checking only the first would let a
47
+ * member of project A send their own tenant header while targeting project
48
+ * B's resource id.
49
+ */
50
+
51
+ jest.mock("../../../Server/Utils/Express", () => {
52
+ return {
53
+ getRouter: () => {
54
+ return mockRouter;
55
+ },
56
+ };
57
+ });
58
+
59
+ jest.mock("../../../Server/Utils/Response", () => {
60
+ return {
61
+ sendEntityArrayResponse: jest.fn().mockImplementation((...args: []) => {
62
+ return args;
63
+ }),
64
+ sendJsonObjectResponse: jest.fn().mockImplementation((...args: []) => {
65
+ return args;
66
+ }),
67
+ sendEmptySuccessResponse: jest.fn(),
68
+ sendEntityResponse: jest.fn().mockImplementation((...args: []) => {
69
+ return args;
70
+ }),
71
+ sendErrorResponse: jest.fn().mockImplementation((...args: []) => {
72
+ return args;
73
+ }),
74
+ };
75
+ });
76
+
77
+ const MONITOR_REFRESH_ROUTE: string = "/monitor/refresh-status/:monitorId";
78
+ const TEST_RULE_ROUTE: string =
79
+ "/workspace-notification-rule/test/:workspaceNotifcationRuleId";
80
+
81
+ function buildMemberProps(data: {
82
+ projectId: ObjectID;
83
+ userId: ObjectID;
84
+ }): DatabaseCommonInteractionProps {
85
+ const memberPermission: UserPermission = {
86
+ _type: "UserPermission",
87
+ permission: Permission.ProjectMember,
88
+ labelIds: [],
89
+ };
90
+
91
+ const tenantPermission: UserTenantAccessPermission = {
92
+ _type: "UserTenantAccessPermission",
93
+ projectId: data.projectId,
94
+ permissions: [memberPermission],
95
+ };
96
+
97
+ const permissionMap: Dictionary<UserTenantAccessPermission> = {};
98
+ permissionMap[data.projectId.toString()] = tenantPermission;
99
+
100
+ return {
101
+ tenantId: data.projectId,
102
+ userId: data.userId,
103
+ userTenantAccessPermission: permissionMap,
104
+ };
105
+ }
106
+
107
+ type RouteCallResult = {
108
+ thrownToNext: unknown;
109
+ nextCallCount: number;
110
+ };
111
+
112
+ async function callGetRoute(data: {
113
+ uri: string;
114
+ params: Dictionary<string>;
115
+ }): Promise<RouteCallResult> {
116
+ const req: ExpressRequest = {
117
+ params: data.params,
118
+ query: {},
119
+ body: {},
120
+ headers: {},
121
+ } as unknown as ExpressRequest;
122
+
123
+ const res: ExpressResponse = {
124
+ send: jest.fn(),
125
+ json: jest.fn(),
126
+ status: jest.fn().mockReturnThis(),
127
+ } as unknown as ExpressResponse;
128
+
129
+ const next: jest.Mock = jest.fn();
130
+
131
+ await mockRouter
132
+ .match("GET", data.uri)
133
+ .handlerFunction(req, res, next as unknown as NextFunction);
134
+
135
+ return {
136
+ thrownToNext: next.mock.calls[0] ? next.mock.calls[0][0] : undefined,
137
+ nextCallCount: next.mock.calls.length,
138
+ };
139
+ }
140
+
141
+ describe("Project-scoped custom routes require an authenticated member of the resource's project", () => {
142
+ let callerProjectId: ObjectID;
143
+ let otherProjectId: ObjectID;
144
+ let callerUserId: ObjectID;
145
+
146
+ beforeAll(() => {
147
+ mockRouter.routes.length = 0;
148
+ new MonitorAPI();
149
+ new WorkspaceNotificationRuleAPI();
150
+ });
151
+
152
+ beforeEach(() => {
153
+ jest.clearAllMocks();
154
+ callerProjectId = ObjectID.generate();
155
+ otherProjectId = ObjectID.generate();
156
+ callerUserId = ObjectID.generate();
157
+ });
158
+
159
+ afterEach(() => {
160
+ jest.restoreAllMocks();
161
+ });
162
+
163
+ describe("GET /monitor/refresh-status/:monitorId", () => {
164
+ let monitorId: ObjectID;
165
+ let refreshSpy: jest.SpyInstance;
166
+ let findOneByIdSpy: jest.SpyInstance;
167
+
168
+ function mockProps(props: DatabaseCommonInteractionProps): void {
169
+ jest
170
+ .spyOn(CommonAPI, "getDatabaseCommonInteractionProps")
171
+ .mockResolvedValue(props);
172
+ }
173
+
174
+ function mockMonitorInProject(projectId: ObjectID | null): void {
175
+ if (!projectId) {
176
+ findOneByIdSpy.mockResolvedValue(null);
177
+ return;
178
+ }
179
+
180
+ const monitor: Monitor = new Monitor();
181
+ monitor.id = monitorId;
182
+ monitor.projectId = projectId;
183
+ findOneByIdSpy.mockResolvedValue(monitor);
184
+ }
185
+
186
+ beforeEach(() => {
187
+ monitorId = ObjectID.generate();
188
+ findOneByIdSpy = jest.spyOn(MonitorService, "findOneById");
189
+ refreshSpy = jest
190
+ .spyOn(MonitorService, "refreshMonitorCurrentStatus")
191
+ .mockResolvedValue(undefined);
192
+ });
193
+
194
+ test("refreshes the monitor for a member of the monitor's own project", async () => {
195
+ mockProps(
196
+ buildMemberProps({
197
+ projectId: callerProjectId,
198
+ userId: callerUserId,
199
+ }),
200
+ );
201
+ mockMonitorInProject(callerProjectId);
202
+
203
+ const result: RouteCallResult = await callGetRoute({
204
+ uri: MONITOR_REFRESH_ROUTE,
205
+ params: { monitorId: monitorId.toString() },
206
+ });
207
+
208
+ expect(result.nextCallCount).toBe(0);
209
+ expect(refreshSpy).toHaveBeenCalledTimes(1);
210
+ expect((refreshSpy.mock.calls[0]![0] as ObjectID).toString()).toBe(
211
+ monitorId.toString(),
212
+ );
213
+ expect(Response.sendEmptySuccessResponse).toHaveBeenCalledTimes(1);
214
+ });
215
+
216
+ /*
217
+ * The owning project has to come off the monitor row, not off the
218
+ * caller-supplied header — pin the read that derives it.
219
+ */
220
+ test("derives the owning project from the monitor row itself", async () => {
221
+ mockProps(
222
+ buildMemberProps({
223
+ projectId: callerProjectId,
224
+ userId: callerUserId,
225
+ }),
226
+ );
227
+ mockMonitorInProject(callerProjectId);
228
+
229
+ await callGetRoute({
230
+ uri: MONITOR_REFRESH_ROUTE,
231
+ params: { monitorId: monitorId.toString() },
232
+ });
233
+
234
+ expect(findOneByIdSpy).toHaveBeenCalledTimes(1);
235
+ const readArgs: {
236
+ id: ObjectID;
237
+ select: Dictionary<boolean>;
238
+ props: Dictionary<boolean>;
239
+ } = findOneByIdSpy.mock.calls[0]![0] as {
240
+ id: ObjectID;
241
+ select: Dictionary<boolean>;
242
+ props: Dictionary<boolean>;
243
+ };
244
+ expect(readArgs.id.toString()).toBe(monitorId.toString());
245
+ expect(readArgs.select["projectId"]).toBe(true);
246
+ expect(readArgs.props["isRoot"]).toBe(true);
247
+ });
248
+
249
+ test("rejects an unauthenticated caller with BadDataException and never reads the monitor", async () => {
250
+ mockProps({});
251
+
252
+ const result: RouteCallResult = await callGetRoute({
253
+ uri: MONITOR_REFRESH_ROUTE,
254
+ params: { monitorId: monitorId.toString() },
255
+ });
256
+
257
+ expect(result.thrownToNext).toBeInstanceOf(BadDataException);
258
+ expect(findOneByIdSpy).not.toHaveBeenCalled();
259
+ expect(refreshSpy).not.toHaveBeenCalled();
260
+ });
261
+
262
+ test("rejects a public caller that supplies a tenant header it is not a member of", async () => {
263
+ mockProps({
264
+ tenantId: callerProjectId,
265
+ userId: undefined,
266
+ userTenantAccessPermission: undefined,
267
+ });
268
+
269
+ const result: RouteCallResult = await callGetRoute({
270
+ uri: MONITOR_REFRESH_ROUTE,
271
+ params: { monitorId: monitorId.toString() },
272
+ });
273
+
274
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
275
+ expect(findOneByIdSpy).not.toHaveBeenCalled();
276
+ expect(refreshSpy).not.toHaveBeenCalled();
277
+ });
278
+
279
+ test("rejects a member of one project targeting another project's monitor id", async () => {
280
+ mockProps(
281
+ buildMemberProps({
282
+ projectId: callerProjectId,
283
+ userId: callerUserId,
284
+ }),
285
+ );
286
+ mockMonitorInProject(otherProjectId);
287
+
288
+ const result: RouteCallResult = await callGetRoute({
289
+ uri: MONITOR_REFRESH_ROUTE,
290
+ params: { monitorId: monitorId.toString() },
291
+ });
292
+
293
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
294
+ expect(refreshSpy).not.toHaveBeenCalled();
295
+ });
296
+
297
+ test("rejects a monitor id that does not exist", async () => {
298
+ mockProps(
299
+ buildMemberProps({
300
+ projectId: callerProjectId,
301
+ userId: callerUserId,
302
+ }),
303
+ );
304
+ mockMonitorInProject(null);
305
+
306
+ const result: RouteCallResult = await callGetRoute({
307
+ uri: MONITOR_REFRESH_ROUTE,
308
+ params: { monitorId: monitorId.toString() },
309
+ });
310
+
311
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
312
+ expect(refreshSpy).not.toHaveBeenCalled();
313
+ });
314
+ });
315
+
316
+ describe("GET /workspace-notification-rule/test/:workspaceNotifcationRuleId", () => {
317
+ let ruleId: ObjectID;
318
+ let testRuleSpy: jest.SpyInstance;
319
+ let findOneByIdSpy: jest.SpyInstance;
320
+
321
+ function mockProps(props: DatabaseCommonInteractionProps): void {
322
+ jest
323
+ .spyOn(CommonAPI, "getDatabaseCommonInteractionProps")
324
+ .mockResolvedValue(props);
325
+ }
326
+
327
+ function mockRuleInProject(projectId: ObjectID | null): void {
328
+ if (!projectId) {
329
+ findOneByIdSpy.mockResolvedValue(null);
330
+ return;
331
+ }
332
+
333
+ const rule: WorkspaceNotificationRule = new WorkspaceNotificationRule();
334
+ rule.id = ruleId;
335
+ rule.projectId = projectId;
336
+ findOneByIdSpy.mockResolvedValue(rule);
337
+ }
338
+
339
+ beforeEach(() => {
340
+ ruleId = ObjectID.generate();
341
+ findOneByIdSpy = jest.spyOn(
342
+ WorkspaceNotificationRuleService,
343
+ "findOneById",
344
+ );
345
+ testRuleSpy = jest
346
+ .spyOn(WorkspaceNotificationRuleService, "testRule")
347
+ .mockResolvedValue(undefined);
348
+ });
349
+
350
+ test("tests the rule for a member of the rule's own project", async () => {
351
+ mockProps(
352
+ buildMemberProps({
353
+ projectId: callerProjectId,
354
+ userId: callerUserId,
355
+ }),
356
+ );
357
+ mockRuleInProject(callerProjectId);
358
+
359
+ const result: RouteCallResult = await callGetRoute({
360
+ uri: TEST_RULE_ROUTE,
361
+ params: { workspaceNotifcationRuleId: ruleId.toString() },
362
+ });
363
+
364
+ expect(result.nextCallCount).toBe(0);
365
+ expect(testRuleSpy).toHaveBeenCalledTimes(1);
366
+
367
+ const testRuleArgs: {
368
+ ruleId: ObjectID;
369
+ projectId: ObjectID;
370
+ testByUserId: ObjectID;
371
+ } = testRuleSpy.mock.calls[0]![0] as {
372
+ ruleId: ObjectID;
373
+ projectId: ObjectID;
374
+ testByUserId: ObjectID;
375
+ };
376
+ expect(testRuleArgs.ruleId.toString()).toBe(ruleId.toString());
377
+ expect(testRuleArgs.projectId.toString()).toBe(
378
+ callerProjectId.toString(),
379
+ );
380
+ expect(testRuleArgs.testByUserId.toString()).toBe(
381
+ callerUserId.toString(),
382
+ );
383
+ expect(Response.sendEmptySuccessResponse).toHaveBeenCalledTimes(1);
384
+ });
385
+
386
+ test("rejects an unauthenticated caller with BadDataException and never reads the rule", async () => {
387
+ mockProps({});
388
+
389
+ const result: RouteCallResult = await callGetRoute({
390
+ uri: TEST_RULE_ROUTE,
391
+ params: { workspaceNotifcationRuleId: ruleId.toString() },
392
+ });
393
+
394
+ expect(result.thrownToNext).toBeInstanceOf(BadDataException);
395
+ expect(findOneByIdSpy).not.toHaveBeenCalled();
396
+ expect(testRuleSpy).not.toHaveBeenCalled();
397
+ });
398
+
399
+ test("rejects a public caller that supplies a tenant header it is not a member of", async () => {
400
+ mockProps({
401
+ tenantId: callerProjectId,
402
+ userId: undefined,
403
+ userTenantAccessPermission: undefined,
404
+ });
405
+
406
+ const result: RouteCallResult = await callGetRoute({
407
+ uri: TEST_RULE_ROUTE,
408
+ params: { workspaceNotifcationRuleId: ruleId.toString() },
409
+ });
410
+
411
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
412
+ expect(findOneByIdSpy).not.toHaveBeenCalled();
413
+ expect(testRuleSpy).not.toHaveBeenCalled();
414
+ });
415
+
416
+ /*
417
+ * testRule overwrites the project it is handed with the rule's own
418
+ * projectId, so a member of project A targeting project B's rule id
419
+ * would otherwise get a test message posted into project B's Slack /
420
+ * Teams channels.
421
+ */
422
+ test("rejects a member of one project targeting another project's rule id", async () => {
423
+ mockProps(
424
+ buildMemberProps({
425
+ projectId: callerProjectId,
426
+ userId: callerUserId,
427
+ }),
428
+ );
429
+ mockRuleInProject(otherProjectId);
430
+
431
+ const result: RouteCallResult = await callGetRoute({
432
+ uri: TEST_RULE_ROUTE,
433
+ params: { workspaceNotifcationRuleId: ruleId.toString() },
434
+ });
435
+
436
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
437
+ expect(testRuleSpy).not.toHaveBeenCalled();
438
+ });
439
+
440
+ test("rejects a rule id that does not exist", async () => {
441
+ mockProps(
442
+ buildMemberProps({
443
+ projectId: callerProjectId,
444
+ userId: callerUserId,
445
+ }),
446
+ );
447
+ mockRuleInProject(null);
448
+
449
+ const result: RouteCallResult = await callGetRoute({
450
+ uri: TEST_RULE_ROUTE,
451
+ params: { workspaceNotifcationRuleId: ruleId.toString() },
452
+ });
453
+
454
+ expect(result.thrownToNext).toBeInstanceOf(NotAuthorizedException);
455
+ expect(testRuleSpy).not.toHaveBeenCalled();
456
+ });
457
+ });
458
+ });