@oneuptime/common 12.0.6 → 12.0.8

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 (594) hide show
  1. package/Models/DatabaseModels/AIInsight.ts +1 -1
  2. package/Models/DatabaseModels/DatabaseBaseModel/FileModel.ts +2 -3
  3. package/Models/DatabaseModels/DeletedProject.ts +595 -0
  4. package/Models/DatabaseModels/Index.ts +2 -0
  5. package/Models/DatabaseModels/Monitor.ts +111 -0
  6. package/Models/DatabaseModels/Project.ts +3 -3
  7. package/Models/DatabaseModels/TelemetryEntity.ts +45 -0
  8. package/Models/DatabaseModels/TelemetryEntityRelationship.ts +26 -0
  9. package/Models/DatabaseModels/WorkflowLog.ts +38 -0
  10. package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +19 -1
  11. package/Server/API/FileAPI.ts +15 -2
  12. package/Server/API/MicrosoftTeamsAPI.ts +6 -1
  13. package/Server/API/ProjectAPI.ts +214 -0
  14. package/Server/API/StatusPageAPI.ts +39 -6
  15. package/Server/API/UserAPI.ts +16 -1
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1786446545142-MigrationName.ts +50 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1786449497966-AddMonitorDependency.ts +67 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/1786461136170-AddDeletedProjectTable.ts +39 -0
  19. package/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.ts +41 -0
  20. package/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.ts +17 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +10 -0
  22. package/Server/Middleware/MasterAdminAuthorization.ts +11 -6
  23. package/Server/Services/AIAgentService.ts +20 -0
  24. package/Server/Services/DashboardDomainService.ts +73 -28
  25. package/Server/Services/DatabaseService.ts +1 -0
  26. package/Server/Services/DeletedProjectService.ts +138 -0
  27. package/Server/Services/FileService.ts +61 -0
  28. package/Server/Services/IncidentEpisodePublicNoteService.ts +18 -0
  29. package/Server/Services/IncidentPublicNoteService.ts +18 -0
  30. package/Server/Services/Index.ts +2 -0
  31. package/Server/Services/MonitorService.ts +311 -0
  32. package/Server/Services/ProbeService.ts +20 -0
  33. package/Server/Services/ProjectService.ts +297 -1
  34. package/Server/Services/PushNotificationService.ts +71 -0
  35. package/Server/Services/ScheduledMaintenancePublicNoteService.ts +18 -0
  36. package/Server/Services/StatusPageAnnouncementService.ts +53 -0
  37. package/Server/Services/StatusPageDomainService.ts +73 -28
  38. package/Server/Services/TeamMemberService.ts +117 -12
  39. package/Server/Services/TelemetryEntityRelationshipService.ts +3 -0
  40. package/Server/Services/TelemetryEntityService.ts +114 -1
  41. package/Server/Services/TelemetryIngestionKeyService.ts +1 -0
  42. package/Server/Services/UserWebhookService.ts +34 -109
  43. package/Server/Services/WorkspaceNotificationRuleService.ts +69 -0
  44. package/Server/Services/WorkspaceProjectAuthTokenService.ts +37 -1
  45. package/Server/Types/Database/DeleteById.ts +2 -0
  46. package/Server/Types/Database/DeleteOneBy.ts +6 -0
  47. package/Server/Types/Domain.ts +41 -0
  48. package/Server/Types/Workflow/Components/API/Delete.ts +2 -1
  49. package/Server/Types/Workflow/Components/API/Get.ts +2 -1
  50. package/Server/Types/Workflow/Components/API/Patch.ts +2 -1
  51. package/Server/Types/Workflow/Components/API/Post.ts +2 -1
  52. package/Server/Types/Workflow/Components/API/Put.ts +2 -1
  53. package/Server/Types/Workflow/Components/API/Utils.ts +85 -3
  54. package/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.ts +25 -19
  55. package/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.ts +6 -5
  56. package/Server/Types/Workflow/Components/BaseModel/DeleteManyBaseModel.ts +32 -14
  57. package/Server/Types/Workflow/Components/BaseModel/DeleteOneBaseModel.ts +31 -13
  58. package/Server/Types/Workflow/Components/BaseModel/FindManyBaseModel.ts +29 -20
  59. package/Server/Types/Workflow/Components/BaseModel/FindOneBaseModel.ts +28 -21
  60. package/Server/Types/Workflow/Components/BaseModel/LogComponentError.ts +89 -0
  61. package/Server/Types/Workflow/Components/BaseModel/ModelArguments.ts +208 -0
  62. package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +11 -0
  63. package/Server/Types/Workflow/Components/BaseModel/UpdateManyBaseModel.ts +41 -18
  64. package/Server/Types/Workflow/Components/BaseModel/UpdateOneBaseModel.ts +45 -19
  65. package/Server/Types/Workflow/Components/Discord/SendMessageToChannel.ts +16 -9
  66. package/Server/Types/Workflow/Components/IncomingWebhookUtils.ts +66 -0
  67. package/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.ts +15 -9
  68. package/Server/Types/Workflow/Components/Slack/SendMessageToChannel.ts +17 -0
  69. package/Server/Types/Workflow/TriggerCode.ts +12 -0
  70. package/Server/Types/Workflow/Workflow.ts +5 -0
  71. package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +1 -1
  72. package/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.ts +171 -0
  73. package/Server/Utils/AI/SRE/FixFromIncidentTaskTrigger.ts +3 -3
  74. package/Server/Utils/AI/SRE/Insights/FixRouting.ts +3 -2
  75. package/Server/Utils/AI/SRE/TelemetryImprovementTaskTrigger.ts +1 -1
  76. package/Server/Utils/AI/Toolbox/CodeWriteTools.ts +6 -6
  77. package/Server/Utils/CodeRepository/GitHub/GitHub.ts +43 -5
  78. package/Server/Utils/DataSource/EgressGuard.ts +176 -16
  79. package/Server/Utils/DataSource/HttpFetch.ts +6 -45
  80. package/Server/Utils/Execute.ts +8 -0
  81. package/Server/Utils/InlineImageAccessTokenSync.ts +23 -0
  82. package/Server/Utils/LLM/LLMService.ts +57 -12
  83. package/Server/Utils/Monitor/MonitorAlert.ts +40 -0
  84. package/Server/Utils/Monitor/MonitorDependencySuppression.ts +192 -0
  85. package/Server/Utils/Monitor/MonitorIncident.ts +40 -0
  86. package/Server/Utils/Monitor/MonitorResource.ts +36 -0
  87. package/Server/Utils/Response.ts +142 -6
  88. package/Server/Utils/SSRFProtection.ts +273 -60
  89. package/Server/Utils/StartServer.ts +8 -0
  90. package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +689 -0
  91. package/Server/Utils/VM/VMAPI.ts +56 -8
  92. package/Server/Utils/VM/VMRunner.ts +88 -1
  93. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +555 -49
  94. package/Server/Utils/Workspace/Slack/Slack.ts +25 -2
  95. package/Server/Utils/Workspace/WorkspaceBase.ts +6 -0
  96. package/Tests/App/Dashboard/DangerZone.test.tsx +334 -0
  97. package/Tests/App/Dashboard/DashboardVariableAllContract.test.tsx +539 -0
  98. package/Tests/App/Dashboard/DashboardVariableSelector.test.tsx +678 -0
  99. package/Tests/App/Dashboard/DashboardVariablesDiscard.test.tsx +706 -0
  100. package/Tests/App/Dashboard/DashboardVariablesModal.test.tsx +508 -0
  101. package/Tests/App/Dashboard/MonitorCriteriaAttributeFilter.test.tsx +574 -0
  102. package/Tests/App/PublicDashboard/DashboardVariableSelector.test.tsx +470 -0
  103. package/Tests/App/StatusPage/StatusPageDetailPagesNotFound.test.tsx +308 -0
  104. package/Tests/Models/DatabaseModels/DeletedProjectModel.test.ts +251 -0
  105. package/Tests/Models/DatabaseModels/SavedViewJSONColumnTuples.test.ts +115 -0
  106. package/Tests/Server/API/FileAPIAccessControl.test.ts +316 -0
  107. package/Tests/Server/API/ProjectAPI.test.ts +299 -1
  108. package/Tests/Server/API/ProjectAPIAdjustBalance.test.ts +459 -0
  109. package/Tests/Server/API/ProjectAPIAdjustBalanceBillingDisabled.test.ts +177 -0
  110. package/Tests/Server/API/UserProjectsAPI.test.ts +478 -4
  111. package/Tests/Server/Services/DatabaseServiceDeletionReason.test.ts +123 -0
  112. package/Tests/Server/Services/DeletedProjectService.test.ts +415 -0
  113. package/Tests/Server/Services/DeletedProjectServiceSelfHosted.test.ts +70 -0
  114. package/Tests/Server/Services/DomainSubdomainHooks.test.ts +94 -0
  115. package/Tests/Server/Services/FileIsPublicBooleanMigration.test.ts +244 -0
  116. package/Tests/Server/Services/FileServiceMimeType.test.ts +89 -0
  117. package/Tests/Server/Services/MonitorServiceDependencyValidation.test.ts +702 -0
  118. package/Tests/Server/Services/ProjectServiceAdjustBalance.test.ts +615 -0
  119. package/Tests/Server/Services/ProjectServiceDeleteAudit.test.ts +406 -0
  120. package/Tests/Server/Services/PublishTimeImageVisibility.test.ts +450 -0
  121. package/Tests/Server/Services/TeamMemberAutoAcceptInvitation.test.ts +669 -0
  122. package/Tests/Server/Services/TelemetryEntityManualCreate.test.ts +248 -0
  123. package/Tests/Server/Services/UserWebhookSSRF.test.ts +174 -0
  124. package/Tests/Server/Services/WebPushEndpointAllowlist.test.ts +133 -0
  125. package/Tests/Server/Services/WorkspaceProjectAuthTokenRepoint.test.ts +618 -0
  126. package/Tests/Server/Types/Workflow/Components/ApiComponentErrorPort.test.ts +26 -1
  127. package/Tests/Server/Types/Workflow/Components/ApiComponentHeaders.test.ts +192 -0
  128. package/Tests/Server/Types/Workflow/Components/ApiComponentSsrf.test.ts +215 -0
  129. package/Tests/Server/Types/Workflow/Components/BaseModelDatabaseComponents.test.ts +742 -0
  130. package/Tests/Server/Types/Workflow/Components/ChatWebhookComponents.test.ts +256 -0
  131. package/Tests/Server/Types/Workflow/Components/ModelArguments.test.ts +371 -0
  132. package/Tests/Server/Utils/AI/CodeAgentCommandGuard.test.ts +204 -0
  133. package/Tests/Server/Utils/AI/CodeAgentWriteLimits.test.ts +213 -0
  134. package/Tests/Server/Utils/AI/CodeWriteTools.test.ts +52 -5
  135. package/Tests/Server/Utils/AI/LLMServiceBaseUrl.test.ts +3 -0
  136. package/Tests/Server/Utils/AI/LLMServiceEgressGuard.test.ts +315 -0
  137. package/Tests/Server/Utils/AI/LLMServiceModelCompatibility.test.ts +3 -0
  138. package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +17 -5
  139. package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +14 -1
  140. package/Tests/Server/Utils/AI/ObservabilityChatPrompt.test.ts +35 -0
  141. package/Tests/Server/Utils/AI/StubLLMEgressGuard.ts +25 -0
  142. package/Tests/Server/Utils/AnalyticsDatabase/QuerySettingsHelper.test.ts +152 -0
  143. package/Tests/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.test.ts +62 -7
  144. package/Tests/Server/Utils/DataSource/EgressGuard.test.ts +69 -0
  145. package/Tests/Server/Utils/DataSource/EgressGuardPinning.test.ts +330 -0
  146. package/Tests/Server/Utils/GitHubCreatePullRequestWithToken.test.ts +393 -0
  147. package/Tests/Server/Utils/InlineImageAccessTokenSync.test.ts +202 -0
  148. package/Tests/Server/Utils/Monitor/MonitorDependencySuppression.test.ts +811 -0
  149. package/Tests/Server/Utils/Monitor/MonitorDependencySuppressionCreatorSkip.test.ts +604 -0
  150. package/Tests/Server/Utils/ResponseSendFileResponse.test.ts +192 -0
  151. package/Tests/Server/Utils/SSRFProtectionBypasses.test.ts +406 -0
  152. package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +322 -0
  153. package/Tests/Server/Utils/VM/VMAPISubstitution.test.ts +243 -0
  154. package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +194 -0
  155. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelSend.test.ts +1169 -0
  156. package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelsList.test.ts +2 -0
  157. package/Tests/Server/Utils/Workspace/MicrosoftTeamsTeamInstalls.test.ts +1605 -0
  158. package/Tests/Server/Utils/Workspace/MicrosoftTeamsTenantResolution.test.ts +1218 -0
  159. package/Tests/Types/AI/AIChatMessageStatus.test.ts +79 -0
  160. package/Tests/Types/AI/AIInsightStatus.test.ts +40 -0
  161. package/Tests/Types/API/HostnameAuthorityParsing.test.ts +157 -0
  162. package/Tests/Types/Dashboard/DashboardTemplateInvariants.test.ts +27 -0
  163. package/Tests/Types/DataSource/DataSourceLimits.test.ts +71 -0
  164. package/Tests/Types/DataSource/DataSourceType.test.ts +181 -0
  165. package/Tests/Types/DomainSubdomainValidation.test.ts +90 -0
  166. package/Tests/Types/JSONFunctions.test.ts +252 -1
  167. package/Tests/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.test.ts +61 -0
  168. package/Tests/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.test.ts +62 -0
  169. package/Tests/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.test.ts +68 -0
  170. package/Tests/Types/Monitor/SnmpMonitor/SnmpVersion.test.ts +51 -0
  171. package/Tests/Types/SerializableObjectDictionaryImportCycle.test.ts +197 -0
  172. package/Tests/Types/Telemetry/EntityTypeGroups.test.ts +140 -0
  173. package/Tests/Types/Workflow/StepTrace.test.ts +235 -0
  174. package/Tests/Types/Workflow/TemplateSyntax.test.ts +379 -0
  175. package/Tests/Types/Workflow/Templates.test.ts +403 -0
  176. package/Tests/UI/Components/404.test.tsx +1 -1
  177. package/Tests/UI/Components/Alert.test.tsx +1 -1
  178. package/Tests/UI/Components/Badge.test.tsx +1 -1
  179. package/Tests/UI/Components/BasicForm.test.tsx +39 -10
  180. package/Tests/UI/Components/Button.test.tsx +1 -1
  181. package/Tests/UI/Components/Card.test.tsx +1 -1
  182. package/Tests/UI/Components/Charts/AxisTickColor.test.tsx +1 -1
  183. package/Tests/UI/Components/ColorViewer.test.tsx +1 -1
  184. package/Tests/UI/Components/ComponentsModal.test.tsx +7 -1
  185. package/Tests/UI/Components/CustomTimeRangeModal.test.tsx +459 -0
  186. package/Tests/UI/Components/DictionaryAttributeFilterRow.test.tsx +477 -0
  187. package/Tests/UI/Components/DictionaryOfStrings.test.tsx +1 -1
  188. package/Tests/UI/Components/Dropdown.test.tsx +1 -1
  189. package/Tests/UI/Components/FilePicker.test.tsx +1 -1
  190. package/Tests/UI/Components/Forms/AnchoredFieldPopupKeyboard.test.tsx +382 -0
  191. package/Tests/UI/Components/Forms/ColorPickerPicking.test.tsx +569 -0
  192. package/Tests/UI/Components/Forms/ValidationJSON.test.ts +241 -0
  193. package/Tests/UI/Components/HiddenText.test.tsx +1 -1
  194. package/Tests/UI/Components/Input.test.tsx +1 -1
  195. package/Tests/UI/Components/Loader.test.tsx +1 -1
  196. package/Tests/UI/Components/LogTimeRangePicker.test.tsx +43 -1
  197. package/Tests/UI/Components/MasterPage.test.tsx +1 -1
  198. package/Tests/UI/Components/ModalPortalDismissal.test.tsx +579 -0
  199. package/Tests/UI/Components/ModelDelete.test.tsx +214 -0
  200. package/Tests/UI/Components/ModelTable/BaseModelTableBulkSelectAll.test.tsx +1 -1
  201. package/Tests/UI/Components/ModelTable/BaseModelTableColumnCustomization.test.tsx +1 -1
  202. package/Tests/UI/Components/ModelTable/BaseModelTableSearchLabels.test.tsx +1 -1
  203. package/Tests/UI/Components/ModelTable/BaseModelTableUrlState.test.tsx +1 -1
  204. package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +1 -1
  205. package/Tests/UI/Components/NavBar.test.tsx +1 -1
  206. package/Tests/UI/Components/OperatorSelectorKeyboard.test.tsx +1 -1
  207. package/Tests/UI/Components/Pagination.test.tsx +1 -1
  208. package/Tests/UI/Components/Pill.test.tsx +1 -1
  209. package/Tests/UI/Components/Probe.test.tsx +1 -1
  210. package/Tests/UI/Components/ProgressBar.test.tsx +1 -1
  211. package/Tests/UI/Components/RadioButtons.test.tsx +1 -1
  212. package/Tests/UI/Components/SideMenuItem.test.tsx +1 -1
  213. package/Tests/UI/Components/SideOver.test.tsx +500 -6
  214. package/Tests/UI/Components/Tabs.test.tsx +1 -1
  215. package/Tests/UI/Components/TelemetrySearchBar.test.tsx +1 -1
  216. package/Tests/UI/Components/TelemetryTimeRangePicker.test.tsx +50 -8
  217. package/Tests/UI/Components/TextArea.test.tsx +1 -1
  218. package/Tests/UI/Components/TimeRangePickerDropdown.test.tsx +325 -0
  219. package/Tests/UI/Components/Toast.test.tsx +1 -1
  220. package/Tests/UI/Components/Toggle.test.tsx +1 -1
  221. package/Tests/UI/Components/TopSection.test.tsx +1 -1
  222. package/Tests/UI/Components/UseLiveLogsRefresh.test.tsx +1 -1
  223. package/Tests/UI/Components/Workflow/GraphLint.test.ts +821 -0
  224. package/Tests/UI/Components/Workflow/ModelColumnEditor.test.ts +287 -0
  225. package/Tests/UI/Components/Workflow/ModelColumnEditorServerContract.test.ts +185 -0
  226. package/Tests/UI/Components/Workflow/ModelSchema.test.ts +174 -0
  227. package/Tests/UI/Components/Workflow/RunStatusWatcher.test.ts +152 -0
  228. package/Tests/UI/Components/Workflow/Utils.test.ts +192 -0
  229. package/Tests/UI/Monitor/MonitorStepCriteriaView.test.tsx +432 -0
  230. package/Tests/UI/Rum/ReplayScrubber.test.tsx +1 -1
  231. package/Tests/UI/Rum/ReplayStage.test.tsx +1 -1
  232. package/Tests/UI/Telemetry/TelemetrySnapshotWindowAlert.test.tsx +1 -1
  233. package/Tests/UI/Utils/LocalStorageArrayRoundTrip.test.ts +72 -0
  234. package/Tests/Utils/Dashboard/HtmlWidgetDocument.test.ts +19 -2
  235. package/Tests/Utils/Dashboard/ModelQueryVariableInterpolation.test.ts +44 -0
  236. package/Tests/Utils/Dashboard/VariableInterpolation.test.ts +288 -5
  237. package/Tests/Utils/Dashboard/VariableUrlState.test.ts +42 -0
  238. package/Tests/Utils/DataSource/DataSourceQueryText.test.ts +27 -0
  239. package/Tests/Utils/LegacySerializedArray.test.ts +139 -0
  240. package/Tests/Utils/Monitor/MonitorDependencyRule.test.ts +190 -0
  241. package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +514 -0
  242. package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +240 -0
  243. package/Tests/Utils/Realtime.test.ts +78 -0
  244. package/Tests/Utils/Schema/AnalyticsModelSchema.test.ts +469 -0
  245. package/Tests/Utils/Schema/ModelSchema.test.ts +268 -0
  246. package/Tests/Utils/Telemetry/EntityKeyNonTelemetry.test.ts +193 -0
  247. package/Tests/Utils/Telemetry/SavedViewFilters.test.ts +246 -0
  248. package/Tests/__mocks__/i18next-browser-languagedetector.js +21 -0
  249. package/Types/AI/FixPullRequestCiStatus.ts +1 -1
  250. package/Types/AI/FixVerificationStatus.ts +2 -2
  251. package/Types/API/Hostname.ts +92 -4
  252. package/Types/API/URL.ts +43 -25
  253. package/Types/Billing/BalanceAdjustmentType.ts +14 -0
  254. package/Types/Billing/ProjectBalanceType.ts +13 -0
  255. package/Types/Domain.ts +26 -0
  256. package/Types/File/MimeType.ts +11 -0
  257. package/Types/JSONFunctions.ts +15 -0
  258. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -0
  259. package/Types/SerializableObjectDictionary.ts +133 -39
  260. package/Types/Telemetry/EntitySource.ts +40 -0
  261. package/Types/Telemetry/EntityType.ts +27 -0
  262. package/Types/Telemetry/EntityTypeGroups.ts +65 -0
  263. package/Types/Telemetry/TelemetrySavedViewState.ts +9 -1
  264. package/Types/Workflow/Component.ts +29 -0
  265. package/Types/Workflow/Components/API.ts +35 -0
  266. package/Types/Workflow/Components/BaseModel.ts +96 -28
  267. package/Types/Workflow/StepTrace.ts +181 -0
  268. package/Types/Workflow/TemplateSyntax.ts +499 -0
  269. package/Types/Workflow/Templates.ts +316 -0
  270. package/Typings/Index.d.ts +12 -0
  271. package/UI/Components/Date/CustomTimeRangeModal.tsx +278 -0
  272. package/UI/Components/Date/TimeRangePickerDropdown.tsx +250 -0
  273. package/UI/Components/Dictionary/Dictionary.tsx +23 -6
  274. package/UI/Components/Forms/Fields/ColorPicker.tsx +66 -10
  275. package/UI/Components/Forms/Fields/IconPicker.tsx +48 -10
  276. package/UI/Components/Forms/Types/Field.ts +7 -0
  277. package/UI/Components/Forms/Validation.ts +63 -1
  278. package/UI/Components/GanttChart/ChartContainer.tsx +4 -3
  279. package/UI/Components/Input/Input.tsx +31 -3
  280. package/UI/Components/LogsViewer/components/LogTimeRangePicker.tsx +11 -216
  281. package/UI/Components/Modal/ConfirmModal.tsx +10 -5
  282. package/UI/Components/Modal/Modal.tsx +64 -51
  283. package/UI/Components/ModelDelete/ModelDelete.tsx +23 -6
  284. package/UI/Components/SideOver/SideOver.tsx +195 -68
  285. package/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.tsx +11 -210
  286. package/UI/Components/Workflow/ArgumentsForm.tsx +194 -7
  287. package/UI/Components/Workflow/Component.tsx +28 -26
  288. package/UI/Components/Workflow/ComponentSettingsModal.tsx +69 -8
  289. package/UI/Components/Workflow/GraphLint.ts +591 -0
  290. package/UI/Components/Workflow/ModelColumnEditor.tsx +396 -0
  291. package/UI/Components/Workflow/ModelSchema.ts +196 -0
  292. package/UI/Components/Workflow/RunForm.tsx +41 -7
  293. package/UI/Components/Workflow/RunStatusWatcher.ts +122 -0
  294. package/UI/Components/Workflow/StepTraceViewer.tsx +186 -0
  295. package/UI/Components/Workflow/Utils.ts +93 -1
  296. package/UI/Components/Workflow/Workflow.tsx +77 -4
  297. package/UI/Types/LayeredDismissal.ts +31 -0
  298. package/UI/Types/UseAnchoredFieldPopup.ts +99 -0
  299. package/UI/Utils/PageScrollLock.ts +66 -0
  300. package/Utils/Dashboard/HtmlWidgetDocument.ts +4 -2
  301. package/Utils/Dashboard/VariableInterpolation.ts +19 -1
  302. package/Utils/LegacySerializedArray.ts +60 -0
  303. package/Utils/Monitor/MonitorDependencyRule.ts +88 -0
  304. package/Utils/Monitor/NetworkDeviceRoleUtil.ts +533 -0
  305. package/Utils/Monitor/NetworkTopologyUtil.ts +45 -7
  306. package/Utils/Telemetry/EntityKey.ts +66 -0
  307. package/Utils/Telemetry/SavedViewFilters.ts +88 -0
  308. package/build/dist/Models/DatabaseModels/AIInsight.js +1 -1
  309. package/build/dist/Models/DatabaseModels/AIInsight.js.map +1 -1
  310. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/FileModel.js +2 -3
  311. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/FileModel.js.map +1 -1
  312. package/build/dist/Models/DatabaseModels/DeletedProject.js +640 -0
  313. package/build/dist/Models/DatabaseModels/DeletedProject.js.map +1 -0
  314. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  315. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  316. package/build/dist/Models/DatabaseModels/Monitor.js +106 -0
  317. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  318. package/build/dist/Models/DatabaseModels/Project.js +3 -3
  319. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  320. package/build/dist/Models/DatabaseModels/TelemetryEntity.js +47 -0
  321. package/build/dist/Models/DatabaseModels/TelemetryEntity.js.map +1 -1
  322. package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js +27 -0
  323. package/build/dist/Models/DatabaseModels/TelemetryEntityRelationship.js.map +1 -1
  324. package/build/dist/Models/DatabaseModels/WorkflowLog.js +39 -0
  325. package/build/dist/Models/DatabaseModels/WorkflowLog.js.map +1 -1
  326. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
  327. package/build/dist/Server/API/FileAPI.js +14 -2
  328. package/build/dist/Server/API/FileAPI.js.map +1 -1
  329. package/build/dist/Server/API/MicrosoftTeamsAPI.js +6 -1
  330. package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
  331. package/build/dist/Server/API/ProjectAPI.js +157 -4
  332. package/build/dist/Server/API/ProjectAPI.js.map +1 -1
  333. package/build/dist/Server/API/StatusPageAPI.js +27 -3
  334. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  335. package/build/dist/Server/API/UserAPI.js +16 -1
  336. package/build/dist/Server/API/UserAPI.js.map +1 -1
  337. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786446545142-MigrationName.js +34 -0
  338. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786446545142-MigrationName.js.map +1 -0
  339. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786449497966-AddMonitorDependency.js +30 -0
  340. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786449497966-AddMonitorDependency.js.map +1 -0
  341. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786461136170-AddDeletedProjectTable.js +20 -0
  342. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786461136170-AddDeletedProjectTable.js.map +1 -0
  343. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.js +20 -0
  344. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786551733814-MigrationName.js.map +1 -0
  345. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.js +12 -0
  346. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1786559879134-AddWorkflowLogStepTrace.js.map +1 -0
  347. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +10 -0
  348. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  349. package/build/dist/Server/Middleware/MasterAdminAuthorization.js +11 -6
  350. package/build/dist/Server/Middleware/MasterAdminAuthorization.js.map +1 -1
  351. package/build/dist/Server/Services/AIAgentService.js +17 -0
  352. package/build/dist/Server/Services/AIAgentService.js.map +1 -1
  353. package/build/dist/Server/Services/DashboardDomainService.js +55 -18
  354. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -1
  355. package/build/dist/Server/Services/DatabaseService.js +1 -0
  356. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  357. package/build/dist/Server/Services/DeletedProjectService.js +124 -0
  358. package/build/dist/Server/Services/DeletedProjectService.js.map +1 -0
  359. package/build/dist/Server/Services/FileService.js +52 -0
  360. package/build/dist/Server/Services/FileService.js.map +1 -1
  361. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js +10 -1
  362. package/build/dist/Server/Services/IncidentEpisodePublicNoteService.js.map +1 -1
  363. package/build/dist/Server/Services/IncidentPublicNoteService.js +10 -1
  364. package/build/dist/Server/Services/IncidentPublicNoteService.js.map +1 -1
  365. package/build/dist/Server/Services/Index.js +2 -0
  366. package/build/dist/Server/Services/Index.js.map +1 -1
  367. package/build/dist/Server/Services/MonitorService.js +232 -0
  368. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  369. package/build/dist/Server/Services/ProbeService.js +17 -0
  370. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  371. package/build/dist/Server/Services/ProjectService.js +228 -6
  372. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  373. package/build/dist/Server/Services/PushNotificationService.js +56 -0
  374. package/build/dist/Server/Services/PushNotificationService.js.map +1 -1
  375. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js +10 -1
  376. package/build/dist/Server/Services/ScheduledMaintenancePublicNoteService.js.map +1 -1
  377. package/build/dist/Server/Services/StatusPageAnnouncementService.js +54 -0
  378. package/build/dist/Server/Services/StatusPageAnnouncementService.js.map +1 -1
  379. package/build/dist/Server/Services/StatusPageDomainService.js +55 -18
  380. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  381. package/build/dist/Server/Services/TeamMemberService.js +97 -6
  382. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  383. package/build/dist/Server/Services/TelemetryEntityRelationshipService.js +3 -0
  384. package/build/dist/Server/Services/TelemetryEntityRelationshipService.js.map +1 -1
  385. package/build/dist/Server/Services/TelemetryEntityService.js +91 -1
  386. package/build/dist/Server/Services/TelemetryEntityService.js.map +1 -1
  387. package/build/dist/Server/Services/TelemetryIngestionKeyService.js +1 -0
  388. package/build/dist/Server/Services/TelemetryIngestionKeyService.js.map +1 -1
  389. package/build/dist/Server/Services/UserWebhookService.js +31 -87
  390. package/build/dist/Server/Services/UserWebhookService.js.map +1 -1
  391. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +65 -0
  392. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  393. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +23 -0
  394. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  395. package/build/dist/Server/Types/Domain.js +37 -0
  396. package/build/dist/Server/Types/Domain.js.map +1 -1
  397. package/build/dist/Server/Types/Workflow/Components/API/Delete.js +2 -1
  398. package/build/dist/Server/Types/Workflow/Components/API/Delete.js.map +1 -1
  399. package/build/dist/Server/Types/Workflow/Components/API/Get.js +2 -1
  400. package/build/dist/Server/Types/Workflow/Components/API/Get.js.map +1 -1
  401. package/build/dist/Server/Types/Workflow/Components/API/Patch.js +2 -1
  402. package/build/dist/Server/Types/Workflow/Components/API/Patch.js.map +1 -1
  403. package/build/dist/Server/Types/Workflow/Components/API/Post.js +2 -1
  404. package/build/dist/Server/Types/Workflow/Components/API/Post.js.map +1 -1
  405. package/build/dist/Server/Types/Workflow/Components/API/Put.js +2 -1
  406. package/build/dist/Server/Types/Workflow/Components/API/Put.js.map +1 -1
  407. package/build/dist/Server/Types/Workflow/Components/API/Utils.js +63 -2
  408. package/build/dist/Server/Types/Workflow/Components/API/Utils.js.map +1 -1
  409. package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.js +15 -11
  410. package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateManyBaseModel.js.map +1 -1
  411. package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.js +2 -3
  412. package/build/dist/Server/Types/Workflow/Components/BaseModel/CreateOneBaseModel.js.map +1 -1
  413. package/build/dist/Server/Types/Workflow/Components/BaseModel/DeleteManyBaseModel.js +21 -10
  414. package/build/dist/Server/Types/Workflow/Components/BaseModel/DeleteManyBaseModel.js.map +1 -1
  415. package/build/dist/Server/Types/Workflow/Components/BaseModel/DeleteOneBaseModel.js +21 -10
  416. package/build/dist/Server/Types/Workflow/Components/BaseModel/DeleteOneBaseModel.js.map +1 -1
  417. package/build/dist/Server/Types/Workflow/Components/BaseModel/FindManyBaseModel.js +18 -13
  418. package/build/dist/Server/Types/Workflow/Components/BaseModel/FindManyBaseModel.js.map +1 -1
  419. package/build/dist/Server/Types/Workflow/Components/BaseModel/FindOneBaseModel.js +18 -13
  420. package/build/dist/Server/Types/Workflow/Components/BaseModel/FindOneBaseModel.js.map +1 -1
  421. package/build/dist/Server/Types/Workflow/Components/BaseModel/LogComponentError.js +43 -0
  422. package/build/dist/Server/Types/Workflow/Components/BaseModel/LogComponentError.js.map +1 -0
  423. package/build/dist/Server/Types/Workflow/Components/BaseModel/ModelArguments.js +116 -0
  424. package/build/dist/Server/Types/Workflow/Components/BaseModel/ModelArguments.js.map +1 -0
  425. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +7 -0
  426. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
  427. package/build/dist/Server/Types/Workflow/Components/BaseModel/UpdateManyBaseModel.js +24 -13
  428. package/build/dist/Server/Types/Workflow/Components/BaseModel/UpdateManyBaseModel.js.map +1 -1
  429. package/build/dist/Server/Types/Workflow/Components/BaseModel/UpdateOneBaseModel.js +27 -13
  430. package/build/dist/Server/Types/Workflow/Components/BaseModel/UpdateOneBaseModel.js.map +1 -1
  431. package/build/dist/Server/Types/Workflow/Components/Discord/SendMessageToChannel.js +14 -6
  432. package/build/dist/Server/Types/Workflow/Components/Discord/SendMessageToChannel.js.map +1 -1
  433. package/build/dist/Server/Types/Workflow/Components/IncomingWebhookUtils.js +42 -0
  434. package/build/dist/Server/Types/Workflow/Components/IncomingWebhookUtils.js.map +1 -0
  435. package/build/dist/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.js +15 -6
  436. package/build/dist/Server/Types/Workflow/Components/MicrosoftTeams/SendMessageToChannel.js.map +1 -1
  437. package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js +10 -2
  438. package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js.map +1 -1
  439. package/build/dist/Server/Types/Workflow/TriggerCode.js.map +1 -1
  440. package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +1 -1
  441. package/build/dist/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.js +141 -0
  442. package/build/dist/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.js.map +1 -1
  443. package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js.map +1 -1
  444. package/build/dist/Server/Utils/AI/SRE/TelemetryImprovementTaskTrigger.js +1 -1
  445. package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js +6 -6
  446. package/build/dist/Server/Utils/AI/Toolbox/CodeWriteTools.js.map +1 -1
  447. package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +39 -5
  448. package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
  449. package/build/dist/Server/Utils/DataSource/EgressGuard.js +94 -10
  450. package/build/dist/Server/Utils/DataSource/EgressGuard.js.map +1 -1
  451. package/build/dist/Server/Utils/DataSource/HttpFetch.js +1 -19
  452. package/build/dist/Server/Utils/DataSource/HttpFetch.js.map +1 -1
  453. package/build/dist/Server/Utils/Execute.js +2 -2
  454. package/build/dist/Server/Utils/Execute.js.map +1 -1
  455. package/build/dist/Server/Utils/InlineImageAccessTokenSync.js +13 -0
  456. package/build/dist/Server/Utils/InlineImageAccessTokenSync.js.map +1 -1
  457. package/build/dist/Server/Utils/LLM/LLMService.js +43 -12
  458. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  459. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +44 -24
  460. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  461. package/build/dist/Server/Utils/Monitor/MonitorDependencySuppression.js +158 -0
  462. package/build/dist/Server/Utils/Monitor/MonitorDependencySuppression.js.map +1 -0
  463. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +50 -30
  464. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  465. package/build/dist/Server/Utils/Monitor/MonitorResource.js +32 -0
  466. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  467. package/build/dist/Server/Utils/Response.js +112 -5
  468. package/build/dist/Server/Utils/Response.js.map +1 -1
  469. package/build/dist/Server/Utils/SSRFProtection.js +219 -53
  470. package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
  471. package/build/dist/Server/Utils/StartServer.js +7 -0
  472. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  473. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +507 -0
  474. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -0
  475. package/build/dist/Server/Utils/VM/VMAPI.js +51 -4
  476. package/build/dist/Server/Utils/VM/VMAPI.js.map +1 -1
  477. package/build/dist/Server/Utils/VM/VMRunner.js +73 -1
  478. package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
  479. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +445 -43
  480. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  481. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +18 -1
  482. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  483. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  484. package/build/dist/Types/AI/FixPullRequestCiStatus.js +1 -1
  485. package/build/dist/Types/AI/FixVerificationStatus.js +2 -2
  486. package/build/dist/Types/API/Hostname.js +73 -4
  487. package/build/dist/Types/API/Hostname.js.map +1 -1
  488. package/build/dist/Types/API/URL.js +42 -24
  489. package/build/dist/Types/API/URL.js.map +1 -1
  490. package/build/dist/Types/Billing/BalanceAdjustmentType.js +15 -0
  491. package/build/dist/Types/Billing/BalanceAdjustmentType.js.map +1 -0
  492. package/build/dist/Types/Billing/ProjectBalanceType.js +14 -0
  493. package/build/dist/Types/Billing/ProjectBalanceType.js.map +1 -0
  494. package/build/dist/Types/Domain.js +22 -0
  495. package/build/dist/Types/Domain.js.map +1 -1
  496. package/build/dist/Types/File/MimeType.js +11 -0
  497. package/build/dist/Types/File/MimeType.js.map +1 -1
  498. package/build/dist/Types/JSONFunctions.js +14 -0
  499. package/build/dist/Types/JSONFunctions.js.map +1 -1
  500. package/build/dist/Types/SerializableObjectDictionary.js +133 -39
  501. package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
  502. package/build/dist/Types/Telemetry/EntitySource.js +39 -0
  503. package/build/dist/Types/Telemetry/EntitySource.js.map +1 -0
  504. package/build/dist/Types/Telemetry/EntityType.js +27 -0
  505. package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
  506. package/build/dist/Types/Telemetry/EntityTypeGroups.js +57 -0
  507. package/build/dist/Types/Telemetry/EntityTypeGroups.js.map +1 -0
  508. package/build/dist/Types/Workflow/Component.js +21 -0
  509. package/build/dist/Types/Workflow/Component.js.map +1 -1
  510. package/build/dist/Types/Workflow/Components/API.js +35 -0
  511. package/build/dist/Types/Workflow/Components/API.js.map +1 -1
  512. package/build/dist/Types/Workflow/Components/BaseModel.js +87 -28
  513. package/build/dist/Types/Workflow/Components/BaseModel.js.map +1 -1
  514. package/build/dist/Types/Workflow/StepTrace.js +104 -0
  515. package/build/dist/Types/Workflow/StepTrace.js.map +1 -0
  516. package/build/dist/Types/Workflow/TemplateSyntax.js +326 -0
  517. package/build/dist/Types/Workflow/TemplateSyntax.js.map +1 -0
  518. package/build/dist/Types/Workflow/Templates.js +218 -0
  519. package/build/dist/Types/Workflow/Templates.js.map +1 -0
  520. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js +126 -0
  521. package/build/dist/UI/Components/Date/CustomTimeRangeModal.js.map +1 -0
  522. package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js +123 -0
  523. package/build/dist/UI/Components/Date/TimeRangePickerDropdown.js.map +1 -0
  524. package/build/dist/UI/Components/Dictionary/Dictionary.js +22 -6
  525. package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
  526. package/build/dist/UI/Components/Forms/Fields/ColorPicker.js +52 -13
  527. package/build/dist/UI/Components/Forms/Fields/ColorPicker.js.map +1 -1
  528. package/build/dist/UI/Components/Forms/Fields/IconPicker.js +28 -12
  529. package/build/dist/UI/Components/Forms/Fields/IconPicker.js.map +1 -1
  530. package/build/dist/UI/Components/Forms/Validation.js +44 -0
  531. package/build/dist/UI/Components/Forms/Validation.js.map +1 -1
  532. package/build/dist/UI/Components/GanttChart/ChartContainer.js +4 -3
  533. package/build/dist/UI/Components/GanttChart/ChartContainer.js.map +1 -1
  534. package/build/dist/UI/Components/Input/Input.js +12 -4
  535. package/build/dist/UI/Components/Input/Input.js.map +1 -1
  536. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js +5 -108
  537. package/build/dist/UI/Components/LogsViewer/components/LogTimeRangePicker.js.map +1 -1
  538. package/build/dist/UI/Components/Modal/ConfirmModal.js +3 -1
  539. package/build/dist/UI/Components/Modal/ConfirmModal.js.map +1 -1
  540. package/build/dist/UI/Components/Modal/Modal.js +55 -39
  541. package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
  542. package/build/dist/UI/Components/ModelDelete/ModelDelete.js +11 -6
  543. package/build/dist/UI/Components/ModelDelete/ModelDelete.js.map +1 -1
  544. package/build/dist/UI/Components/SideOver/SideOver.js +105 -30
  545. package/build/dist/UI/Components/SideOver/SideOver.js.map +1 -1
  546. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js +5 -105
  547. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryTimeRangePicker.js.map +1 -1
  548. package/build/dist/UI/Components/Workflow/ArgumentsForm.js +140 -11
  549. package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
  550. package/build/dist/UI/Components/Workflow/Component.js +20 -19
  551. package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
  552. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +31 -3
  553. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
  554. package/build/dist/UI/Components/Workflow/GraphLint.js +396 -0
  555. package/build/dist/UI/Components/Workflow/GraphLint.js.map +1 -0
  556. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +225 -0
  557. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -0
  558. package/build/dist/UI/Components/Workflow/ModelSchema.js +118 -0
  559. package/build/dist/UI/Components/Workflow/ModelSchema.js.map +1 -0
  560. package/build/dist/UI/Components/Workflow/RunForm.js +22 -6
  561. package/build/dist/UI/Components/Workflow/RunForm.js.map +1 -1
  562. package/build/dist/UI/Components/Workflow/RunStatusWatcher.js +76 -0
  563. package/build/dist/UI/Components/Workflow/RunStatusWatcher.js.map +1 -0
  564. package/build/dist/UI/Components/Workflow/StepTraceViewer.js +76 -0
  565. package/build/dist/UI/Components/Workflow/StepTraceViewer.js.map +1 -0
  566. package/build/dist/UI/Components/Workflow/Utils.js +73 -1
  567. package/build/dist/UI/Components/Workflow/Utils.js.map +1 -1
  568. package/build/dist/UI/Components/Workflow/Workflow.js +51 -6
  569. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  570. package/build/dist/UI/Types/LayeredDismissal.js +21 -0
  571. package/build/dist/UI/Types/LayeredDismissal.js.map +1 -0
  572. package/build/dist/UI/Types/UseAnchoredFieldPopup.js +74 -1
  573. package/build/dist/UI/Types/UseAnchoredFieldPopup.js.map +1 -1
  574. package/build/dist/UI/Utils/PageScrollLock.js +52 -0
  575. package/build/dist/UI/Utils/PageScrollLock.js.map +1 -0
  576. package/build/dist/Utils/Dashboard/HtmlWidgetDocument.js +4 -2
  577. package/build/dist/Utils/Dashboard/HtmlWidgetDocument.js.map +1 -1
  578. package/build/dist/Utils/Dashboard/VariableInterpolation.js +19 -1
  579. package/build/dist/Utils/Dashboard/VariableInterpolation.js.map +1 -1
  580. package/build/dist/Utils/LegacySerializedArray.js +51 -0
  581. package/build/dist/Utils/LegacySerializedArray.js.map +1 -0
  582. package/build/dist/Utils/Monitor/MonitorDependencyRule.js +47 -0
  583. package/build/dist/Utils/Monitor/MonitorDependencyRule.js.map +1 -0
  584. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +386 -0
  585. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -0
  586. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +35 -6
  587. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  588. package/build/dist/Utils/Telemetry/EntityKey.js +52 -0
  589. package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
  590. package/build/dist/Utils/Telemetry/SavedViewFilters.js +52 -0
  591. package/build/dist/Utils/Telemetry/SavedViewFilters.js.map +1 -0
  592. package/jest.config.json +3 -0
  593. package/package.json +1 -1
  594. package/tsconfig.json +3 -1
@@ -34,6 +34,7 @@ import SSRFProtection from "../../SSRFProtection";
34
34
  import WorkspaceProjectAuthToken, {
35
35
  MicrosoftTeamsChat,
36
36
  MicrosoftTeamsChatType,
37
+ MicrosoftTeamsInstalledTeam,
37
38
  MicrosoftTeamsMiscData,
38
39
  } from "../../../../Models/DatabaseModels/WorkspaceProjectAuthToken";
39
40
  import Incident from "../../../../Models/DatabaseModels/Incident";
@@ -111,6 +112,29 @@ import { AIChatCitation } from "../../../../Types/AI/AIChatTypes";
111
112
  // Microsoft Teams apps should always be single-tenant
112
113
  const MICROSOFT_TEAMS_APP_TYPE: string = "SingleTenant";
113
114
 
115
+ /*
116
+ * Outcome of mapping a Microsoft tenant id to a OneUptime project.
117
+ *
118
+ * projectAuth is null both when nothing matched and when the tenant is
119
+ * connected to several projects — isAmbiguous distinguishes the two so callers
120
+ * can give the right remedy.
121
+ */
122
+ export interface MicrosoftTeamsTenantResolution {
123
+ projectAuth: WorkspaceProjectAuthToken | null;
124
+ isAmbiguous: boolean;
125
+ candidateProjectIds: Array<ObjectID>;
126
+ }
127
+
128
+ /*
129
+ * Microsoft's wording when the Bot Framework refuses a proactive post because
130
+ * the app is not a member of the target conversation. Matched case-insensitively
131
+ * so we can replace it with something the admin can act on.
132
+ */
133
+ const MICROSOFT_TEAMS_ROSTER_ERROR_FRAGMENTS: Array<string> = [
134
+ "not part of the conversation roster",
135
+ "bot is not part of the conversation",
136
+ ];
137
+
114
138
  // Maximum number of pages to fetch when paginating teams
115
139
  const MICROSOFT_TEAMS_MAX_PAGES: number = 500;
116
140
 
@@ -119,7 +143,7 @@ const MICROSOFT_TEAMS_MAX_PAGES: number = 500;
119
143
  * issued on outlook.office.com / outlook.office365.com, and per-tenant ones on
120
144
  * <tenant>.webhook.office.com — all covered by these two registrable domains.
121
145
  */
122
- const MICROSOFT_TEAMS_WEBHOOK_DOMAINS: Array<string> = [
146
+ export const MICROSOFT_TEAMS_WEBHOOK_DOMAINS: Array<string> = [
123
147
  "office.com",
124
148
  "office365.com",
125
149
  ];
@@ -704,6 +728,17 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
704
728
  logger.debug("Sending message to Teams channel via incoming webhook:");
705
729
  logger.debug(data);
706
730
 
731
+ /*
732
+ * Enforced at the sink, not only at the callers: this URL reaches here from
733
+ * workflow arguments and from status page subscribers, and a caller that
734
+ * forgets the pin is an SSRF from the API server.
735
+ */
736
+ if (!MicrosoftTeamsUtil.isValidMicrosoftTeamsIncomingWebhookUrl(data.url)) {
737
+ throw new BadDataException(
738
+ `Microsoft Teams Webhook URL must be an https URL on ${MICROSOFT_TEAMS_WEBHOOK_DOMAINS.join(" or ")}.`,
739
+ );
740
+ }
741
+
707
742
  // Build a structured MessageCard from markdown for better rendering in Teams
708
743
  const payload: JSONObject = this.buildMessageCardFromMarkdown(data.text);
709
744
 
@@ -1083,6 +1118,7 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1083
1118
  name: displayName,
1084
1119
  workspaceType: WorkspaceType.MicrosoftTeams,
1085
1120
  teamId: data.teamId,
1121
+ membershipType: channelData["membershipType"] as string | undefined,
1086
1122
  };
1087
1123
  logger.debug(`Channel match found: ${JSON.stringify(foundChannel)}`);
1088
1124
  return foundChannel;
@@ -1153,6 +1189,17 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1153
1189
  `Channel names: ${JSON.stringify(data.workspaceMessagePayload.channelNames)}`,
1154
1190
  );
1155
1191
 
1192
+ /*
1193
+ * Declared before destination resolution so that a destination we cannot
1194
+ * even resolve is reported as an error. Silently skipping it made a
1195
+ * typo'd or deleted channel look like a successful send.
1196
+ */
1197
+ const workspaceMessageResponse: WorkspaceSendMessageResponse = {
1198
+ threads: [],
1199
+ workspaceType: WorkspaceType.MicrosoftTeams,
1200
+ errors: [],
1201
+ };
1202
+
1156
1203
  // Resolve channel names
1157
1204
  for (const channelName of data.workspaceMessagePayload.channelNames) {
1158
1205
  logger.debug(`Attempting to resolve channel name: ${channelName}`);
@@ -1178,6 +1225,15 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1178
1225
  workspaceChannelsToPostTo.push(channel);
1179
1226
  } else {
1180
1227
  logger.warn(`Channel not found: ${channelName}`);
1228
+ workspaceMessageResponse.errors!.push({
1229
+ channel: {
1230
+ id: "",
1231
+ name: channelName,
1232
+ workspaceType: WorkspaceType.MicrosoftTeams,
1233
+ teamId: data.workspaceMessagePayload.teamId,
1234
+ },
1235
+ error: `Channel "${channelName}" was not found in this Microsoft Teams team. It may have been renamed or deleted.`,
1236
+ });
1181
1237
  }
1182
1238
  }
1183
1239
 
@@ -1215,6 +1271,15 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1215
1271
  },
1216
1272
  );
1217
1273
  logger.error(err);
1274
+ workspaceMessageResponse.errors!.push({
1275
+ channel: {
1276
+ id: channelId,
1277
+ name: channelId,
1278
+ workspaceType: WorkspaceType.MicrosoftTeams,
1279
+ teamId: data.workspaceMessagePayload.teamId,
1280
+ },
1281
+ error: err instanceof Error ? err.message : String(err),
1282
+ });
1218
1283
  }
1219
1284
  }
1220
1285
 
@@ -1224,12 +1289,6 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1224
1289
  );
1225
1290
  logger.debug(`Channels: ${JSON.stringify(workspaceChannelsToPostTo)}`);
1226
1291
 
1227
- const workspaceMessageResponse: WorkspaceSendMessageResponse = {
1228
- threads: [],
1229
- workspaceType: WorkspaceType.MicrosoftTeams,
1230
- errors: [],
1231
- };
1232
-
1233
1292
  for (const channel of workspaceChannelsToPostTo) {
1234
1293
  try {
1235
1294
  logger.debug(
@@ -1419,6 +1478,43 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1419
1478
 
1420
1479
  logger.debug(`Using bot ID: ${miscData.botId}`);
1421
1480
 
1481
+ /*
1482
+ * Bots cannot post to shared channels at all, so fail with the reason
1483
+ * rather than letting Microsoft reject the send with a generic error.
1484
+ */
1485
+ if (data.workspaceChannel.membershipType === "shared") {
1486
+ throw new BadDataException(
1487
+ `"${data.workspaceChannel.name}" is a shared channel, and Microsoft Teams does not allow bots to post in shared channels. Please pick a standard or private channel instead.`,
1488
+ );
1489
+ }
1490
+
1491
+ /*
1492
+ * Preflight: refuse before calling the Bot Framework when we know the
1493
+ * app was never installed into this team. Channels are discovered with
1494
+ * tenant-wide Graph application permissions, which see every team
1495
+ * regardless of installation — so reaching this point proves nothing
1496
+ * about whether we can actually post.
1497
+ *
1498
+ * installedTeams is only populated from install events, so an empty map
1499
+ * means "we have not observed any installs" (for example on a workspace
1500
+ * connected before this shipped), not "nothing is installed". Only
1501
+ * enforce once we have at least one record, and let the Bot Framework
1502
+ * error be translated below otherwise.
1503
+ */
1504
+ const installedTeams: Record<string, MicrosoftTeamsInstalledTeam> =
1505
+ miscData.installedTeams || {};
1506
+ const installedTeam: MicrosoftTeamsInstalledTeam | undefined =
1507
+ installedTeams[data.teamId];
1508
+
1509
+ if (Object.keys(installedTeams).length > 0 && !installedTeam) {
1510
+ throw new BadDataException(
1511
+ this.getBotNotInTeamMessage({
1512
+ channelName: data.workspaceChannel.name,
1513
+ membershipType: data.workspaceChannel.membershipType,
1514
+ }),
1515
+ );
1516
+ }
1517
+
1422
1518
  // Get Bot Framework adapter
1423
1519
  const adapter: CloudAdapter = this.getBotAdapter();
1424
1520
 
@@ -1436,7 +1532,13 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1436
1532
  tenantId: tenantId,
1437
1533
  },
1438
1534
  channelId: "msteams",
1439
- serviceUrl: "https://smba.trafficmanager.net/teams/",
1535
+ /*
1536
+ * Fallback is the commercial-cloud global endpoint; the serviceUrl
1537
+ * captured from the install event is preferred (required for GCC/DoD),
1538
+ * matching what sendAdaptiveCardToChat already does.
1539
+ */
1540
+ serviceUrl:
1541
+ installedTeam?.serviceUrl || "https://smba.trafficmanager.net/teams/",
1440
1542
  };
1441
1543
 
1442
1544
  logger.debug(
@@ -1483,10 +1585,59 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1483
1585
  teamId: data.teamId,
1484
1586
  });
1485
1587
  logger.error(error);
1588
+
1589
+ /*
1590
+ * Microsoft's roster rejection is meaningless to an admin ("The bot is
1591
+ * not part of the conversation roster"). Replace it with the action that
1592
+ * actually fixes it.
1593
+ */
1594
+ if (this.isBotNotInConversationRosterError(error)) {
1595
+ throw new BadDataException(
1596
+ this.getBotNotInTeamMessage({
1597
+ channelName: data.workspaceChannel.name,
1598
+ membershipType: data.workspaceChannel.membershipType,
1599
+ }),
1600
+ );
1601
+ }
1602
+
1486
1603
  throw error;
1487
1604
  }
1488
1605
  }
1489
1606
 
1607
+ /*
1608
+ * True when an error is Microsoft's "bot is not in this conversation"
1609
+ * rejection from a proactive Bot Framework send.
1610
+ */
1611
+ public static isBotNotInConversationRosterError(error: unknown): boolean {
1612
+ const message: string = (
1613
+ error instanceof Error ? error.message : String(error || "")
1614
+ ).toLowerCase();
1615
+
1616
+ if (!message) {
1617
+ return false;
1618
+ }
1619
+
1620
+ return MICROSOFT_TEAMS_ROSTER_ERROR_FRAGMENTS.some((fragment: string) => {
1621
+ return message.includes(fragment);
1622
+ });
1623
+ }
1624
+
1625
+ /*
1626
+ * Actionable replacement for the roster error. Private channels need the app
1627
+ * installed into the channel itself; a parent-team install does not cover
1628
+ * them, so the two cases get different instructions.
1629
+ */
1630
+ public static getBotNotInTeamMessage(data: {
1631
+ channelName: string;
1632
+ membershipType?: string | undefined;
1633
+ }): string {
1634
+ if (data.membershipType === "private") {
1635
+ return `The OneUptime app is not installed in the private channel "${data.channelName}". In Microsoft Teams, open the channel, click the "..." menu, then Manage channel > Apps > Add an app, and add OneUptime. Installing OneUptime in the parent team does not cover private channels.`;
1636
+ }
1637
+
1638
+ return `The OneUptime app is not installed in the Microsoft Teams team that owns "${data.channelName}". In Microsoft Teams, click the "..." next to the team name, then Manage team > Apps > More apps, and add OneUptime. Installing OneUptime for yourself or in a chat is not the same as adding it to the team.`;
1639
+ }
1640
+
1490
1641
  /*
1491
1642
  * Sends an adaptive card to a Teams group chat or personal (1:1) chat via a
1492
1643
  * proactive Bot Framework message. The OneUptime app must have been added to
@@ -1700,6 +1851,7 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1700
1851
  name: channelData["displayName"] as string,
1701
1852
  workspaceType: WorkspaceType.MicrosoftTeams,
1702
1853
  teamId: data.teamId,
1854
+ membershipType: channelData["membershipType"] as string | undefined,
1703
1855
  };
1704
1856
 
1705
1857
  logger.debug(`Channel info retrieved: ${JSON.stringify(channel)}`);
@@ -1914,10 +2066,27 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
1914
2066
  const channelsDict: Dictionary<WorkspaceChannel> = {};
1915
2067
 
1916
2068
  for (const channelData of channelsArray) {
2069
+ const membershipType: string | undefined = channelData[
2070
+ "membershipType"
2071
+ ] as string | undefined;
2072
+
2073
+ /*
2074
+ * Microsoft Teams does not support bots in shared channels, so offering
2075
+ * one as a notification destination can only ever produce a failed send.
2076
+ */
2077
+ if (membershipType === "shared") {
2078
+ logger.debug(
2079
+ `Skipping shared channel ${channelData["displayName"]} — Teams does not support bots in shared channels.`,
2080
+ );
2081
+ continue;
2082
+ }
2083
+
1917
2084
  const channel: WorkspaceChannel = {
1918
2085
  id: channelData["id"] as string,
1919
2086
  name: channelData["displayName"] as string,
1920
2087
  workspaceType: WorkspaceType.MicrosoftTeams,
2088
+ teamId: data.teamId,
2089
+ membershipType: membershipType,
1921
2090
  };
1922
2091
  channelsDict[channel.id] = channel;
1923
2092
  }
@@ -2174,6 +2343,19 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
2174
2343
  });
2175
2344
  }
2176
2345
 
2346
+ /*
2347
+ * Same backfill for team installs. Teams the app was added to before we
2348
+ * started recording installs fire no new install event, so an @mention in
2349
+ * any channel of that team is the recovery path that makes proactive
2350
+ * channel notifications work again.
2351
+ */
2352
+ if (messageConversationType === "channel") {
2353
+ await this.captureTeamFromBotActivity({
2354
+ activity: data.activity,
2355
+ turnContext: data.turnContext,
2356
+ });
2357
+ }
2358
+
2177
2359
  // If this is actually an Adaptive Card submit wrapped as a message, route to invoke handler
2178
2360
  if (
2179
2361
  (possibleActionValue["action"] as string) ||
@@ -2222,32 +2404,22 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
2222
2404
  }
2223
2405
 
2224
2406
  // Get project auth by tenant ID
2225
- const projectAuth: WorkspaceProjectAuthToken | null =
2226
- await WorkspaceProjectAuthTokenService.findOneBy({
2227
- query: {
2228
- workspaceType: WorkspaceType.MicrosoftTeams,
2229
- workspaceProjectId: tenantId,
2230
- },
2231
- select: {
2232
- projectId: true,
2233
- workspaceProjectId: true,
2234
- },
2235
- props: {
2236
- isRoot: true,
2237
- },
2238
- });
2239
-
2240
- if (!projectAuth || !projectAuth.projectId) {
2241
- logger.error("Project auth not found for tenant ID: " + tenantId, {
2407
+ const tenantResolution: MicrosoftTeamsTenantResolution =
2408
+ await this.resolveProjectByTenantId({
2242
2409
  tenantId: tenantId,
2243
2410
  });
2411
+
2412
+ if (
2413
+ !tenantResolution.projectAuth ||
2414
+ !tenantResolution.projectAuth.projectId
2415
+ ) {
2244
2416
  await data.turnContext.sendActivity(
2245
- "Sorry, I couldn't find your project configuration. Please try again later.",
2417
+ this.getTenantResolutionFailureMessage(tenantResolution),
2246
2418
  );
2247
2419
  return;
2248
2420
  }
2249
2421
 
2250
- const projectId: ObjectID = projectAuth.projectId;
2422
+ const projectId: ObjectID = tenantResolution.projectAuth.projectId;
2251
2423
  logger.debug(
2252
2424
  `Found project ID: ${projectId.toString()} for tenant ID: ${tenantId}`,
2253
2425
  );
@@ -3286,34 +3458,22 @@ All monitoring checks are passing normally.`;
3286
3458
  return;
3287
3459
  }
3288
3460
 
3289
- const projectAuth: WorkspaceProjectAuthToken | null =
3290
- await WorkspaceProjectAuthTokenService.findOneBy({
3291
- query: {
3292
- workspaceType: WorkspaceType.MicrosoftTeams,
3293
- workspaceProjectId: tenantId,
3294
- },
3295
- select: {
3296
- projectId: true,
3297
- authToken: true,
3298
- workspaceProjectId: true,
3299
- },
3300
- props: { isRoot: true },
3461
+ const tenantResolution: MicrosoftTeamsTenantResolution =
3462
+ await this.resolveProjectByTenantId({
3463
+ tenantId: tenantId,
3301
3464
  });
3302
3465
 
3303
- if (!projectAuth || !projectAuth.projectId) {
3304
- logger.error(
3305
- "Project auth not found for invoke activity tenant: " + tenantId,
3306
- {
3307
- tenantId: tenantId,
3308
- },
3309
- );
3466
+ if (
3467
+ !tenantResolution.projectAuth ||
3468
+ !tenantResolution.projectAuth.projectId
3469
+ ) {
3310
3470
  await data.turnContext.sendActivity(
3311
- "Sorry, I couldn't find your project configuration.",
3471
+ this.getTenantResolutionFailureMessage(tenantResolution),
3312
3472
  );
3313
3473
  return;
3314
3474
  }
3315
3475
 
3316
- const projectId: ObjectID = projectAuth.projectId;
3476
+ const projectId: ObjectID = tenantResolution.projectAuth.projectId;
3317
3477
  const fromObj: JSONObject = ((data.activity["from"] as JSONObject) ||
3318
3478
  {}) as JSONObject;
3319
3479
  const teamsUserId: string | undefined =
@@ -3502,6 +3662,10 @@ All monitoring checks are passing normally.`;
3502
3662
  activity: data.activity,
3503
3663
  turnContext: data.turnContext,
3504
3664
  });
3665
+ await this.captureTeamFromBotActivity({
3666
+ activity: data.activity,
3667
+ turnContext: data.turnContext,
3668
+ });
3505
3669
  await this.sendWelcomeAdaptiveCard(data.turnContext);
3506
3670
  }
3507
3671
 
@@ -3510,6 +3674,9 @@ All monitoring checks are passing normally.`;
3510
3674
  await this.removeChatFromBotActivity({
3511
3675
  activity: data.activity,
3512
3676
  });
3677
+ await this.removeTeamFromBotActivity({
3678
+ activity: data.activity,
3679
+ });
3513
3680
  }
3514
3681
  }
3515
3682
 
@@ -3539,14 +3706,140 @@ All monitoring checks are passing normally.`;
3539
3706
  activity: data.activity,
3540
3707
  turnContext: data.turnContext,
3541
3708
  });
3709
+ await this.captureTeamFromBotActivity({
3710
+ activity: data.activity,
3711
+ turnContext: data.turnContext,
3712
+ });
3542
3713
  } else if (action === "remove" || action === "remove-upgrade") {
3543
3714
  logger.debug("OneUptime bot was uninstalled");
3544
3715
  await this.removeChatFromBotActivity({
3545
3716
  activity: data.activity,
3546
3717
  });
3718
+ await this.removeTeamFromBotActivity({
3719
+ activity: data.activity,
3720
+ });
3547
3721
  }
3548
3722
  }
3549
3723
 
3724
+ /*
3725
+ * Resolve the OneUptime project that owns a Microsoft tenant.
3726
+ *
3727
+ * Bot activities carry a tenant id and nothing else, so the tenant is the
3728
+ * only key we can resolve a project by. A tenant may legitimately be
3729
+ * connected to more than one OneUptime project (saveChatToProjectAuthTokens
3730
+ * fans out for exactly that reason), and when that happens the tenant alone
3731
+ * does NOT identify a project.
3732
+ *
3733
+ * Previously this was a bare findOneBy, which silently returned whichever
3734
+ * row sorted first and served that project's incidents, alerts and AI
3735
+ * assistant answers to anyone in the tenant — including users with no access
3736
+ * to it. The bot's message path performs no per-user authorization, so
3737
+ * picking arbitrarily is a cross-project disclosure. Refuse instead.
3738
+ */
3739
+ @CaptureSpan()
3740
+ public static async resolveProjectByTenantId(data: {
3741
+ tenantId: string;
3742
+ }): Promise<MicrosoftTeamsTenantResolution> {
3743
+ const projectAuths: Array<WorkspaceProjectAuthToken> =
3744
+ await WorkspaceProjectAuthTokenService.findBy({
3745
+ query: {
3746
+ workspaceType: WorkspaceType.MicrosoftTeams,
3747
+ workspaceProjectId: data.tenantId,
3748
+ },
3749
+ select: {
3750
+ projectId: true,
3751
+ authToken: true,
3752
+ workspaceProjectId: true,
3753
+ miscData: true,
3754
+ },
3755
+ limit: LIMIT_MAX,
3756
+ skip: 0,
3757
+ props: {
3758
+ isRoot: true,
3759
+ },
3760
+ });
3761
+
3762
+ /*
3763
+ * Ambiguity is about distinct PROJECTS, not rows. Two rows pointing at the
3764
+ * same project are a data-integrity wart, not a question we cannot answer,
3765
+ * so collapse them rather than refusing to serve that tenant forever.
3766
+ */
3767
+ const seenProjectIds: Set<string> = new Set<string>();
3768
+ const usableProjectAuths: Array<WorkspaceProjectAuthToken> = [];
3769
+
3770
+ for (const projectAuth of projectAuths) {
3771
+ if (!projectAuth.projectId) {
3772
+ continue;
3773
+ }
3774
+
3775
+ const projectIdString: string = projectAuth.projectId.toString();
3776
+
3777
+ if (seenProjectIds.has(projectIdString)) {
3778
+ continue;
3779
+ }
3780
+
3781
+ seenProjectIds.add(projectIdString);
3782
+ usableProjectAuths.push(projectAuth);
3783
+ }
3784
+
3785
+ if (usableProjectAuths.length === 0) {
3786
+ logger.error("Project auth not found for tenant ID: " + data.tenantId, {
3787
+ tenantId: data.tenantId,
3788
+ });
3789
+ return {
3790
+ projectAuth: null,
3791
+ isAmbiguous: false,
3792
+ candidateProjectIds: [],
3793
+ };
3794
+ }
3795
+
3796
+ if (usableProjectAuths.length > 1) {
3797
+ const candidateProjectIds: Array<ObjectID> = usableProjectAuths.map(
3798
+ (projectAuth: WorkspaceProjectAuthToken) => {
3799
+ return projectAuth.projectId!;
3800
+ },
3801
+ );
3802
+
3803
+ logger.error(
3804
+ `Microsoft tenant ${data.tenantId} is connected to ${usableProjectAuths.length} OneUptime projects. Refusing to guess which one this bot activity belongs to.`,
3805
+ {
3806
+ tenantId: data.tenantId,
3807
+ projectIds: candidateProjectIds
3808
+ .map((projectId: ObjectID) => {
3809
+ return projectId.toString();
3810
+ })
3811
+ .join(", "),
3812
+ },
3813
+ );
3814
+
3815
+ return {
3816
+ projectAuth: null,
3817
+ isAmbiguous: true,
3818
+ candidateProjectIds: candidateProjectIds,
3819
+ };
3820
+ }
3821
+
3822
+ return {
3823
+ projectAuth: usableProjectAuths[0]!,
3824
+ isAmbiguous: false,
3825
+ candidateProjectIds: [usableProjectAuths[0]!.projectId!],
3826
+ };
3827
+ }
3828
+
3829
+ /*
3830
+ * User-facing text for a failed tenant resolution. The two cases need
3831
+ * different remedies, so they must not share a message.
3832
+ */
3833
+ public static getTenantResolutionFailureMessage(
3834
+ resolution: MicrosoftTeamsTenantResolution,
3835
+ ): string {
3836
+ if (resolution.isAmbiguous) {
3837
+ return "This Microsoft 365 organization is connected to more than one OneUptime project, so I can't tell which one you mean. Please ask your OneUptime admin to disconnect Microsoft Teams from all but one project.";
3838
+ }
3839
+
3840
+ return "Sorry, I couldn't find your project configuration. This usually means the Microsoft 365 organization you're messaging me from isn't the one connected to OneUptime. Please ask your OneUptime admin to check the Microsoft Teams integration in Project Settings.";
3841
+ }
3842
+
3550
3843
  /*
3551
3844
  * Chats (group chats and personal 1:1 chats) cannot be listed with the
3552
3845
  * app-only Graph token, so the only way OneUptime learns about them is by
@@ -3941,6 +4234,214 @@ All monitoring checks are passing normally.`;
3941
4234
  );
3942
4235
  }
3943
4236
 
4237
+ /*
4238
+ * Record that the OneUptime app was installed into a team.
4239
+ *
4240
+ * Team installs arrive as conversationUpdate / installationUpdate activities
4241
+ * whose conversation is a channel. captureChatFromBotActivity drops those
4242
+ * (channels are not chats), so before this existed we threw away the only
4243
+ * signal that tells us a proactive channel post will be accepted.
4244
+ */
4245
+ @CaptureSpan()
4246
+ public static async captureTeamFromBotActivity(data: {
4247
+ activity: JSONObject;
4248
+ turnContext: TurnContext;
4249
+ }): Promise<void> {
4250
+ try {
4251
+ const channelData: JSONObject =
4252
+ (data.activity["channelData"] as JSONObject) || {};
4253
+
4254
+ const team: JSONObject | undefined = channelData["team"] as
4255
+ | JSONObject
4256
+ | undefined;
4257
+
4258
+ const teamId: string = (team?.["id"] as string) || "";
4259
+
4260
+ if (!teamId) {
4261
+ // Not a team-scoped activity (personal or group chat). Nothing to do.
4262
+ return;
4263
+ }
4264
+
4265
+ const tenantId: string =
4266
+ ((channelData["tenant"] as JSONObject)?.["id"] as string) || "";
4267
+
4268
+ if (!tenantId) {
4269
+ logger.debug("No tenant id found on team activity. Skipping.");
4270
+ return;
4271
+ }
4272
+
4273
+ const installedTeam: MicrosoftTeamsInstalledTeam = {
4274
+ id: teamId,
4275
+ name: (team?.["name"] as string) || undefined,
4276
+ serviceUrl:
4277
+ (data.activity["serviceUrl"] as string) ||
4278
+ data.turnContext.activity.serviceUrl ||
4279
+ undefined,
4280
+ addedAt: OneUptimeDate.getCurrentDate().toISOString(),
4281
+ };
4282
+
4283
+ await this.saveTeamToProjectAuthTokens({
4284
+ tenantId: tenantId,
4285
+ team: installedTeam,
4286
+ });
4287
+
4288
+ logger.debug(
4289
+ `Captured Microsoft Teams team install ${teamId} for tenant ${tenantId}`,
4290
+ );
4291
+ } catch (err) {
4292
+ logger.error("Error capturing Microsoft Teams team from bot activity:");
4293
+ logger.error(err);
4294
+ }
4295
+ }
4296
+
4297
+ @CaptureSpan()
4298
+ public static async removeTeamFromBotActivity(data: {
4299
+ activity: JSONObject;
4300
+ }): Promise<void> {
4301
+ try {
4302
+ const channelData: JSONObject =
4303
+ (data.activity["channelData"] as JSONObject) || {};
4304
+
4305
+ const teamId: string =
4306
+ ((channelData["team"] as JSONObject)?.["id"] as string) || "";
4307
+ const tenantId: string =
4308
+ ((channelData["tenant"] as JSONObject)?.["id"] as string) || "";
4309
+
4310
+ if (!teamId || !tenantId) {
4311
+ return;
4312
+ }
4313
+
4314
+ await this.removeTeamFromProjectAuthTokens({
4315
+ tenantId: tenantId,
4316
+ teamId: teamId,
4317
+ });
4318
+
4319
+ logger.debug(
4320
+ `Removed Microsoft Teams team install ${teamId} for tenant ${tenantId}`,
4321
+ );
4322
+ } catch (err) {
4323
+ logger.error("Error removing Microsoft Teams team from bot activity:");
4324
+ logger.error(err);
4325
+ }
4326
+ }
4327
+
4328
+ @CaptureSpan()
4329
+ public static async saveTeamToProjectAuthTokens(data: {
4330
+ tenantId: string;
4331
+ team: MicrosoftTeamsInstalledTeam;
4332
+ }): Promise<void> {
4333
+ /*
4334
+ * Same fan-out reasoning as saveChatToProjectAuthTokens: the install event
4335
+ * does not say which project it belongs to, so record it on every project
4336
+ * connected to this tenant.
4337
+ */
4338
+ const projectAuths: Array<WorkspaceProjectAuthToken> =
4339
+ await WorkspaceProjectAuthTokenService.findBy({
4340
+ query: {
4341
+ workspaceType: WorkspaceType.MicrosoftTeams,
4342
+ workspaceProjectId: data.tenantId,
4343
+ },
4344
+ select: {
4345
+ _id: true,
4346
+ miscData: true,
4347
+ },
4348
+ limit: LIMIT_MAX,
4349
+ skip: 0,
4350
+ props: {
4351
+ isRoot: true,
4352
+ },
4353
+ });
4354
+
4355
+ for (const projectAuth of projectAuths) {
4356
+ const miscData: MicrosoftTeamsMiscData = {
4357
+ ...((projectAuth.miscData as MicrosoftTeamsMiscData) || {}),
4358
+ } as MicrosoftTeamsMiscData;
4359
+
4360
+ miscData.installedTeams = {
4361
+ ...(miscData.installedTeams || {}),
4362
+ [data.team.id]: data.team,
4363
+ };
4364
+
4365
+ await WorkspaceProjectAuthTokenService.updateOneById({
4366
+ id: projectAuth.id!,
4367
+ data: {
4368
+ miscData: miscData,
4369
+ },
4370
+ props: {
4371
+ isRoot: true,
4372
+ },
4373
+ });
4374
+ }
4375
+ }
4376
+
4377
+ @CaptureSpan()
4378
+ public static async removeTeamFromProjectAuthTokens(data: {
4379
+ tenantId: string;
4380
+ teamId: string;
4381
+ }): Promise<void> {
4382
+ const projectAuths: Array<WorkspaceProjectAuthToken> =
4383
+ await WorkspaceProjectAuthTokenService.findBy({
4384
+ query: {
4385
+ workspaceType: WorkspaceType.MicrosoftTeams,
4386
+ workspaceProjectId: data.tenantId,
4387
+ },
4388
+ select: {
4389
+ _id: true,
4390
+ miscData: true,
4391
+ },
4392
+ limit: LIMIT_MAX,
4393
+ skip: 0,
4394
+ props: {
4395
+ isRoot: true,
4396
+ },
4397
+ });
4398
+
4399
+ for (const projectAuth of projectAuths) {
4400
+ const miscData: MicrosoftTeamsMiscData = {
4401
+ ...((projectAuth.miscData as MicrosoftTeamsMiscData) || {}),
4402
+ } as MicrosoftTeamsMiscData;
4403
+
4404
+ if (!miscData.installedTeams || !miscData.installedTeams[data.teamId]) {
4405
+ continue;
4406
+ }
4407
+
4408
+ const installedTeams: Record<string, MicrosoftTeamsInstalledTeam> = {
4409
+ ...miscData.installedTeams,
4410
+ };
4411
+ delete installedTeams[data.teamId];
4412
+ miscData.installedTeams = installedTeams;
4413
+
4414
+ await WorkspaceProjectAuthTokenService.updateOneById({
4415
+ id: projectAuth.id!,
4416
+ data: {
4417
+ miscData: miscData,
4418
+ },
4419
+ props: {
4420
+ isRoot: true,
4421
+ },
4422
+ });
4423
+ }
4424
+ }
4425
+
4426
+ @CaptureSpan()
4427
+ public static async getInstalledTeamsForProject(data: {
4428
+ projectId: ObjectID;
4429
+ }): Promise<Record<string, MicrosoftTeamsInstalledTeam>> {
4430
+ const projectAuth: WorkspaceProjectAuthToken | null =
4431
+ await WorkspaceProjectAuthTokenService.getProjectAuth({
4432
+ projectId: data.projectId,
4433
+ workspaceType: WorkspaceType.MicrosoftTeams,
4434
+ });
4435
+
4436
+ if (!projectAuth || !projectAuth.miscData) {
4437
+ return {};
4438
+ }
4439
+
4440
+ return (
4441
+ (projectAuth.miscData as MicrosoftTeamsMiscData).installedTeams || {}
4442
+ );
4443
+ }
4444
+
3944
4445
  /**
3945
4446
  * Process Bot Framework activity using the botbuilder SDK adapter.processActivity
3946
4447
  * This replaces the manual JWT validation and activity handling with proper SDK methods
@@ -4375,7 +4876,12 @@ All monitoring checks are passing normally.`;
4375
4876
  id: t["id"] as string,
4376
4877
  name: (t["displayName"] as string) || "Unnamed Team",
4377
4878
  };
4378
- acc[team.name] = team;
4879
+ /*
4880
+ * Keyed by id, not display name — Teams allows duplicate team
4881
+ * names, and keying by name silently collapsed them so only the
4882
+ * last one of each name was selectable.
4883
+ */
4884
+ acc[team.id] = team;
4379
4885
  return acc;
4380
4886
  },
4381
4887
  {} as Record<string, { id: string; name: string }>,