@oneuptime/common 14.0.10 → 14.0.11

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 (837) hide show
  1. package/Models/DatabaseModels/AIConversation.ts +127 -1
  2. package/Models/DatabaseModels/CephCluster.ts +12 -0
  3. package/Models/DatabaseModels/CloudResource.ts +12 -0
  4. package/Models/DatabaseModels/DatabaseServer.ts +12 -0
  5. package/Models/DatabaseModels/DockerHost.ts +12 -0
  6. package/Models/DatabaseModels/DockerSwarmCluster.ts +12 -0
  7. package/Models/DatabaseModels/GlobalOidc.ts +0 -4
  8. package/Models/DatabaseModels/GlobalOidcProject.ts +0 -4
  9. package/Models/DatabaseModels/GlobalSso.ts +0 -4
  10. package/Models/DatabaseModels/GlobalSsoProject.ts +0 -4
  11. package/Models/DatabaseModels/Host.ts +12 -0
  12. package/Models/DatabaseModels/IncidentForm.ts +594 -0
  13. package/Models/DatabaseModels/IncidentFormSubmission.ts +283 -0
  14. package/Models/DatabaseModels/IncidentTemplate.ts +59 -0
  15. package/Models/DatabaseModels/Index.ts +14 -0
  16. package/Models/DatabaseModels/IoTFleet.ts +12 -0
  17. package/Models/DatabaseModels/KubernetesCluster.ts +12 -0
  18. package/Models/DatabaseModels/MessageQueue.ts +1102 -0
  19. package/Models/DatabaseModels/MessageQueueLabelRule.ts +553 -0
  20. package/Models/DatabaseModels/MessageQueueOwnerRule.ts +633 -0
  21. package/Models/DatabaseModels/MessageQueueOwnerTeam.ts +491 -0
  22. package/Models/DatabaseModels/MessageQueueOwnerUser.ts +490 -0
  23. package/Models/DatabaseModels/PodmanHost.ts +12 -0
  24. package/Models/DatabaseModels/Project.ts +59 -0
  25. package/Models/DatabaseModels/ProjectOidc.ts +0 -4
  26. package/Models/DatabaseModels/ProjectSso.ts +0 -4
  27. package/Models/DatabaseModels/ProxmoxCluster.ts +12 -0
  28. package/Models/DatabaseModels/RumApplication.ts +12 -0
  29. package/Models/DatabaseModels/ServerlessFunction.ts +12 -0
  30. package/Models/DatabaseModels/Service.ts +12 -0
  31. package/Models/DatabaseModels/StatusPageOidc.ts +0 -4
  32. package/Models/DatabaseModels/StatusPageSso.ts +0 -4
  33. package/Models/DatabaseModels/TeamComplianceSetting.ts +47 -2
  34. package/Models/DatabaseModels/VMwareVCenter.ts +12 -0
  35. package/Server/API/AIChatAPI.ts +13 -114
  36. package/Server/API/AIInvestigationAPI.ts +3 -3
  37. package/Server/API/AIInvestigationConversationAPI.ts +266 -0
  38. package/Server/API/IncidentFormAPI.ts +376 -0
  39. package/Server/API/ProjectOIDC.ts +16 -25
  40. package/Server/API/ProjectSSO.ts +16 -24
  41. package/Server/API/StatusPageAPI.ts +42 -77
  42. package/Server/Enterprise/EnterpriseEdition.ts +93 -28
  43. package/Server/Enterprise/EnterpriseFeature.ts +25 -3
  44. package/Server/Enterprise/EnterpriseLicenseSnapshot.ts +1 -1
  45. package/Server/Enterprise/EnterpriseServerModule.ts +4 -1
  46. package/Server/EnvironmentConfig.ts +1 -1
  47. package/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.ts +129 -0
  48. package/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.ts +52 -0
  49. package/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.ts +75 -0
  50. package/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.ts +477 -0
  51. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  52. package/Server/Middleware/IncidentFormRateLimit.ts +847 -0
  53. package/Server/Middleware/UserAuthorization.ts +16 -38
  54. package/Server/Services/AIService.ts +10 -13
  55. package/Server/Services/IncidentCustomFieldService.ts +112 -2
  56. package/Server/Services/IncidentEpisodeMemberService.ts +24 -4
  57. package/Server/Services/IncidentEpisodeService.ts +10 -1
  58. package/Server/Services/IncidentFormService.ts +1566 -0
  59. package/Server/Services/IncidentFormSubmissionService.ts +97 -0
  60. package/Server/Services/IncidentGroupingEngineService.ts +45 -8
  61. package/Server/Services/IncidentService.ts +123 -5
  62. package/Server/Services/IncidentTemplateService.ts +22 -0
  63. package/Server/Services/Index.ts +14 -0
  64. package/Server/Services/MessageQueueLabelRuleEngineService.ts +321 -0
  65. package/Server/Services/MessageQueueLabelRuleService.ts +14 -0
  66. package/Server/Services/MessageQueueOwnerRuleEngineService.ts +412 -0
  67. package/Server/Services/MessageQueueOwnerRuleService.ts +14 -0
  68. package/Server/Services/MessageQueueOwnerTeamService.ts +62 -0
  69. package/Server/Services/MessageQueueOwnerUserService.ts +62 -0
  70. package/Server/Services/MessageQueueService.ts +1463 -0
  71. package/Server/Services/OpenTelemetryIngestService.ts +37 -4
  72. package/Server/Services/ProjectService.ts +0 -59
  73. package/Server/Services/StatusPagePrivateUserService.ts +1 -4
  74. package/Server/Services/StatusPageService.ts +1 -51
  75. package/Server/Services/TeamComplianceSettingService.ts +163 -42
  76. package/Server/Services/UserNotificationRuleService.ts +8 -1
  77. package/Server/Services/WorkspaceNotificationSummaryService.ts +12 -3
  78. package/Server/Types/Database/Permissions/CreatePermission.ts +17 -3
  79. package/Server/Types/Database/Permissions/EditionPermission.ts +140 -38
  80. package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +16 -0
  81. package/Server/Types/Database/Permissions/TablePermission.ts +3 -3
  82. package/Server/Types/Database/Permissions/UpdatePermission.ts +20 -6
  83. package/Server/Utils/AI/Chat/AgentContextCompactor.ts +200 -0
  84. package/Server/Utils/AI/Chat/ChatAgentRunner.ts +307 -48
  85. package/Server/Utils/AI/Chat/ChatRunCancellation.ts +156 -0
  86. package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +78 -18
  87. package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +1 -1
  88. package/Server/Utils/AI/Chat/ToolOutputPager.ts +322 -0
  89. package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +88 -30
  90. package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +13 -1
  91. package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +0 -32
  92. package/Server/Utils/AI/CodeFix/FixRunBudget.ts +27 -25
  93. package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +7 -1
  94. package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +34 -14
  95. package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +69 -24
  96. package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +9 -0
  97. package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +53 -10
  98. package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +27 -10
  99. package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +27 -10
  100. package/Server/Utils/AI/SRE/InvestigationQueue.ts +16 -19
  101. package/Server/Utils/AI/SRE/InvestigationThread.ts +646 -0
  102. package/Server/Utils/AI/SRE/InvestigationThreadService.ts +715 -0
  103. package/Server/Utils/AI/Toolbox/Serializer.ts +10 -3
  104. package/Server/Utils/EditionEnforcement.ts +19 -202
  105. package/Server/Utils/LLM/LLMService.ts +259 -63
  106. package/Server/Utils/RelaxedScimTeamLocksReport.ts +245 -0
  107. package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +25 -0
  108. package/Server/Utils/SameOriginRequest.ts +203 -0
  109. package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +2 -0
  110. package/Server/Utils/Telemetry/EntityRegistry.ts +4 -1
  111. package/Server/Utils/Telemetry/MessageQueueDiscovery.ts +1402 -0
  112. package/Server/Utils/Telemetry/ResourceEntityFilter.ts +4 -1
  113. package/Server/Utils/VendorAssets.ts +3 -3
  114. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +3 -1
  115. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +3 -1
  116. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +10 -1
  117. package/Tests/App/Accounts/IncidentFormPage.test.tsx +2036 -0
  118. package/Tests/App/Accounts/IncidentFormServerMessages.test.ts +119 -0
  119. package/Tests/App/Accounts/IncidentFormUtils.test.ts +1157 -0
  120. package/Tests/App/Accounts/LoginPasskey.test.tsx +6 -4
  121. package/Tests/App/Accounts/LoginSso.test.tsx +724 -0
  122. package/Tests/App/AdminDashboard/AdminAuthenticationRequireSso.test.tsx +338 -0
  123. package/Tests/App/AdminDashboard/AdminAuthenticationSsoCardLocales.test.tsx +331 -0
  124. package/Tests/App/AdminDashboard/AdminEnterprisePluginPage.test.tsx +47 -33
  125. package/Tests/App/AdminDashboard/GlobalSsoOidcPages.test.tsx +1021 -0
  126. package/Tests/App/Dashboard/AffectedResourcesDisplay.test.tsx +876 -78
  127. package/Tests/App/Dashboard/AffectedResourcesSlo.test.tsx +20 -3
  128. package/Tests/App/Dashboard/CephProxmoxVMwareDocumentationCards.test.tsx +359 -0
  129. package/Tests/App/Dashboard/CephSetupGuide.test.ts +961 -0
  130. package/Tests/App/Dashboard/CloudDocumentationCard.test.tsx +381 -95
  131. package/Tests/App/Dashboard/CloudSetupGuide.test.ts +1463 -0
  132. package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +174 -12
  133. package/Tests/App/Dashboard/ContainerSetupGuideCards.test.tsx +345 -0
  134. package/Tests/App/Dashboard/CoreListEmptyStates.test.tsx +501 -0
  135. package/Tests/App/Dashboard/DashboardLazyPages.test.tsx +0 -1
  136. package/Tests/App/Dashboard/DatabaseDocumentationCard.test.tsx +400 -0
  137. package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +5 -0
  138. package/Tests/App/Dashboard/DatabaseSetupGuide.test.ts +1869 -0
  139. package/Tests/App/Dashboard/DatabaseTelemetryScope.test.ts +44 -0
  140. package/Tests/App/Dashboard/DatabaseTelemetryTabs.test.tsx +50 -9
  141. package/Tests/App/Dashboard/DockerSetupGuide.test.ts +899 -0
  142. package/Tests/App/Dashboard/DockerSwarmSetupGuide.test.ts +964 -0
  143. package/Tests/App/Dashboard/EnterpriseFeatureUpgrade.test.tsx +141 -7
  144. package/Tests/App/Dashboard/EnterprisePluginPage.test.tsx +52 -39
  145. package/Tests/App/Dashboard/EventOverviewPages.test.tsx +7 -1
  146. package/Tests/App/Dashboard/GettingStartedTaskRoutes.test.tsx +331 -0
  147. package/Tests/App/Dashboard/HomeOverviewStatsFirstRun.test.tsx +925 -0
  148. package/Tests/App/Dashboard/HostDocumentationCard.test.tsx +225 -0
  149. package/Tests/App/Dashboard/HostSetupGuide.test.ts +1183 -0
  150. package/Tests/App/Dashboard/IdentityEnterpriseShells.test.tsx +69 -45
  151. package/Tests/App/Dashboard/IncidentCreateTemplateCustomFieldSettings.test.tsx +745 -0
  152. package/Tests/App/Dashboard/IncidentCreateTemplateOwners.test.tsx +414 -0
  153. package/Tests/App/Dashboard/IncidentCustomFieldCreateSettingsForm.test.ts +1042 -0
  154. package/Tests/App/Dashboard/IncidentCustomFieldSettingsCard.test.tsx +1816 -0
  155. package/Tests/App/Dashboard/IncidentFormPlan.test.ts +89 -0
  156. package/Tests/App/Dashboard/IncidentFormShareLinkCard.test.tsx +846 -0
  157. package/Tests/App/Dashboard/IncidentFormsPages.test.tsx +1324 -0
  158. package/Tests/App/Dashboard/IncidentTemplateCustomFieldSettings.test.tsx +630 -0
  159. package/Tests/App/Dashboard/IncidentsSideMenu.test.tsx +13 -0
  160. package/Tests/App/Dashboard/IncomingEmailMonitorLinkVerifyHint.test.tsx +104 -0
  161. package/Tests/App/Dashboard/InvestigationConversation.test.tsx +1107 -0
  162. package/Tests/App/Dashboard/InvestigationConversationData.test.ts +546 -0
  163. package/Tests/App/Dashboard/InvestigationEvidenceList.test.tsx +170 -5
  164. package/Tests/App/Dashboard/InvestigationNotStarted.test.tsx +207 -2
  165. package/Tests/App/Dashboard/InvestigationPanel.test.tsx +729 -34
  166. package/Tests/App/Dashboard/InvestigationPanelStatus.test.tsx +9 -21
  167. package/Tests/App/Dashboard/InvestigationReportView.test.tsx +274 -37
  168. package/Tests/App/Dashboard/InvestigationStatusBadge.test.tsx +130 -0
  169. package/Tests/App/Dashboard/IoTDocumentationCard.test.tsx +218 -0
  170. package/Tests/App/Dashboard/IoTSetupGuide.test.ts +1124 -0
  171. package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +20 -6
  172. package/Tests/App/Dashboard/KubernetesClusterAiDocumentationMarkdown.test.ts +107 -83
  173. package/Tests/App/Dashboard/KubernetesSetupGuide.test.ts +787 -0
  174. package/Tests/App/Dashboard/MessageQueueBreadcrumbs.test.tsx +228 -0
  175. package/Tests/App/Dashboard/MessageQueueBrokerHealth.test.tsx +1538 -0
  176. package/Tests/App/Dashboard/MessageQueueBrokerHealthMetricChart.test.tsx +969 -0
  177. package/Tests/App/Dashboard/MessageQueueBrokerHealthReads.test.ts +889 -0
  178. package/Tests/App/Dashboard/MessageQueueBrokerMetricsReach.test.ts +236 -0
  179. package/Tests/App/Dashboard/MessageQueueDocumentationCard.test.tsx +479 -0
  180. package/Tests/App/Dashboard/MessageQueueListPages.test.tsx +1232 -0
  181. package/Tests/App/Dashboard/MessageQueueMetricDescriptions.test.ts +244 -0
  182. package/Tests/App/Dashboard/MessageQueueMonitorLink.test.ts +952 -0
  183. package/Tests/App/Dashboard/MessageQueueMonitorLinkMonitorCreate.test.tsx +859 -0
  184. package/Tests/App/Dashboard/MessageQueueOverview.test.tsx +1773 -0
  185. package/Tests/App/Dashboard/MessageQueueOverviewPresentation.test.ts +196 -0
  186. package/Tests/App/Dashboard/MessageQueuePresentation.test.ts +799 -0
  187. package/Tests/App/Dashboard/MessageQueueProducersConsumers.test.tsx +680 -0
  188. package/Tests/App/Dashboard/MessageQueueRoutes.test.tsx +383 -0
  189. package/Tests/App/Dashboard/MessageQueueRulePages.test.tsx +278 -0
  190. package/Tests/App/Dashboard/MessageQueueSetupGuide.test.ts +2778 -0
  191. package/Tests/App/Dashboard/MessageQueueSideMenus.test.tsx +273 -0
  192. package/Tests/App/Dashboard/MessageQueueSpanPopulations.test.ts +930 -0
  193. package/Tests/App/Dashboard/MessageQueueSpanStore.ts +351 -0
  194. package/Tests/App/Dashboard/MessageQueueTelemetryScope.test.ts +375 -0
  195. package/Tests/App/Dashboard/MessageQueueTelemetryScopeTabs.test.tsx +668 -0
  196. package/Tests/App/Dashboard/MessageQueueViewPages.test.tsx +685 -0
  197. package/Tests/App/Dashboard/MonitorAndHomeNotOperationalMenus.test.tsx +342 -0
  198. package/Tests/App/Dashboard/MonitorCreateFirstRunDefaults.test.tsx +623 -0
  199. package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +442 -0
  200. package/Tests/App/Dashboard/MonitorLogsPageViewSummary.test.tsx +814 -0
  201. package/Tests/App/Dashboard/MonitorSetupCardBodies.test.tsx +246 -0
  202. package/Tests/App/Dashboard/NavigationSearchKeywords.test.tsx +8 -0
  203. package/Tests/App/Dashboard/OnboardingSsoEmptyState.test.tsx +27 -12
  204. package/Tests/App/Dashboard/PlanGatedPage.test.tsx +292 -0
  205. package/Tests/App/Dashboard/PodmanSetupGuide.test.ts +948 -0
  206. package/Tests/App/Dashboard/ProductOrientation.test.tsx +5 -4
  207. package/Tests/App/Dashboard/ProductSettingsSectionCollapsed.test.tsx +266 -0
  208. package/Tests/App/Dashboard/ProxmoxSetupGuide.test.ts +1318 -0
  209. package/Tests/App/Dashboard/ResourceAiAgentAttentionServerParity.test.ts +555 -0
  210. package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +298 -9
  211. package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +453 -0
  212. package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +16 -0
  213. package/Tests/App/Dashboard/ResourceConnectionGuideCard.test.tsx +444 -0
  214. package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsInfra.test.tsx +798 -0
  215. package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsPlatforms.test.tsx +717 -0
  216. package/Tests/App/Dashboard/ResourceConnectionGuides.test.ts +981 -0
  217. package/Tests/App/Dashboard/ResourceConnectionState.test.ts +132 -0
  218. package/Tests/App/Dashboard/RumDocumentationCard.test.tsx +293 -0
  219. package/Tests/App/Dashboard/RumSessionReplayRetentionSettings.test.tsx +467 -0
  220. package/Tests/App/Dashboard/RumSetupGuide.test.ts +758 -0
  221. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +25 -0
  222. package/Tests/App/Dashboard/ServerlessDocumentationCard.test.tsx +254 -0
  223. package/Tests/App/Dashboard/ServerlessSetupGuide.test.ts +1074 -0
  224. package/Tests/App/Dashboard/SetupGuide.test.ts +246 -0
  225. package/Tests/App/Dashboard/SetupGuideCard.test.tsx +756 -0
  226. package/Tests/App/Dashboard/SloListSideMenu.test.tsx +120 -0
  227. package/Tests/App/Dashboard/SsoPages.test.tsx +833 -0
  228. package/Tests/App/Dashboard/TelemetryDocumentation.test.tsx +253 -0
  229. package/Tests/App/Dashboard/TelemetryRetentionShells.test.tsx +730 -0
  230. package/Tests/App/Dashboard/VMwareSetupGuide.test.ts +1033 -0
  231. package/Tests/App/StatusPage/StatusPageSsoEmptyState.test.tsx +87 -7
  232. package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +28 -9
  233. package/Tests/Models/DatabaseModels/IncidentFormModel.test.ts +1250 -0
  234. package/Tests/Models/DatabaseModels/MessageQueueModels.test.ts +1983 -0
  235. package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
  236. package/Tests/Models/DatabaseModels/TeamComplianceSettingModel.test.ts +190 -14
  237. package/Tests/Models/IncidentTemplateCustomFieldSettingsColumn.test.ts +291 -0
  238. package/Tests/Server/API/AIInvestigationConversationAPI.test.ts +412 -0
  239. package/Tests/Server/API/GlobalConfigLicense.test.ts +38 -9
  240. package/Tests/Server/API/IncidentFormAPI.test.ts +942 -0
  241. package/Tests/Server/API/IncidentFormPublicRoutes.test.ts +1653 -0
  242. package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +2 -1
  243. package/Tests/Server/API/{SsoProviderListingsEdition.test.ts → SsoProviderListings.test.ts} +164 -110
  244. package/Tests/Server/Enterprise/EnterpriseEdition.test.ts +76 -54
  245. package/Tests/Server/Enterprise/EnterpriseFeatureActive.test.ts +125 -42
  246. package/Tests/Server/Enterprise/EnterpriseLicenseSnapshot.test.ts +36 -10
  247. package/Tests/Server/Enterprise/EnterpriseModelFeatureMap.test.ts +51 -9
  248. package/Tests/Server/Enterprise/FakeEnterpriseModule.ts +13 -8
  249. package/Tests/Server/Enterprise/SsoInCommunityEdition.test.ts +540 -0
  250. package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
  251. package/Tests/Server/Infrastructure/Postgres/AddIncidentFormsMigration.test.ts +438 -0
  252. package/Tests/Server/Infrastructure/Postgres/AddTeamComplianceRuleNotificationChannelsMigration.test.ts +255 -0
  253. package/Tests/Server/Infrastructure/Postgres/MessageQueueTablesMigration.test.ts +637 -0
  254. package/Tests/Server/Middleware/IncidentFormRateLimit.test.ts +1630 -0
  255. package/Tests/Server/Middleware/UserAuthorization.test.ts +16 -17
  256. package/Tests/Server/Middleware/UserAuthorizationSsoEnforcement.test.ts +544 -0
  257. package/Tests/Server/Services/AIServiceDailyBudget.test.ts +37 -8
  258. package/Tests/Server/Services/IncidentCreatedFeedTitle.test.ts +212 -0
  259. package/Tests/Server/Services/IncidentCustomFieldDeleteFormQuestions.test.ts +297 -0
  260. package/Tests/Server/Services/IncidentFormOwnersCreatedNotification.test.ts +497 -0
  261. package/Tests/Server/Services/IncidentFormPostgres.test.ts +958 -0
  262. package/Tests/Server/Services/IncidentFormPublicForm.test.ts +1260 -0
  263. package/Tests/Server/Services/IncidentFormPublicSubmission.test.ts +2520 -0
  264. package/Tests/Server/Services/IncidentFormRegistration.test.ts +159 -0
  265. package/Tests/Server/Services/IncidentFormService.test.ts +663 -0
  266. package/Tests/Server/Services/IncidentFormSubmissionService.test.ts +430 -0
  267. package/Tests/Server/Services/IncidentFormSubmissionTemplateBranch.test.ts +473 -0
  268. package/Tests/Server/Services/IncidentGroupingTemplateSubstitution.test.ts +81 -0
  269. package/Tests/Server/Services/IncidentTemplateCustomFieldSettings.test.ts +262 -0
  270. package/Tests/Server/Services/IncidentTemplateOwnersOnDeclare.test.ts +566 -0
  271. package/Tests/Server/Services/IncidentTitleMarkdownSinks.test.ts +640 -0
  272. package/Tests/Server/Services/LlmLogServiceTokenAggregateParams.test.ts +3 -3
  273. package/Tests/Server/Services/MessageQueueOwnerServices.test.ts +440 -0
  274. package/Tests/Server/Services/MessageQueueRegistries.test.ts +577 -0
  275. package/Tests/Server/Services/MessageQueueRuleEngines.test.ts +900 -0
  276. package/Tests/Server/Services/MessageQueueService.test.ts +2210 -0
  277. package/Tests/Server/Services/MessageQueueSqlPostgres.test.ts +1271 -0
  278. package/Tests/Server/Services/OpenTelemetryResourceRetentionMemo.test.ts +28 -1
  279. package/Tests/Server/Services/OpenTelemetryRetentionOverrideEdition.test.ts +474 -0
  280. package/Tests/Server/Services/OpenTelemetryServiceResolutionCache.test.ts +21 -0
  281. package/Tests/Server/Services/OwnerRowUniqueness.test.ts +3 -0
  282. package/Tests/Server/Services/ProjectServiceAuditLogLicense.test.ts +0 -1
  283. package/Tests/Server/Services/RuleRun/LabelRuleEnginesGroupBRun.test.ts +56 -6
  284. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupBRun.test.ts +30 -1
  285. package/Tests/Server/Services/SsoRequirementReads.test.ts +454 -0
  286. package/Tests/Server/Services/SsoRequirementWrites.test.ts +529 -0
  287. package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +3 -3
  288. package/Tests/Server/Services/StatusPagePrivateUserInvitationPolicy.test.ts +107 -89
  289. package/Tests/Server/Services/TeamComplianceSettingPostgres.test.ts +1068 -176
  290. package/Tests/Server/Services/TeamComplianceSettingService.test.ts +1962 -200
  291. package/Tests/Server/Types/Database/Permissions/EditionPermission.test.ts +654 -297
  292. package/Tests/Server/Types/Database/Permissions/RetentionOverrideColumns.test.ts +784 -0
  293. package/Tests/Server/Types/Database/Permissions/SsoScalePlanGate.test.ts +418 -0
  294. package/Tests/Server/Utils/AI/AIAlertGating.test.ts +0 -1
  295. package/Tests/Server/Utils/AI/AIInvestigationEngineRunLimits.test.ts +136 -0
  296. package/Tests/Server/Utils/AI/AIInvestigationQueue.test.ts +15 -14
  297. package/Tests/Server/Utils/AI/AgentContextCompactor.test.ts +351 -0
  298. package/Tests/Server/Utils/AI/ChatAgentRunnerSharedThread.test.ts +842 -0
  299. package/Tests/Server/Utils/AI/ChatRunCancellation.test.ts +195 -0
  300. package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +10 -57
  301. package/Tests/Server/Utils/AI/FixRunBudget.test.ts +20 -24
  302. package/Tests/Server/Utils/AI/Insights/InvestigationQueueInsightSubject.test.ts +7 -30
  303. package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +225 -29
  304. package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +266 -25
  305. package/Tests/Server/Utils/AI/InvestigationThread.test.ts +580 -0
  306. package/Tests/Server/Utils/AI/InvestigationThreadService.test.ts +801 -0
  307. package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +525 -43
  308. package/Tests/Server/Utils/AI/KubectlJobRunner.test.ts +4 -2
  309. package/Tests/Server/Utils/AI/LLMServiceUnreachableProvider.test.ts +435 -0
  310. package/Tests/Server/Utils/AI/ObservabilityAssistantLimits.test.ts +462 -0
  311. package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +14 -25
  312. package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +2 -0
  313. package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +297 -15
  314. package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +10 -6
  315. package/Tests/Server/Utils/AI/ToolOutputPager.test.ts +382 -0
  316. package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +23 -4
  317. package/Tests/Server/Utils/AI/Toolbox/LogTools.test.ts +25 -6
  318. package/Tests/Server/Utils/AI/Toolbox/Serializer.test.ts +14 -3
  319. package/Tests/Server/Utils/EditionEnforcement.test.ts +107 -147
  320. package/Tests/Server/Utils/{CommunityEditionSsoReport.test.ts → RelaxedScimTeamLocksReport.test.ts} +212 -208
  321. package/Tests/Server/Utils/SameOriginRequest.test.ts +372 -0
  322. package/Tests/Server/Utils/Telemetry/EntityRegistry.test.ts +20 -0
  323. package/Tests/Server/Utils/Telemetry/MessageQueueDiscovery.test.ts +2590 -0
  324. package/Tests/Server/Utils/Telemetry/MessageQueueSpanQueryTwin.ts +246 -0
  325. package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +23 -0
  326. package/Tests/Types/AI/AIAgentRunLimits.test.ts +255 -0
  327. package/Tests/Types/Code/JsonSyntax.test.ts +1300 -0
  328. package/Tests/Types/CustomField/CustomFieldCreateSettings.test.ts +1113 -0
  329. package/Tests/Types/CustomField/CustomFieldMappingCatalog.test.ts +91 -0
  330. package/Tests/Types/CustomField/CustomFieldValueValidator.test.ts +30 -0
  331. package/Tests/Types/Incident/IncidentFormIpAllowlist.test.ts +227 -0
  332. package/Tests/Types/Incident/IncidentFormPublic.test.ts +1916 -0
  333. package/Tests/Types/MessageQueue/MessageQueueEntityKey.test.ts +916 -0
  334. package/Tests/Types/MessageQueue/MessageQueueIdentity.test.ts +567 -0
  335. package/Tests/Types/MessageQueue/MessageQueueManualIdentity.test.ts +686 -0
  336. package/Tests/Types/MessageQueue/MessageQueueMetricCatalog.test.ts +1726 -0
  337. package/Tests/Types/MessageQueue/MessageQueueMetricResolution.test.ts +1758 -0
  338. package/Tests/Types/MessageQueue/MessagingInstrumentationFixtures.test.ts +4686 -0
  339. package/Tests/Types/MessageQueue/MessagingSystem.test.ts +840 -0
  340. package/Tests/Types/MessageQueue/MessagingTelemetryFixtures.ts +3287 -0
  341. package/Tests/Types/MessageQueue/MessagingTelemetryResolver.test.ts +2966 -0
  342. package/Tests/Types/Monitor/MessageQueueAlertTemplates.test.ts +5401 -0
  343. package/Tests/Types/Monitor/MetricEngineFold.ts +154 -0
  344. package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +5 -3
  345. package/Tests/Types/Team/ComplianceRule.test.ts +588 -37
  346. package/Tests/Types/Team/TeamComplianceStatus.test.ts +64 -11
  347. package/Tests/Types/XML.test.ts +51 -0
  348. package/Tests/UI/Components/CodeEditor/CodeEditor.test.tsx +2362 -0
  349. package/Tests/UI/Components/CodeEditor/CodeEditorCommands.test.ts +810 -0
  350. package/Tests/UI/Components/CodeEditor/CodeEditorHighlight.test.ts +338 -0
  351. package/Tests/UI/Components/CodeEditor/CodeEditorLanguages.test.ts +222 -0
  352. package/Tests/UI/Components/CodeEditor/CodeEditorStyles.test.ts +807 -0
  353. package/Tests/UI/Components/CodeEditor/NoMonaco.test.ts +245 -0
  354. package/Tests/UI/Components/CodeEditor/YamlEditor.test.tsx +729 -0
  355. package/Tests/UI/Components/CopyTextButton.test.tsx +76 -0
  356. package/Tests/UI/Components/EditionLabelLapseCopy.ts +51 -14
  357. package/Tests/UI/Components/EditionLabelLicenseStatus.test.tsx +131 -23
  358. package/Tests/UI/Components/ErrorMessageAction.test.tsx +142 -0
  359. package/Tests/UI/Components/FacetSidebarInScope.test.tsx +459 -0
  360. package/Tests/UI/Components/FacetValuesInScope.test.ts +270 -0
  361. package/Tests/UI/Components/Forms/FormFieldCodeEditors.test.tsx +294 -0
  362. package/Tests/UI/Components/Forms/FormFieldMarkdown.test.tsx +126 -0
  363. package/Tests/UI/Components/Forms/FormFieldYaml.test.tsx +22 -75
  364. package/Tests/UI/Components/Forms/ModelFormOnBeforeCreateMiscData.test.tsx +254 -0
  365. package/Tests/UI/Components/Icon.test.tsx +32 -0
  366. package/Tests/UI/Components/Input.test.tsx +31 -0
  367. package/Tests/UI/Components/LockedFilterChipScope.test.tsx +501 -0
  368. package/Tests/UI/Components/MarkdownConverters.test.ts +253 -1
  369. package/Tests/UI/Components/MarkdownEditor.test.tsx +2785 -2
  370. package/Tests/UI/Components/MarkdownEditorHistory.test.ts +243 -0
  371. package/Tests/UI/Components/MarkdownListEditing.test.ts +1118 -0
  372. package/Tests/UI/Components/MarkdownPaste.test.ts +1180 -0
  373. package/Tests/UI/Components/MarkdownViewerCopy.test.tsx +466 -0
  374. package/Tests/UI/Components/MarkdownVisualEditing.test.ts +1089 -0
  375. package/Tests/UI/Components/ModelTable/BaseModelTableEmptyStateAction.test.tsx +623 -0
  376. package/Tests/UI/Components/ResetObjectID.test.tsx +282 -0
  377. package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
  378. package/Tests/UI/Components/Table/EmptyTableMessage.test.ts +439 -0
  379. package/Tests/UI/Components/Table/TableEmptyState.test.tsx +352 -0
  380. package/Tests/UI/Components/TableRowMobileTitles.test.tsx +78 -0
  381. package/Tests/UI/Components/TextArea.test.tsx +19 -0
  382. package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +12 -29
  383. package/Tests/UI/Components/fixtures/MarkdownPasteFixtures.ts +460 -0
  384. package/Tests/UI/EsbuildConfig.test.ts +115 -39
  385. package/Tests/UI/EsbuildEnterpriseAlias.test.ts +4 -4
  386. package/Tests/UI/Monitor/MonitorLogSummaryRender.test.tsx +377 -0
  387. package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +81 -1
  388. package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +17 -0
  389. package/Tests/Utils/LabelRuleImportExport.test.ts +5 -0
  390. package/Tests/Utils/Markdown/DashboardMarkdownRenderer.ts +81 -0
  391. package/Tests/Utils/Markdown/UntrustedMarkdown.test.ts +1339 -0
  392. package/Tests/Utils/Monitor/MonitorLogSummaryUtil.test.ts +862 -0
  393. package/Types/AI/AIAgentRunLimits.ts +146 -0
  394. package/Types/Code/CodeType.ts +2 -0
  395. package/Types/Code/JsonSyntax.ts +923 -0
  396. package/Types/CustomField/CustomFieldCreateSettings.ts +549 -0
  397. package/Types/CustomField/CustomFieldMappingCatalog.ts +77 -0
  398. package/Types/CustomField/CustomFieldValueValidator.ts +10 -7
  399. package/Types/EnterpriseLicense/EnterpriseLicensePeriods.ts +1 -1
  400. package/Types/Icon/IconProp.ts +2 -0
  401. package/Types/Incident/IncidentFormIpAllowlist.ts +206 -0
  402. package/Types/Incident/IncidentFormPublic.ts +1145 -0
  403. package/Types/Kubernetes/KubernetesClusterAiAccess.ts +10 -3
  404. package/Types/MessageQueue/MessageQueueIdentity.ts +256 -0
  405. package/Types/MessageQueue/MessageQueueManualIdentity.ts +325 -0
  406. package/Types/MessageQueue/MessageQueueMetricCatalog.ts +1357 -0
  407. package/Types/MessageQueue/MessagingSystem.ts +518 -0
  408. package/Types/MessageQueue/MessagingTelemetryResolver.ts +2311 -0
  409. package/Types/Monitor/MessageQueueAlertTemplates.ts +2128 -0
  410. package/Types/Permission.ts +310 -0
  411. package/Types/ResourceAiAgent/ResourceAiAccess.ts +10 -4
  412. package/Types/Rules/RuleCriteriaFieldRegistry.ts +12 -0
  413. package/Types/Rules/RuleRun.ts +4 -0
  414. package/Types/Team/ComplianceNotificationChannel.ts +4 -3
  415. package/Types/Team/ComplianceRule.ts +71 -18
  416. package/Types/Team/ComplianceRuleType.ts +2 -2
  417. package/Types/Team/TeamComplianceStatus.ts +6 -2
  418. package/Types/Telemetry/EntityType.ts +16 -0
  419. package/Types/Telemetry/LockedFilterDetail.ts +22 -0
  420. package/Types/XML.ts +26 -0
  421. package/UI/Components/CodeEditor/CodeEditor.css +379 -0
  422. package/UI/Components/CodeEditor/CodeEditor.tsx +1128 -294
  423. package/UI/Components/CodeEditor/CodeEditorCommands.ts +774 -0
  424. package/UI/Components/CodeEditor/CodeEditorHighlight.ts +106 -0
  425. package/UI/Components/CodeEditor/CodeEditorLanguages.ts +164 -0
  426. package/UI/Components/CodeEditor/YamlEditor.tsx +28 -326
  427. package/UI/Components/CopyTextButton/CopyTextButton.tsx +5 -1
  428. package/UI/Components/CustomFields/CustomFieldModelFormFields.tsx +6 -25
  429. package/UI/Components/EditionLabel/EditionLabel.tsx +14 -13
  430. package/UI/Components/ErrorMessage/ErrorMessage.tsx +11 -1
  431. package/UI/Components/Forms/Fields/FormField.tsx +8 -0
  432. package/UI/Components/Forms/Types/Field.ts +8 -0
  433. package/UI/Components/Icon/Icon.tsx +18 -0
  434. package/UI/Components/Input/Input.tsx +11 -4
  435. package/UI/Components/LogsViewer/LogsViewer.tsx +4 -0
  436. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +21 -3
  437. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  438. package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +877 -79
  439. package/UI/Components/Markdown.tsx/MarkdownEditorHistory.ts +284 -0
  440. package/UI/Components/Markdown.tsx/MarkdownListEditing.ts +1362 -0
  441. package/UI/Components/Markdown.tsx/MarkdownPaste.ts +1326 -0
  442. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +106 -10
  443. package/UI/Components/Markdown.tsx/MarkdownVisualEditing.ts +1032 -0
  444. package/UI/Components/ModelTable/BaseModelTable.tsx +85 -7
  445. package/UI/Components/ResetObjectID/ResetObjectID.tsx +35 -9
  446. package/UI/Components/Table/EmptyTableMessage.ts +81 -0
  447. package/UI/Components/Table/Table.tsx +50 -21
  448. package/UI/Components/Table/TableRow.tsx +9 -1
  449. package/UI/Components/TelemetryViewer/FacetVisibility.ts +97 -2
  450. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +13 -0
  451. package/UI/Components/TelemetryViewer/components/LockedFilterChip.tsx +214 -7
  452. package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +21 -3
  453. package/UI/Components/TextArea/TextArea.tsx +9 -2
  454. package/UI/Components/Workflow/ModelFieldPicker.tsx +10 -12
  455. package/UI/Styles/Theme.css +8 -0
  456. package/UI/esbuild-config.js +2 -32
  457. package/Utils/LabelRuleImportExport.ts +2 -0
  458. package/Utils/Markdown/UntrustedMarkdown.ts +1513 -0
  459. package/Utils/Monitor/IncomingEmailMonitorRequestUtil.ts +41 -0
  460. package/Utils/Monitor/MonitorLogSummaryUtil.ts +212 -0
  461. package/Utils/Telemetry/EntityKey.ts +48 -0
  462. package/build/dist/Models/DatabaseModels/AIConversation.js +125 -1
  463. package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -1
  464. package/build/dist/Models/DatabaseModels/CephCluster.js +12 -0
  465. package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
  466. package/build/dist/Models/DatabaseModels/CloudResource.js +12 -0
  467. package/build/dist/Models/DatabaseModels/CloudResource.js.map +1 -1
  468. package/build/dist/Models/DatabaseModels/DatabaseServer.js +12 -0
  469. package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
  470. package/build/dist/Models/DatabaseModels/DockerHost.js +12 -0
  471. package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
  472. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +12 -0
  473. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
  474. package/build/dist/Models/DatabaseModels/GlobalOidc.js +0 -4
  475. package/build/dist/Models/DatabaseModels/GlobalOidc.js.map +1 -1
  476. package/build/dist/Models/DatabaseModels/GlobalOidcProject.js +0 -4
  477. package/build/dist/Models/DatabaseModels/GlobalOidcProject.js.map +1 -1
  478. package/build/dist/Models/DatabaseModels/GlobalSso.js +0 -4
  479. package/build/dist/Models/DatabaseModels/GlobalSso.js.map +1 -1
  480. package/build/dist/Models/DatabaseModels/GlobalSsoProject.js +0 -4
  481. package/build/dist/Models/DatabaseModels/GlobalSsoProject.js.map +1 -1
  482. package/build/dist/Models/DatabaseModels/Host.js +12 -0
  483. package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
  484. package/build/dist/Models/DatabaseModels/IncidentForm.js +605 -0
  485. package/build/dist/Models/DatabaseModels/IncidentForm.js.map +1 -0
  486. package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js +299 -0
  487. package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js.map +1 -0
  488. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +60 -0
  489. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  490. package/build/dist/Models/DatabaseModels/Index.js +14 -0
  491. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  492. package/build/dist/Models/DatabaseModels/IoTFleet.js +12 -0
  493. package/build/dist/Models/DatabaseModels/IoTFleet.js.map +1 -1
  494. package/build/dist/Models/DatabaseModels/KubernetesCluster.js +12 -0
  495. package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
  496. package/build/dist/Models/DatabaseModels/MessageQueue.js +1106 -0
  497. package/build/dist/Models/DatabaseModels/MessageQueue.js.map +1 -0
  498. package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js +562 -0
  499. package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js.map +1 -0
  500. package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js +643 -0
  501. package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js.map +1 -0
  502. package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js +506 -0
  503. package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js.map +1 -0
  504. package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js +505 -0
  505. package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js.map +1 -0
  506. package/build/dist/Models/DatabaseModels/PodmanHost.js +12 -0
  507. package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
  508. package/build/dist/Models/DatabaseModels/Project.js +61 -0
  509. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  510. package/build/dist/Models/DatabaseModels/ProjectOidc.js +0 -4
  511. package/build/dist/Models/DatabaseModels/ProjectOidc.js.map +1 -1
  512. package/build/dist/Models/DatabaseModels/ProjectSso.js +0 -4
  513. package/build/dist/Models/DatabaseModels/ProjectSso.js.map +1 -1
  514. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +12 -0
  515. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
  516. package/build/dist/Models/DatabaseModels/RumApplication.js +12 -0
  517. package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
  518. package/build/dist/Models/DatabaseModels/ServerlessFunction.js +12 -0
  519. package/build/dist/Models/DatabaseModels/ServerlessFunction.js.map +1 -1
  520. package/build/dist/Models/DatabaseModels/Service.js +12 -0
  521. package/build/dist/Models/DatabaseModels/Service.js.map +1 -1
  522. package/build/dist/Models/DatabaseModels/StatusPageOidc.js +0 -4
  523. package/build/dist/Models/DatabaseModels/StatusPageOidc.js.map +1 -1
  524. package/build/dist/Models/DatabaseModels/StatusPageSso.js +0 -4
  525. package/build/dist/Models/DatabaseModels/StatusPageSso.js.map +1 -1
  526. package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js +49 -3
  527. package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js.map +1 -1
  528. package/build/dist/Models/DatabaseModels/VMwareVCenter.js +12 -0
  529. package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
  530. package/build/dist/Server/API/AIChatAPI.js +9 -103
  531. package/build/dist/Server/API/AIChatAPI.js.map +1 -1
  532. package/build/dist/Server/API/AIInvestigationAPI.js +3 -3
  533. package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
  534. package/build/dist/Server/API/AIInvestigationConversationAPI.js +162 -0
  535. package/build/dist/Server/API/AIInvestigationConversationAPI.js.map +1 -0
  536. package/build/dist/Server/API/IncidentFormAPI.js +245 -0
  537. package/build/dist/Server/API/IncidentFormAPI.js.map +1 -0
  538. package/build/dist/Server/API/ProjectOIDC.js +16 -24
  539. package/build/dist/Server/API/ProjectOIDC.js.map +1 -1
  540. package/build/dist/Server/API/ProjectSSO.js +16 -24
  541. package/build/dist/Server/API/ProjectSSO.js.map +1 -1
  542. package/build/dist/Server/API/StatusPageAPI.js +42 -75
  543. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  544. package/build/dist/Server/Enterprise/EnterpriseEdition.js +79 -25
  545. package/build/dist/Server/Enterprise/EnterpriseEdition.js.map +1 -1
  546. package/build/dist/Server/Enterprise/EnterpriseFeature.js +24 -3
  547. package/build/dist/Server/Enterprise/EnterpriseFeature.js.map +1 -1
  548. package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js +1 -1
  549. package/build/dist/Server/Enterprise/EnterpriseServerModule.js.map +1 -1
  550. package/build/dist/Server/EnvironmentConfig.js +1 -1
  551. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js +63 -0
  552. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js.map +1 -0
  553. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js +41 -0
  554. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js.map +1 -0
  555. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js +40 -0
  556. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js.map +1 -0
  557. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js +183 -0
  558. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js.map +1 -0
  559. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  560. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  561. package/build/dist/Server/Middleware/IncidentFormRateLimit.js +559 -0
  562. package/build/dist/Server/Middleware/IncidentFormRateLimit.js.map +1 -0
  563. package/build/dist/Server/Middleware/UserAuthorization.js +11 -30
  564. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  565. package/build/dist/Server/Services/AIService.js +10 -13
  566. package/build/dist/Server/Services/AIService.js.map +1 -1
  567. package/build/dist/Server/Services/IncidentCustomFieldService.js +83 -0
  568. package/build/dist/Server/Services/IncidentCustomFieldService.js.map +1 -1
  569. package/build/dist/Server/Services/IncidentEpisodeMemberService.js +8 -4
  570. package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
  571. package/build/dist/Server/Services/IncidentEpisodeService.js +10 -1
  572. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  573. package/build/dist/Server/Services/IncidentFormService.js +1202 -0
  574. package/build/dist/Server/Services/IncidentFormService.js.map +1 -0
  575. package/build/dist/Server/Services/IncidentFormSubmissionService.js +91 -0
  576. package/build/dist/Server/Services/IncidentFormSubmissionService.js.map +1 -0
  577. package/build/dist/Server/Services/IncidentGroupingEngineService.js +20 -8
  578. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  579. package/build/dist/Server/Services/IncidentService.js +106 -4
  580. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  581. package/build/dist/Server/Services/IncidentTemplateService.js +18 -0
  582. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  583. package/build/dist/Server/Services/Index.js +14 -0
  584. package/build/dist/Server/Services/Index.js.map +1 -1
  585. package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js +262 -0
  586. package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js.map +1 -0
  587. package/build/dist/Server/Services/MessageQueueLabelRuleService.js +13 -0
  588. package/build/dist/Server/Services/MessageQueueLabelRuleService.js.map +1 -0
  589. package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js +334 -0
  590. package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js.map +1 -0
  591. package/build/dist/Server/Services/MessageQueueOwnerRuleService.js +13 -0
  592. package/build/dist/Server/Services/MessageQueueOwnerRuleService.js.map +1 -0
  593. package/build/dist/Server/Services/MessageQueueOwnerTeamService.js +62 -0
  594. package/build/dist/Server/Services/MessageQueueOwnerTeamService.js.map +1 -0
  595. package/build/dist/Server/Services/MessageQueueOwnerUserService.js +62 -0
  596. package/build/dist/Server/Services/MessageQueueOwnerUserService.js.map +1 -0
  597. package/build/dist/Server/Services/MessageQueueService.js +1140 -0
  598. package/build/dist/Server/Services/MessageQueueService.js.map +1 -0
  599. package/build/dist/Server/Services/OpenTelemetryIngestService.js +25 -4
  600. package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
  601. package/build/dist/Server/Services/ProjectService.js +0 -54
  602. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  603. package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -4
  604. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  605. package/build/dist/Server/Services/StatusPageService.js +0 -46
  606. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  607. package/build/dist/Server/Services/TeamComplianceSettingService.js +120 -31
  608. package/build/dist/Server/Services/TeamComplianceSettingService.js.map +1 -1
  609. package/build/dist/Server/Services/UserNotificationRuleService.js +8 -1
  610. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  611. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +12 -3
  612. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
  613. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +6 -3
  614. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
  615. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js +109 -37
  616. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js.map +1 -1
  617. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +16 -0
  618. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
  619. package/build/dist/Server/Types/Database/Permissions/TablePermission.js +3 -3
  620. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js +9 -6
  621. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js.map +1 -1
  622. package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js +128 -0
  623. package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js.map +1 -0
  624. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +192 -50
  625. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
  626. package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js +133 -0
  627. package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js.map +1 -0
  628. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +53 -13
  629. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -1
  630. package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +1 -1
  631. package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js +206 -0
  632. package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js.map +1 -0
  633. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +53 -26
  634. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -1
  635. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +4 -2
  636. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -1
  637. package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +1 -29
  638. package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -1
  639. package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js +24 -24
  640. package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js.map +1 -1
  641. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +7 -2
  642. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
  643. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +29 -14
  644. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
  645. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +38 -14
  646. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -1
  647. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +2 -0
  648. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -1
  649. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +40 -10
  650. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
  651. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +19 -7
  652. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
  653. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +19 -7
  654. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
  655. package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js +15 -18
  656. package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js.map +1 -1
  657. package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js +412 -0
  658. package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js.map +1 -0
  659. package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js +495 -0
  660. package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js.map +1 -0
  661. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +10 -3
  662. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -1
  663. package/build/dist/Server/Utils/EditionEnforcement.js +20 -158
  664. package/build/dist/Server/Utils/EditionEnforcement.js.map +1 -1
  665. package/build/dist/Server/Utils/LLM/LLMService.js +193 -54
  666. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  667. package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js +160 -0
  668. package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js.map +1 -0
  669. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +25 -0
  670. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
  671. package/build/dist/Server/Utils/SameOriginRequest.js +151 -0
  672. package/build/dist/Server/Utils/SameOriginRequest.js.map +1 -0
  673. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +2 -0
  674. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -1
  675. package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +4 -1
  676. package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
  677. package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js +1015 -0
  678. package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js.map +1 -0
  679. package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +4 -1
  680. package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -1
  681. package/build/dist/Server/Utils/VendorAssets.js +3 -3
  682. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +3 -1
  683. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  684. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +3 -1
  685. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  686. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +10 -1
  687. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  688. package/build/dist/Types/AI/AIAgentRunLimits.js +91 -0
  689. package/build/dist/Types/AI/AIAgentRunLimits.js.map +1 -0
  690. package/build/dist/Types/Code/CodeType.js +2 -0
  691. package/build/dist/Types/Code/CodeType.js.map +1 -1
  692. package/build/dist/Types/Code/JsonSyntax.js +604 -0
  693. package/build/dist/Types/Code/JsonSyntax.js.map +1 -0
  694. package/build/dist/Types/CustomField/CustomFieldCreateSettings.js +310 -0
  695. package/build/dist/Types/CustomField/CustomFieldCreateSettings.js.map +1 -0
  696. package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js +38 -0
  697. package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js.map +1 -1
  698. package/build/dist/Types/CustomField/CustomFieldValueValidator.js +10 -7
  699. package/build/dist/Types/CustomField/CustomFieldValueValidator.js.map +1 -1
  700. package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js +1 -1
  701. package/build/dist/Types/Icon/IconProp.js +2 -0
  702. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  703. package/build/dist/Types/Incident/IncidentFormIpAllowlist.js +119 -0
  704. package/build/dist/Types/Incident/IncidentFormIpAllowlist.js.map +1 -0
  705. package/build/dist/Types/Incident/IncidentFormPublic.js +678 -0
  706. package/build/dist/Types/Incident/IncidentFormPublic.js.map +1 -0
  707. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +10 -3
  708. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -1
  709. package/build/dist/Types/MessageQueue/MessageQueueIdentity.js +184 -0
  710. package/build/dist/Types/MessageQueue/MessageQueueIdentity.js.map +1 -0
  711. package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js +190 -0
  712. package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js.map +1 -0
  713. package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js +1057 -0
  714. package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js.map +1 -0
  715. package/build/dist/Types/MessageQueue/MessagingSystem.js +394 -0
  716. package/build/dist/Types/MessageQueue/MessagingSystem.js.map +1 -0
  717. package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js +1768 -0
  718. package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js.map +1 -0
  719. package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js +1207 -0
  720. package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js.map +1 -0
  721. package/build/dist/Types/Permission.js +274 -0
  722. package/build/dist/Types/Permission.js.map +1 -1
  723. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +10 -4
  724. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -1
  725. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +12 -0
  726. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
  727. package/build/dist/Types/Rules/RuleRun.js +4 -0
  728. package/build/dist/Types/Rules/RuleRun.js.map +1 -1
  729. package/build/dist/Types/Team/ComplianceNotificationChannel.js +4 -3
  730. package/build/dist/Types/Team/ComplianceNotificationChannel.js.map +1 -1
  731. package/build/dist/Types/Team/ComplianceRule.js +48 -14
  732. package/build/dist/Types/Team/ComplianceRule.js.map +1 -1
  733. package/build/dist/Types/Team/ComplianceRuleType.js +2 -2
  734. package/build/dist/Types/Telemetry/EntityType.js +16 -0
  735. package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
  736. package/build/dist/Types/XML.js +23 -0
  737. package/build/dist/Types/XML.js.map +1 -1
  738. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +641 -266
  739. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  740. package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js +464 -0
  741. package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js.map +1 -0
  742. package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js +69 -0
  743. package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js.map +1 -0
  744. package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js +108 -0
  745. package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js.map +1 -0
  746. package/build/dist/UI/Components/CodeEditor/YamlEditor.js +14 -186
  747. package/build/dist/UI/Components/CodeEditor/YamlEditor.js.map +1 -1
  748. package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js +5 -1
  749. package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js.map +1 -1
  750. package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js +5 -14
  751. package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js.map +1 -1
  752. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +14 -13
  753. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  754. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +1 -1
  755. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
  756. package/build/dist/UI/Components/Forms/Fields/FormField.js +8 -3
  757. package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
  758. package/build/dist/UI/Components/Icon/Icon.js +8 -0
  759. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  760. package/build/dist/UI/Components/Input/Input.js +11 -3
  761. package/build/dist/UI/Components/Input/Input.js.map +1 -1
  762. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +2 -1
  763. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  764. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +14 -4
  765. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  766. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  767. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  768. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +710 -65
  769. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
  770. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js +238 -0
  771. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js.map +1 -0
  772. package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js +1028 -0
  773. package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js.map +1 -0
  774. package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js +1088 -0
  775. package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js.map +1 -0
  776. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +70 -10
  777. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
  778. package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js +887 -0
  779. package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js.map +1 -0
  780. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +57 -6
  781. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  782. package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js +7 -5
  783. package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js.map +1 -1
  784. package/build/dist/UI/Components/Table/EmptyTableMessage.js +51 -0
  785. package/build/dist/UI/Components/Table/EmptyTableMessage.js.map +1 -0
  786. package/build/dist/UI/Components/Table/Table.js +30 -11
  787. package/build/dist/UI/Components/Table/Table.js.map +1 -1
  788. package/build/dist/UI/Components/Table/TableRow.js +9 -2
  789. package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
  790. package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js +63 -1
  791. package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js.map +1 -1
  792. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +4 -2
  793. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  794. package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js +91 -10
  795. package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js.map +1 -1
  796. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +14 -4
  797. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
  798. package/build/dist/UI/Components/TextArea/TextArea.js +9 -3
  799. package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
  800. package/build/dist/UI/Components/Workflow/ModelFieldPicker.js +1 -2
  801. package/build/dist/UI/Components/Workflow/ModelFieldPicker.js.map +1 -1
  802. package/build/dist/Utils/LabelRuleImportExport.js +2 -0
  803. package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
  804. package/build/dist/Utils/Markdown/UntrustedMarkdown.js +988 -0
  805. package/build/dist/Utils/Markdown/UntrustedMarkdown.js.map +1 -0
  806. package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js +34 -0
  807. package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js.map +1 -0
  808. package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js +148 -0
  809. package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js.map +1 -0
  810. package/build/dist/Utils/Telemetry/EntityKey.js +36 -0
  811. package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
  812. package/package.json +1 -3
  813. package/Server/Utils/CommunityEditionSsoReport.ts +0 -361
  814. package/Tests/App/Accounts/LoginSsoEdition.test.tsx +0 -616
  815. package/Tests/App/AdminDashboard/AdminAuthenticationSsoEdition.test.tsx +0 -217
  816. package/Tests/App/AdminDashboard/GlobalSSOEnterpriseShells.test.tsx +0 -271
  817. package/Tests/App/Dashboard/CloudDocumentationMarkdown.test.ts +0 -215
  818. package/Tests/App/Dashboard/TelemetryResourceRetentionSettings.test.tsx +0 -784
  819. package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +0 -518
  820. package/Tests/Server/Services/SsoRequirementReadMasking.test.ts +0 -419
  821. package/Tests/Server/Services/SsoRequirementWriteGuard.test.ts +0 -769
  822. package/Tests/UI/Components/CodeEditor.test.tsx +0 -638
  823. package/Tests/UI/Components/MonacoLoader.test.ts +0 -67
  824. package/Tests/UI/Components/MonacoRuntime.test.ts +0 -121
  825. package/Tests/UI/Components/Telemetry/TelemetryRetentionConfigForm.test.tsx +0 -329
  826. package/Tests/UI/Components/YamlEditor.test.tsx +0 -847
  827. package/UI/Components/CodeEditor/MonacoLoader.ts +0 -36
  828. package/UI/Components/Telemetry/TelemetryRetentionConfigForm.tsx +0 -319
  829. package/UI/Components/Telemetry/TelemetryRetentionConfigSummary.tsx +0 -223
  830. package/build/dist/Server/Utils/CommunityEditionSsoReport.js +0 -223
  831. package/build/dist/Server/Utils/CommunityEditionSsoReport.js.map +0 -1
  832. package/build/dist/UI/Components/CodeEditor/MonacoLoader.js +0 -34
  833. package/build/dist/UI/Components/CodeEditor/MonacoLoader.js.map +0 -1
  834. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js +0 -171
  835. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js.map +0 -1
  836. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js +0 -119
  837. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js.map +0 -1
@@ -0,0 +1,1032 @@
1
+ /*
2
+ * Inserting into the visual editor's DOM by hand, where the browser's own
3
+ * document.execCommand("insertHTML") gets it wrong.
4
+ *
5
+ * With the caret in the middle or at the end of a line, Chromium's and
6
+ * Safari's insertHTML fold the first block of what is inserted into that
7
+ * line: a <pre> becomes a monospace <span> inside the paragraph, and the
8
+ * first line of a quote leaves the quote. The serializer reads a <span> as
9
+ * plain text, so the Code Block button saved "hellocode block" and a fenced
10
+ * block pasted after "Run:" saved "Run:npm install". Here the line is split
11
+ * at the caret instead, and the blocks go in between its two halves -- what
12
+ * Firefox's insertHTML does, and what the markdown means.
13
+ *
14
+ * Only onto an empty line -- or into the empty editor -- does insertHTML put
15
+ * blocks where they belong in every browser, and there the editor still
16
+ * uses it, since it puts the insert on the browser's undo stack.
17
+ */
18
+
19
+ // A line of text, which a block inserted into its middle splits in two.
20
+ const SPLITTABLE_LINE_TAGS: Set<string> = new Set<string>([
21
+ "p",
22
+ "div",
23
+ "h1",
24
+ "h2",
25
+ "h3",
26
+ "h4",
27
+ "h5",
28
+ "h6",
29
+ ]);
30
+
31
+ /*
32
+ * Elements that hold blocks as well as text of their own: a block inserted
33
+ * into one stays inside it, as a code block pasted into a list item belongs
34
+ * to that item. A list inserted into a list item is the exception: its items
35
+ * join the item's list (insertListItemsAtCaret).
36
+ */
37
+ const BLOCK_HOLDER_TAGS: Set<string> = new Set<string>([
38
+ "li",
39
+ "blockquote",
40
+ "td",
41
+ "th",
42
+ ]);
43
+
44
+ // Elements that start a new line of their own, rather than run on in one.
45
+ const BLOCK_TAGS: Set<string> = new Set<string>([
46
+ "address",
47
+ "article",
48
+ "aside",
49
+ "blockquote",
50
+ "dd",
51
+ "details",
52
+ "div",
53
+ "dl",
54
+ "dt",
55
+ "fieldset",
56
+ "figure",
57
+ "footer",
58
+ "form",
59
+ "h1",
60
+ "h2",
61
+ "h3",
62
+ "h4",
63
+ "h5",
64
+ "h6",
65
+ "header",
66
+ "hr",
67
+ "li",
68
+ "main",
69
+ "nav",
70
+ "ol",
71
+ "p",
72
+ "pre",
73
+ "section",
74
+ "table",
75
+ "ul",
76
+ ]);
77
+
78
+ // What makes a line hold something even with no text in it.
79
+ const CONTENT_ELEMENT_TAGS: Array<string> = [
80
+ "img",
81
+ "input",
82
+ "hr",
83
+ "table",
84
+ "pre",
85
+ "ul",
86
+ "ol",
87
+ "blockquote",
88
+ "video",
89
+ "audio",
90
+ "iframe",
91
+ ];
92
+ const CONTENT_ELEMENT_SELECTOR: string = CONTENT_ELEMENT_TAGS.join(", ");
93
+
94
+ // Whitespace a browser does not show; a non-breaking space is shown.
95
+ const RE_SHOWN_TEXT: RegExp = /[^ \t\n\r\f\u200b\ufeff]/;
96
+
97
+ const tagOf: (node: Node | null | undefined) => string = (
98
+ node: Node | null | undefined,
99
+ ): string => {
100
+ if (!node || node.nodeType !== Node.ELEMENT_NODE) {
101
+ return "";
102
+ }
103
+ return (node as Element).localName.toLowerCase();
104
+ };
105
+
106
+ const isBlock: (node: Node | null | undefined) => boolean = (
107
+ node: Node | null | undefined,
108
+ ): boolean => {
109
+ return BLOCK_TAGS.has(tagOf(node));
110
+ };
111
+
112
+ /*
113
+ * Whether `node` -- an element, a text node or a fragment -- shows nothing:
114
+ * no text but whitespace, and no image, rule or other block. A lone <br>
115
+ * (the placeholder a browser keeps in an empty line) counts as nothing.
116
+ */
117
+ const holdsNothing: (node: Node) => boolean = (node: Node): boolean => {
118
+ if (RE_SHOWN_TEXT.test(node.textContent || "")) {
119
+ return false;
120
+ }
121
+ if (CONTENT_ELEMENT_TAGS.includes(tagOf(node))) {
122
+ return false;
123
+ }
124
+ if (
125
+ node.nodeType === Node.ELEMENT_NODE ||
126
+ node.nodeType === Node.DOCUMENT_FRAGMENT_NODE
127
+ ) {
128
+ return (
129
+ (node as Element | DocumentFragment).querySelector(
130
+ CONTENT_ELEMENT_SELECTOR,
131
+ ) === null
132
+ );
133
+ }
134
+ return true;
135
+ };
136
+
137
+ /*
138
+ * Whether the caret sits on an empty line of its own: in the empty editor,
139
+ * or in a blank paragraph straight inside it -- "", or just the <br> a
140
+ * browser keeps there. There insertHTML puts blocks where they belong in
141
+ * every browser; anywhere else it may fold them into the line.
142
+ */
143
+ export const isCaretOnEmptyLine: (
144
+ editable: HTMLElement,
145
+ range: Range,
146
+ ) => boolean = (editable: HTMLElement, range: Range): boolean => {
147
+ if (!range.collapsed || !editable.contains(range.startContainer)) {
148
+ return false;
149
+ }
150
+ if (range.startContainer === editable) {
151
+ return holdsNothing(editable) && (editable.textContent || "") === "";
152
+ }
153
+ let line: Node = range.startContainer;
154
+ while (line.parentNode && line.parentNode !== editable) {
155
+ line = line.parentNode;
156
+ }
157
+ if (!SPLITTABLE_LINE_TAGS.has(tagOf(line))) {
158
+ return false;
159
+ }
160
+ /*
161
+ * Strictly empty: Chromium folds a block into a line holding even a
162
+ * single space, which it keeps as a non-breaking one.
163
+ */
164
+ return (line.textContent || "") === "" && holdsNothing(line);
165
+ };
166
+
167
+ interface InsertionPoint {
168
+ parent: Node;
169
+ before: Node | null;
170
+ }
171
+
172
+ const RE_LEADING_SPACES: RegExp = /^[ \t\n\r\f]+/;
173
+ const RE_TRAILING_SPACES: RegExp = /[ \t\n\r\f]+$/;
174
+
175
+ // Elements that show something with nothing inside them.
176
+ const SHOWN_EMPTY_TAGS: Set<string> = new Set<string>([
177
+ "br",
178
+ "img",
179
+ "input",
180
+ "hr",
181
+ "video",
182
+ "audio",
183
+ "iframe",
184
+ ]);
185
+
186
+ /*
187
+ * Tidies one edge of a split: from `edge`, the node next to the split,
188
+ * forward into what follows it or back into what precedes it, up to the
189
+ * first text a browser shows -- within `container`, the line or item that
190
+ * was split.
191
+ *
192
+ * The space the caret sat next to ends up at the edge of a line once the
193
+ * line is split there. A browser does not show a space at a line's edge,
194
+ * but the serializer would still write it -- "Run this \n\n```" -- so it
195
+ * goes. A non-breaking space is shown, and stays.
196
+ *
197
+ * And text nodes and inline elements left with nothing in them go. With the
198
+ * caret at the very end of a bold word, a link or inline code, the split
199
+ * copies that element into the part after the caret with nothing in it; at
200
+ * the very start of one, it leaves the element where it was, emptied; and a
201
+ * selection pasted over can leave one emptied too. None of them shows, but
202
+ * the serializer wrote them: "**** then check", "`` now", and an empty link
203
+ * as its address, a second link the note never had.
204
+ *
205
+ * This runs once both parts are back in the editor. The part after the
206
+ * caret can hold nodes the split moved out whole, and a change made to them
207
+ * while they were out of the editor is one an undo cannot check the editor
208
+ * against (MarkdownEditorHistory): with the caret between a bold word and
209
+ * the space after it, Ctrl+Z refused to take the insert back.
210
+ */
211
+ const tidySplitEdge: (
212
+ edge: Node | null,
213
+ container: Node,
214
+ forward: boolean,
215
+ ) => void = (edge: Node | null, container: Node, forward: boolean): void => {
216
+ const spaces: RegExp = forward ? RE_LEADING_SPACES : RE_TRAILING_SPACES;
217
+ let node: Node | null = edge;
218
+ while (node && node !== container && container.contains(node)) {
219
+ if (node.nodeType === Node.TEXT_NODE) {
220
+ const text: Text = node as Text;
221
+ const trimmed: string = text.data.replace(spaces, "");
222
+ if (trimmed !== text.data) {
223
+ text.data = trimmed;
224
+ }
225
+ if (trimmed !== "") {
226
+ return;
227
+ }
228
+ } else if (node.nodeType === Node.ELEMENT_NODE) {
229
+ if (isBlock(node) || SHOWN_EMPTY_TAGS.has(tagOf(node))) {
230
+ return;
231
+ }
232
+ const inner: ChildNode | null = forward
233
+ ? node.firstChild
234
+ : node.lastChild;
235
+ if (inner) {
236
+ node = inner;
237
+ continue;
238
+ }
239
+ } else if (node.nodeType !== Node.COMMENT_NODE) {
240
+ return;
241
+ }
242
+ /*
243
+ * `node` shows nothing. It goes -- a comment is only stepped over -- and
244
+ * so does each inline element that leaves with nothing in it, on the
245
+ * way back out to the next node along.
246
+ */
247
+ let next: Node | null = forward ? node.nextSibling : node.previousSibling;
248
+ let parent: Node | null = node.parentNode;
249
+ if (node.nodeType !== Node.COMMENT_NODE) {
250
+ parent?.removeChild(node);
251
+ }
252
+ while (!next && parent && parent !== container) {
253
+ next = forward ? parent.nextSibling : parent.previousSibling;
254
+ const grandparent: Node | null = parent.parentNode;
255
+ if (parent.childNodes.length === 0) {
256
+ grandparent?.removeChild(parent);
257
+ }
258
+ parent = grandparent;
259
+ }
260
+ node = next;
261
+ }
262
+ };
263
+
264
+ /*
265
+ * Splits the line the caret is in -- a paragraph, a heading, the <div> a
266
+ * browser writes for a new line -- at the caret, and returns the spot
267
+ * between its two halves. Either half that is left with nothing in it is
268
+ * removed, so a block inserted at the start or end of a line does not leave
269
+ * an empty line behind.
270
+ */
271
+ const splitLineAtCaret: (line: HTMLElement, range: Range) => InsertionPoint = (
272
+ line: HTMLElement,
273
+ range: Range,
274
+ ): InsertionPoint => {
275
+ const parent: Node = line.parentNode as Node;
276
+ const tail: Range = line.ownerDocument.createRange();
277
+ tail.setStart(range.startContainer, range.startOffset);
278
+ tail.setEnd(line, line.childNodes.length);
279
+ const rest: DocumentFragment = tail.extractContents();
280
+ let before: Node | null = line.nextSibling;
281
+ if (!holdsNothing(rest)) {
282
+ /*
283
+ * Into the editor first, then filled: filled while still out of it, the
284
+ * half took nodes the undo record never saw go in, and a redo after
285
+ * Ctrl+Z was refused.
286
+ */
287
+ const half: Node = line.cloneNode(false);
288
+ parent.insertBefore(half, before);
289
+ half.appendChild(rest);
290
+ tidySplitEdge(half.firstChild, half, true);
291
+ before = half;
292
+ }
293
+ tidySplitEdge(line.lastChild, line, false);
294
+ if (holdsNothing(line)) {
295
+ line.remove();
296
+ }
297
+ return { parent, before };
298
+ };
299
+
300
+ /*
301
+ * The same for text that sits straight inside a list item, a quote, a table
302
+ * cell or the editor itself, with no paragraph around it: the run of inline
303
+ * content the caret is in is split at the caret, and the blocks go between
304
+ * the two parts -- still inside that item, quote or cell.
305
+ */
306
+ const splitInlineRunAtCaret: (holder: Node, range: Range) => InsertionPoint = (
307
+ holder: Node,
308
+ range: Range,
309
+ ): InsertionPoint => {
310
+ if (range.startContainer === holder) {
311
+ return {
312
+ parent: holder,
313
+ before: holder.childNodes[range.startOffset] || null,
314
+ };
315
+ }
316
+ let top: Node = range.startContainer;
317
+ while (top.parentNode && top.parentNode !== holder) {
318
+ top = top.parentNode;
319
+ }
320
+ let runEnd: Node = top;
321
+ while (runEnd.nextSibling && !isBlock(runEnd.nextSibling)) {
322
+ runEnd = runEnd.nextSibling;
323
+ }
324
+ const tail: Range = (holder.ownerDocument as Document).createRange();
325
+ tail.setStart(range.startContainer, range.startOffset);
326
+ tail.setEndAfter(runEnd);
327
+ const rest: DocumentFragment = tail.extractContents();
328
+ let before: Node | null = top.nextSibling;
329
+ if (!holdsNothing(rest)) {
330
+ const secondPart: Array<Node> = Array.from(rest.childNodes);
331
+ holder.insertBefore(rest, before);
332
+ tidySplitEdge(secondPart[0] || null, holder, true);
333
+ before =
334
+ secondPart.find((node: Node): boolean => {
335
+ return node.parentNode === holder;
336
+ }) || before;
337
+ }
338
+ tidySplitEdge(top, holder, false);
339
+ if (top.parentNode === holder && holdsNothing(top) && !isBlock(top)) {
340
+ holder.removeChild(top);
341
+ }
342
+ return { parent: holder, before };
343
+ };
344
+
345
+ /*
346
+ * Where blocks inserted at the caret go: after the code block the caret is
347
+ * in (a code block holds only its text), between the two halves of the line
348
+ * it is in, or between the two parts of the text it is in.
349
+ */
350
+ const blockInsertionPoint: (
351
+ editable: HTMLElement,
352
+ range: Range,
353
+ ) => InsertionPoint = (editable: HTMLElement, range: Range): InsertionPoint => {
354
+ let current: Node | null = range.startContainer;
355
+ while (current && current !== editable) {
356
+ const tag: string = tagOf(current);
357
+ if (tag === "pre" && current.parentNode) {
358
+ return { parent: current.parentNode, before: current.nextSibling };
359
+ }
360
+ if (SPLITTABLE_LINE_TAGS.has(tag) && current.parentNode) {
361
+ return splitLineAtCaret(current as HTMLElement, range);
362
+ }
363
+ if (BLOCK_HOLDER_TAGS.has(tag)) {
364
+ return splitInlineRunAtCaret(current, range);
365
+ }
366
+ current = current.parentNode;
367
+ }
368
+ return splitInlineRunAtCaret(editable, range);
369
+ };
370
+
371
+ /*
372
+ * A caret at the end of what `node` holds -- after its last character, and
373
+ * before the <br> a browser keeps in an empty line -- so that typing carries
374
+ * on from what was inserted, as it does after a paste the browser makes.
375
+ */
376
+ export const caretAtEndOf: (node: Node) => Range = (node: Node): Range => {
377
+ const caret: Range = (node.ownerDocument as Document).createRange();
378
+ let target: Node = node;
379
+ while (target.lastChild && target.lastChild.nodeType !== Node.COMMENT_NODE) {
380
+ const last: ChildNode = target.lastChild;
381
+ if (last.nodeType === Node.TEXT_NODE) {
382
+ caret.setStart(last, (last as Text).length);
383
+ caret.collapse(true);
384
+ return caret;
385
+ }
386
+ const tag: string = tagOf(last);
387
+ if (tag === "br" || tag === "img" || tag === "input" || tag === "hr") {
388
+ caret.setStart(
389
+ target,
390
+ tag === "br" ? target.childNodes.length - 1 : target.childNodes.length,
391
+ );
392
+ caret.collapse(true);
393
+ return caret;
394
+ }
395
+ target = last;
396
+ }
397
+ caret.setStart(target, target.childNodes.length);
398
+ caret.collapse(true);
399
+ return caret;
400
+ };
401
+
402
+ /*
403
+ * The items of `fragment` when it is lists and nothing else that shows --
404
+ * a pasted list, bullets pasted as text, the Task List button's task --
405
+ * and null for anything else.
406
+ */
407
+ const listItemsOf: (fragment: DocumentFragment) => Array<Element> | null = (
408
+ fragment: DocumentFragment,
409
+ ): Array<Element> | null => {
410
+ const items: Array<Element> = [];
411
+ for (const child of Array.from(fragment.childNodes)) {
412
+ const tag: string = tagOf(child);
413
+ if (tag === "ul" || tag === "ol") {
414
+ for (const item of Array.from((child as Element).children)) {
415
+ if (tagOf(item) !== "li") {
416
+ return null;
417
+ }
418
+ items.push(item);
419
+ }
420
+ } else if (!holdsNothing(child)) {
421
+ return null;
422
+ }
423
+ }
424
+ return items.length > 0 ? items : null;
425
+ };
426
+
427
+ /*
428
+ * The empty first item of the list right after a caret that sits on the
429
+ * editor itself, or null. Once the Bullet or Numbered List button has made a
430
+ * list in the empty editor, Chromium leaves the selection on the editor
431
+ * itself, just before the list -- though it shows the caret in the list's
432
+ * empty first item, and types into it.
433
+ */
434
+ const emptyListItemAfterEditorCaret: (
435
+ editable: HTMLElement,
436
+ range: Range,
437
+ ) => HTMLElement | null = (
438
+ editable: HTMLElement,
439
+ range: Range,
440
+ ): HTMLElement | null => {
441
+ if (range.startContainer !== editable) {
442
+ return null;
443
+ }
444
+ const next: ChildNode | undefined = editable.childNodes[range.startOffset];
445
+ const tag: string = tagOf(next);
446
+ const first: Element | null =
447
+ tag === "ul" || tag === "ol" ? (next as Element).firstElementChild : null;
448
+ return first && tagOf(first) === "li" && holdsNothing(first)
449
+ ? (first as HTMLElement)
450
+ : null;
451
+ };
452
+
453
+ /*
454
+ * Moves a collapsed caret that Chromium left on the editor itself, just
455
+ * before a list the Bullet or Numbered List button has just made, into that
456
+ * list's empty first item -- where the caret shows, and where typing goes.
457
+ * The editor's own inserts then go there too: left on the editor, a paste
458
+ * or the Code Block button went in above the list, with an empty bullet
459
+ * left under it ("restart the api\n\n-"). Returns whether it moved it.
460
+ */
461
+ export const moveCaretIntoEmptyListAhead: (
462
+ editable: HTMLElement,
463
+ range: Range,
464
+ ) => boolean = (editable: HTMLElement, range: Range): boolean => {
465
+ if (!range.collapsed) {
466
+ return false;
467
+ }
468
+ const item: HTMLElement | null = emptyListItemAfterEditorCaret(
469
+ editable,
470
+ range,
471
+ );
472
+ if (!item) {
473
+ return false;
474
+ }
475
+ range.setStart(item, 0);
476
+ range.collapse(true);
477
+ return true;
478
+ };
479
+
480
+ /*
481
+ * The list item whose list the items of a list inserted at the caret join:
482
+ * the item the caret is in -- unless it is in a code block, a quote or a
483
+ * table cell inside that item, which a list inserted there stays in.
484
+ */
485
+ const listItemAtCaret: (
486
+ editable: HTMLElement,
487
+ range: Range,
488
+ ) => HTMLElement | null = (
489
+ editable: HTMLElement,
490
+ range: Range,
491
+ ): HTMLElement | null => {
492
+ if (range.startContainer === editable) {
493
+ return emptyListItemAfterEditorCaret(editable, range);
494
+ }
495
+ let current: Node | null = range.startContainer;
496
+ while (current && current !== editable) {
497
+ const tag: string = tagOf(current);
498
+ if (tag === "li") {
499
+ return current as HTMLElement;
500
+ }
501
+ if (tag === "pre" || tag === "blockquote" || tag === "td" || tag === "th") {
502
+ return null;
503
+ }
504
+ current = current.parentNode;
505
+ }
506
+ return null;
507
+ };
508
+
509
+ /*
510
+ * Puts `items`, the items of a list inserted at the caret, into the list of
511
+ * `item`, the list item the caret is in: after what `item` holds before the
512
+ * caret, and before a new item holding what came after it. Kept in the item
513
+ * instead -- as a code block inserted into one is -- they were a list nested
514
+ * in it: a list pasted into the empty item Enter leaves showed two bullets,
515
+ * "- - a", which is the double bullet of issue #4114, and a task added with
516
+ * the Task List button at the end of a task was a sub-task.
517
+ *
518
+ * A part left with nothing in it goes, so the empty item Enter or a list
519
+ * button makes is replaced by the items. When what followed the caret is
520
+ * the item's nested list, or another block of its own, that goes under the
521
+ * last of the items, so the text keeps its order. Returns the caret: at the
522
+ * end of what the last item holds.
523
+ */
524
+ const insertListItemsAtCaret: (
525
+ item: HTMLElement,
526
+ range: Range,
527
+ items: Array<Element>,
528
+ ) => Range = (
529
+ item: HTMLElement,
530
+ range: Range,
531
+ items: Array<Element>,
532
+ ): Range => {
533
+ const list: Node = item.parentNode as Node;
534
+ const tail: Range = item.ownerDocument.createRange();
535
+ /*
536
+ * The paragraph of a loose item the caret is in: the part of it after the
537
+ * caret is the item's own text, as inline text straight in the item is.
538
+ */
539
+ let caretLine: Node | null = null;
540
+ if (item.contains(range.startContainer)) {
541
+ tail.setStart(range.startContainer, range.startOffset);
542
+ let top: Node = range.startContainer;
543
+ while (top.parentNode && top.parentNode !== item) {
544
+ top = top.parentNode;
545
+ }
546
+ caretLine = SPLITTABLE_LINE_TAGS.has(tagOf(top)) ? top : null;
547
+ } else {
548
+ tail.setStart(item, 0);
549
+ }
550
+ tail.setEnd(item, item.childNodes.length);
551
+ const rest: DocumentFragment = tail.extractContents();
552
+ const before: Node | null = item.nextSibling;
553
+ for (const pasted of items) {
554
+ list.insertBefore(pasted, before);
555
+ }
556
+ const last: Element = items[items.length - 1] as Element;
557
+ const caret: Range = caretAtEndOf(last);
558
+ if (!holdsNothing(rest)) {
559
+ const lead: ChildNode | undefined = Array.from(rest.childNodes).find(
560
+ (node: ChildNode): boolean => {
561
+ return !holdsNothing(node);
562
+ },
563
+ );
564
+ const ownText: boolean =
565
+ lead !== undefined &&
566
+ (!isBlock(lead) ||
567
+ (caretLine !== null &&
568
+ lead === rest.firstChild &&
569
+ tagOf(lead) === tagOf(caretLine)));
570
+ if (ownText) {
571
+ /*
572
+ * As when a line is split, into the editor first and then filled and
573
+ * tidied (MarkdownEditorHistory): the space at the split, and the
574
+ * empty copies of formatting the caret was at the edge of, go.
575
+ */
576
+ const half: Node = item.cloneNode(false);
577
+ list.insertBefore(half, before);
578
+ half.appendChild(rest);
579
+ tidySplitEdge(half.firstChild, half, true);
580
+ } else {
581
+ /*
582
+ * What went before the block holds nothing -- the emptied end of the
583
+ * text the caret was at the end of -- and is left out. Nothing of it
584
+ * has been in the editor since the split took it out, so leaving it
585
+ * out needs no record.
586
+ */
587
+ while (rest.firstChild && rest.firstChild !== lead) {
588
+ rest.removeChild(rest.firstChild);
589
+ }
590
+ last.appendChild(rest);
591
+ }
592
+ }
593
+ if (caretLine && caretLine.parentNode === item) {
594
+ tidySplitEdge(caretLine.lastChild, caretLine, false);
595
+ if (holdsNothing(caretLine)) {
596
+ item.removeChild(caretLine);
597
+ }
598
+ } else {
599
+ tidySplitEdge(item.lastChild, item, false);
600
+ }
601
+ if (holdsNothing(item)) {
602
+ item.remove();
603
+ }
604
+ return caret;
605
+ };
606
+
607
+ /*
608
+ * Inserts `fragment` -- one or more blocks -- at the caret, splitting the
609
+ * line the caret is in rather than putting blocks inside it; the items of a
610
+ * list inserted in a list item join that item's list. Returns where the
611
+ * caret goes then -- at the end of what was inserted, so typing carries on
612
+ * from it, as it does after a paste the browser makes -- or null when there
613
+ * was nothing to insert.
614
+ */
615
+ export const insertBlocksAtCaret: (
616
+ editable: HTMLElement,
617
+ range: Range,
618
+ fragment: DocumentFragment,
619
+ ) => Range | null = (
620
+ editable: HTMLElement,
621
+ range: Range,
622
+ fragment: DocumentFragment,
623
+ ): Range | null => {
624
+ const last: Node | null = fragment.lastChild;
625
+ if (!last) {
626
+ return null;
627
+ }
628
+ const items: Array<Element> | null = listItemsOf(fragment);
629
+ const item: HTMLElement | null = items
630
+ ? listItemAtCaret(editable, range)
631
+ : null;
632
+ if (items && item) {
633
+ return insertListItemsAtCaret(item, range, items);
634
+ }
635
+ const point: InsertionPoint = blockInsertionPoint(editable, range);
636
+ point.parent.insertBefore(fragment, point.before);
637
+ return caretAtEndOf(last);
638
+ };
639
+
640
+ /*
641
+ * ---------------------------------------------------------------------------
642
+ * Deleting a selection before an insert
643
+ * ---------------------------------------------------------------------------
644
+ */
645
+
646
+ // Elements that hold a line of text: where what is typed or pasted can go.
647
+ const LINE_TAGS: Set<string> = new Set<string>([
648
+ ...Array.from(SPLITTABLE_LINE_TAGS),
649
+ ...Array.from(BLOCK_HOLDER_TAGS),
650
+ "pre",
651
+ "dt",
652
+ "dd",
653
+ ]);
654
+
655
+ // Elements whose children are only rows, cells or items -- never text.
656
+ const STRUCTURE_ONLY_TAGS: Set<string> = new Set<string>([
657
+ "ul",
658
+ "ol",
659
+ "table",
660
+ "thead",
661
+ "tbody",
662
+ "tfoot",
663
+ "tr",
664
+ ]);
665
+
666
+ const nodeLength: (node: Node) => number = (node: Node): number => {
667
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.COMMENT_NODE) {
668
+ return (node as CharacterData).length;
669
+ }
670
+ return node.childNodes.length;
671
+ };
672
+
673
+ /*
674
+ * The line `node` is in: its nearest paragraph, heading, <div> line, list
675
+ * item, table cell, code block or quote -- or the editor itself.
676
+ */
677
+ const lineOf: (editable: HTMLElement, node: Node) => Node = (
678
+ editable: HTMLElement,
679
+ node: Node,
680
+ ): Node => {
681
+ let current: Node | null = node;
682
+ while (current && current !== editable) {
683
+ if (LINE_TAGS.has(tagOf(current))) {
684
+ return current;
685
+ }
686
+ current = current.parentNode;
687
+ }
688
+ return editable;
689
+ };
690
+
691
+ // The table cell `node` is in, if it is in one inside the editor.
692
+ const cellOf: (editable: HTMLElement, node: Node) => Element | null = (
693
+ editable: HTMLElement,
694
+ node: Node,
695
+ ): Element | null => {
696
+ let current: Node | null = node;
697
+ while (current && current !== editable) {
698
+ const tag: string = tagOf(current);
699
+ if (tag === "td" || tag === "th") {
700
+ return current as Element;
701
+ }
702
+ current = current.parentNode;
703
+ }
704
+ return null;
705
+ };
706
+
707
+ /*
708
+ * Whether the range takes any of `line` -- not merely reaches its start, as
709
+ * a triple click or Shift+Down that stops at the next line does.
710
+ */
711
+ const selectsIntoLine: (range: Range, line: Node) => boolean = (
712
+ range: Range,
713
+ line: Node,
714
+ ): boolean => {
715
+ const head: Range = (line.ownerDocument as Document).createRange();
716
+ head.setStart(line, 0);
717
+ head.setEnd(range.endContainer, range.endOffset);
718
+ return !holdsNothing(head.cloneContents());
719
+ };
720
+
721
+ // A table's rows and cells, which only ever go with the whole table.
722
+ const TABLE_PART_TAGS: Set<string> = new Set<string>([
723
+ "thead",
724
+ "tbody",
725
+ "tfoot",
726
+ "tr",
727
+ "td",
728
+ "th",
729
+ ]);
730
+
731
+ /*
732
+ * Whether `node` is left with nothing in it: no text but whitespace, and no
733
+ * image, rule, list, code block or other content inside it -- whatever it is
734
+ * itself. holdsNothing counts a code block or a quote as content even when
735
+ * it is empty, which is right for what a line holds, and wrong for a code
736
+ * block or quote a selection has emptied.
737
+ */
738
+ const isLeftEmpty: (node: Node) => boolean = (node: Node): boolean => {
739
+ if (RE_SHOWN_TEXT.test(node.textContent || "")) {
740
+ return false;
741
+ }
742
+ return (
743
+ node.nodeType !== Node.ELEMENT_NODE ||
744
+ (node as Element).querySelector(CONTENT_ELEMENT_SELECTOR) === null
745
+ );
746
+ };
747
+
748
+ /*
749
+ * Removes `line` when a selection has left it with nothing in it, and each
750
+ * element around it that its removal leaves with nothing: the list it was the
751
+ * only item of, the quote it was the only paragraph of -- and the item that
752
+ * list was nested in, whose own text the selection took, which stayed as an
753
+ * empty bullet ("- ") when "al|pha".."de|ep" was pasted over in
754
+ * "alpha, beta > deep, gamma". Nothing that holds the caret goes: after
755
+ * Ctrl+A, the line the selection started in is empty too, and the paste
756
+ * goes into it. A list goes only once it has no items left -- an empty item
757
+ * of its own is still a bullet someone left there -- and a table's cells and
758
+ * rows go only with the whole table.
759
+ */
760
+ const removeEmptiedLine: (
761
+ line: Node,
762
+ editable: HTMLElement,
763
+ caret: Node,
764
+ ) => void = (line: Node, editable: HTMLElement, caret: Node): void => {
765
+ let node: Node | null = line;
766
+ while (
767
+ node &&
768
+ node !== editable &&
769
+ node.parentNode &&
770
+ !node.contains(caret)
771
+ ) {
772
+ const tag: string = tagOf(node);
773
+ if (TABLE_PART_TAGS.has(tag)) {
774
+ const table: Element | null = (node as Element).closest("table");
775
+ if (!isLeftEmpty(node) || !table || table === node) {
776
+ return;
777
+ }
778
+ node = table;
779
+ continue;
780
+ }
781
+ const emptied: boolean =
782
+ tag === "ul" || tag === "ol"
783
+ ? (node as Element).children.length === 0
784
+ : isLeftEmpty(node);
785
+ if (!emptied) {
786
+ return;
787
+ }
788
+ const parent: Node = node.parentNode;
789
+ parent.removeChild(node);
790
+ node = parent;
791
+ }
792
+ };
793
+
794
+ /*
795
+ * Takes the first line of a code block's text out of it -- up to its first
796
+ * line break, which goes too -- and returns it as text.
797
+ */
798
+ const takeFirstCodeLine: (pre: Element) => string = (pre: Element): string => {
799
+ const doc: Document = pre.ownerDocument;
800
+ const first: Range = doc.createRange();
801
+ first.selectNodeContents(pre);
802
+ const lineBreak: Range = doc.createRange();
803
+ let found: boolean = false;
804
+ const walker: TreeWalker = doc.createTreeWalker(
805
+ pre,
806
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
807
+ );
808
+ let node: Node | null = walker.nextNode();
809
+ while (node && !found) {
810
+ if (node.nodeType === Node.TEXT_NODE) {
811
+ const at: number = (node as Text).data.indexOf("\n");
812
+ if (at !== -1) {
813
+ first.setEnd(node, at);
814
+ lineBreak.setStart(node, at);
815
+ lineBreak.setEnd(node, at + 1);
816
+ found = true;
817
+ }
818
+ } else if (tagOf(node) === "br") {
819
+ first.setEndBefore(node);
820
+ lineBreak.selectNode(node);
821
+ found = true;
822
+ }
823
+ node = walker.nextNode();
824
+ }
825
+ const text: string = first.toString();
826
+ // The line break first: it comes after the line, whose range it would move.
827
+ if (found) {
828
+ lineBreak.deleteContents();
829
+ }
830
+ first.deleteContents();
831
+ return text;
832
+ };
833
+
834
+ /*
835
+ * The formatting a selection ended inside, when the delete left it with
836
+ * nothing in it -- "Run **this** then" with "un **this" selected keeps an
837
+ * empty <strong> -- removed, up to the line. Nothing shows it, but the
838
+ * serializer wrote it: "Rsee **that****** then". What holds the caret stays:
839
+ * typing there carries on in that formatting.
840
+ */
841
+ const removeEmptiedFormatting: (end: Node, caret: Node) => void = (
842
+ end: Node,
843
+ caret: Node,
844
+ ): void => {
845
+ let node: Node | null = end;
846
+ while (
847
+ node &&
848
+ node.parentNode &&
849
+ node.isConnected &&
850
+ (node.nodeType === Node.TEXT_NODE ||
851
+ (node.nodeType === Node.ELEMENT_NODE &&
852
+ !isBlock(node) &&
853
+ !LINE_TAGS.has(tagOf(node)) &&
854
+ !SHOWN_EMPTY_TAGS.has(tagOf(node)))) &&
855
+ !node.contains(caret) &&
856
+ isLeftEmpty(node)
857
+ ) {
858
+ const parent: Node = node.parentNode;
859
+ parent.removeChild(node);
860
+ node = parent;
861
+ }
862
+ };
863
+
864
+ /*
865
+ * What a list item joined to another held below its own text -- its nested
866
+ * items, a code block -- goes to the item it joins, in the same place in the
867
+ * text. For an item nested in that one, the place is right after the join,
868
+ * ahead of what is left of the nested list the item was in, all of which
869
+ * came after it; its own nested items take its place in that list. Added at
870
+ * the end of the item instead, "deep" under "beta" came out after "gamma"
871
+ * when "al|pha".."be|ta" was pasted over in "alpha > beta > deep, gamma".
872
+ */
873
+ const moveBelowJoin: (startLine: Node, endLine: Node) => void = (
874
+ startLine: Node,
875
+ endLine: Node,
876
+ ): void => {
877
+ let place: Node | null = null;
878
+ if (startLine.contains(endLine)) {
879
+ place = endLine;
880
+ while (place.parentNode && place.parentNode !== startLine) {
881
+ place = place.parentNode;
882
+ }
883
+ }
884
+ while (endLine.firstChild) {
885
+ const child: ChildNode = endLine.firstChild;
886
+ if (
887
+ place &&
888
+ endLine.parentNode === place &&
889
+ tagOf(child) === tagOf(place)
890
+ ) {
891
+ while (child.firstChild) {
892
+ place.insertBefore(child.firstChild, endLine);
893
+ }
894
+ endLine.removeChild(child);
895
+ } else {
896
+ startLine.insertBefore(child, place);
897
+ }
898
+ }
899
+ };
900
+
901
+ /*
902
+ * What is left of the line a selection ended in joins the line it started
903
+ * in, at the caret -- as when the selection is typed over. Only its own text
904
+ * moves: a list nested in a list item goes along to the item it joins, and
905
+ * the line, left empty, goes.
906
+ *
907
+ * Of a code block, only what is left of the line the selection ended in
908
+ * joins, as text, and its other lines stay a code block -- what typing over
909
+ * the selection does in Chromium and Safari. Moved whole, the <code> was
910
+ * inline code in the line joined ("in` line`", and every line after it in
911
+ * one span), and the emptied code block stayed as an empty fence.
912
+ */
913
+ const joinLineAtCaret: (
914
+ range: Range,
915
+ startLine: Node,
916
+ endLine: Node,
917
+ editable: HTMLElement,
918
+ ) => void = (
919
+ range: Range,
920
+ startLine: Node,
921
+ endLine: Node,
922
+ editable: HTMLElement,
923
+ ): void => {
924
+ const doc: Document = endLine.ownerDocument as Document;
925
+ const text: DocumentFragment = doc.createDocumentFragment();
926
+ if (tagOf(endLine) === "pre") {
927
+ const line: string = takeFirstCodeLine(endLine as Element);
928
+ if (line) {
929
+ text.appendChild(doc.createTextNode(line));
930
+ }
931
+ } else {
932
+ while (endLine.firstChild && !isBlock(endLine.firstChild)) {
933
+ text.appendChild(endLine.firstChild);
934
+ }
935
+ }
936
+ if (!holdsNothing(text)) {
937
+ range.insertNode(text);
938
+ range.collapse(true);
939
+ }
940
+ if (tagOf(startLine) === "li" && tagOf(endLine) === "li") {
941
+ moveBelowJoin(startLine, endLine);
942
+ }
943
+ removeEmptiedLine(endLine, editable, range.startContainer);
944
+ };
945
+
946
+ /*
947
+ * A caret straight inside a list or a table, between its items or rows,
948
+ * moved into the item or cell next to it -- the serializer reads only a
949
+ * list's items and a table's cells, so nothing inserted between them would
950
+ * be saved.
951
+ */
952
+ const moveCaretIntoLine: (range: Range) => void = (range: Range): void => {
953
+ let container: Node = range.startContainer;
954
+ let offset: number = range.startOffset;
955
+ while (STRUCTURE_ONLY_TAGS.has(tagOf(container))) {
956
+ const after: ChildNode | undefined = container.childNodes[offset];
957
+ const before: ChildNode | undefined = container.childNodes[offset - 1];
958
+ if (after && after.nodeType === Node.ELEMENT_NODE) {
959
+ container = after;
960
+ offset = 0;
961
+ } else if (before && before.nodeType === Node.ELEMENT_NODE) {
962
+ container = before;
963
+ offset = nodeLength(before);
964
+ } else {
965
+ return;
966
+ }
967
+ }
968
+ range.setStart(container, offset);
969
+ range.collapse(true);
970
+ };
971
+
972
+ /*
973
+ * Deletes what the range selects, the way typing over it does: when the
974
+ * selection runs from one line into another -- two list items, two
975
+ * paragraphs -- what is left of the second line joins the first, and the
976
+ * caret ends up at the join, inside a line. Range.deleteContents on its own
977
+ * leaves both lines and puts the caret between them -- straight inside the
978
+ * <ul> when they were list items, where the serializer, which reads only a
979
+ * list's items, never saw what was pasted next: a link pasted over part of
980
+ * two items showed in the editor and was lost from the saved note. A
981
+ * selection that stops at the very start of a line -- a triple click,
982
+ * Shift+Down -- takes none of that line, and it stays as it is.
983
+ */
984
+ export const deleteSelectionForInsert: (
985
+ editable: HTMLElement,
986
+ range: Range,
987
+ ) => void = (editable: HTMLElement, range: Range): void => {
988
+ if (range.collapsed) {
989
+ return;
990
+ }
991
+ const startNode: Node = range.startContainer;
992
+ const startOffset: number = range.startOffset;
993
+ const endNode: Node = range.endContainer;
994
+ const startLine: Node = lineOf(editable, startNode);
995
+ const endLine: Node = lineOf(editable, endNode);
996
+ /*
997
+ * A table cell the selection ends in is never joined to where it started:
998
+ * typed over, a selection from one cell into the next keeps both, and the
999
+ * row keeps its columns. Joined, the cell's text moved into the first one,
1000
+ * the emptied cell went, and every cell after it moved a column left --
1001
+ * under the wrong header.
1002
+ */
1003
+ const endCell: Element | null = cellOf(editable, range.endContainer);
1004
+ const endsInAnotherCell: boolean =
1005
+ endCell !== null && !endCell.contains(startNode);
1006
+ const joins: boolean =
1007
+ startLine !== endLine &&
1008
+ startLine !== editable &&
1009
+ endLine !== editable &&
1010
+ !endsInAnotherCell &&
1011
+ !endLine.contains(startLine) &&
1012
+ selectsIntoLine(range, endLine);
1013
+ range.deleteContents();
1014
+ /*
1015
+ * The start of a selection is never removed by the delete (only cut short),
1016
+ * so the caret goes back there: inside the line the selection started in.
1017
+ */
1018
+ range.setStart(startNode, Math.min(startOffset, nodeLength(startNode)));
1019
+ range.collapse(true);
1020
+ removeEmptiedFormatting(endNode, range.startContainer);
1021
+ if (joins && endLine.isConnected && startLine.isConnected) {
1022
+ joinLineAtCaret(range, startLine, endLine, editable);
1023
+ } else if (endsInAnotherCell && endCell) {
1024
+ /*
1025
+ * Ctrl+A over a note that ends in a table, which Chromium and Safari end
1026
+ * inside the last cell's text: the table the selection emptied goes,
1027
+ * rather than being saved as an empty one.
1028
+ */
1029
+ removeEmptiedLine(endCell, editable, range.startContainer);
1030
+ }
1031
+ moveCaretIntoLine(range);
1032
+ };