@oneuptime/common 9.2.27 → 9.3.0

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 (263) hide show
  1. package/Models/DatabaseModels/AIAgent.ts +589 -0
  2. package/Models/DatabaseModels/AIAgentOwnerTeam.ts +434 -0
  3. package/Models/DatabaseModels/AIAgentOwnerUser.ts +433 -0
  4. package/Models/DatabaseModels/AIAgentTask.ts +549 -0
  5. package/Models/DatabaseModels/AIAgentTaskLog.ts +417 -0
  6. package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +731 -0
  7. package/Models/DatabaseModels/AIAgentTaskTelemetryException.ts +388 -0
  8. package/Models/DatabaseModels/Index.ts +15 -0
  9. package/Models/DatabaseModels/Monitor.ts +33 -0
  10. package/Models/DatabaseModels/Project.ts +25 -0
  11. package/Models/DatabaseModels/TelemetryException.ts +1 -1
  12. package/Server/API/AIAgentAPI.ts +200 -0
  13. package/Server/API/AIAgentDataAPI.ts +692 -0
  14. package/Server/API/AIAgentTaskAPI.ts +286 -0
  15. package/Server/API/AIAgentTaskLogAPI.ts +165 -0
  16. package/Server/API/AIAgentTaskPullRequestAPI.ts +14 -0
  17. package/Server/API/GitHubAPI.ts +25 -7
  18. package/Server/API/TelemetryExceptionAPI.ts +169 -0
  19. package/Server/EnvironmentConfig.ts +3 -0
  20. package/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.ts +195 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.ts +31 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.ts +17 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.ts +63 -0
  24. package/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.ts +75 -0
  25. package/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.ts +157 -0
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.ts +33 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.ts +27 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.ts +37 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.ts +31 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.ts +35 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +22 -0
  32. package/Server/Services/AIAgentOwnerTeamService.ts +10 -0
  33. package/Server/Services/AIAgentOwnerUserService.ts +10 -0
  34. package/Server/Services/AIAgentService.ts +564 -0
  35. package/Server/Services/AIAgentTaskLogService.ts +10 -0
  36. package/Server/Services/AIAgentTaskPullRequestService.ts +10 -0
  37. package/Server/Services/AIAgentTaskService.ts +178 -0
  38. package/Server/Services/AIAgentTaskTelemetryExceptionService.ts +39 -0
  39. package/Server/Services/Index.ts +10 -0
  40. package/Server/Services/TelemetryExceptionService.ts +162 -0
  41. package/Server/Utils/Monitor/MonitorResource.ts +228 -0
  42. package/Server/Utils/PushNotificationUtil.ts +29 -0
  43. package/Server/Utils/WhatsAppTemplateUtil.ts +6 -0
  44. package/Tests/UI/Components/Badge.test.tsx +5 -5
  45. package/Tests/UI/Components/Card.test.tsx +4 -8
  46. package/Tests/UI/Components/HiddenText.test.tsx +2 -5
  47. package/Tests/UI/Components/SideMenuItem.test.tsx +4 -2
  48. package/Types/AI/AIAgentTaskMetadata.ts +25 -0
  49. package/Types/AI/AIAgentTaskStatus.ts +65 -0
  50. package/Types/AI/AIAgentTaskType.ts +40 -0
  51. package/Types/Email/EmailTemplateType.ts +2 -0
  52. package/Types/Monitor/MonitorEvaluationSummary.ts +2 -1
  53. package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
  54. package/Types/Permission.ts +176 -0
  55. package/Types/WhatsApp/WhatsAppTemplates.ts +9 -0
  56. package/UI/Components/AIAgent/AIAgent.tsx +69 -0
  57. package/UI/Components/Badge/Badge.tsx +9 -5
  58. package/UI/Components/Banner/Banner.tsx +1 -1
  59. package/UI/Components/Card/Card.tsx +14 -12
  60. package/UI/Components/CodeBlock/CodeBlock.tsx +47 -4
  61. package/UI/Components/Detail/Detail.tsx +239 -49
  62. package/UI/Components/Detail/FieldLabel.tsx +35 -11
  63. package/UI/Components/Detail/PlaceholderText.tsx +18 -1
  64. package/UI/Components/Footer/Footer.tsx +9 -7
  65. package/UI/Components/Header/Header.tsx +4 -3
  66. package/UI/Components/Header/HeaderIconDropdownButton.tsx +13 -11
  67. package/UI/Components/Header/IconDropdown/IconDropdownItem.tsx +3 -3
  68. package/UI/Components/Header/IconDropdown/IconDropdownMenu.tsx +1 -1
  69. package/UI/Components/Header/ProjectPicker/CreateNewProjectButton.tsx +4 -4
  70. package/UI/Components/Header/ProjectPicker/ProjectPicker.tsx +6 -6
  71. package/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.tsx +3 -3
  72. package/UI/Components/Header/ProjectPicker/ProjectPickerMenu.tsx +1 -1
  73. package/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.tsx +4 -4
  74. package/UI/Components/HeaderAlert/HeaderAlert.tsx +32 -32
  75. package/UI/Components/HeaderAlert/HeaderAlertGroup.tsx +1 -7
  76. package/UI/Components/HiddenText/HiddenText.tsx +98 -27
  77. package/UI/Components/Icon/Icon.tsx +12 -9
  78. package/UI/Components/InfoCard/InfoCard.tsx +7 -3
  79. package/UI/Components/ModelTable/BaseModelTable.tsx +1 -1
  80. package/UI/Components/ObjectID/ObjectIDView.tsx +73 -0
  81. package/UI/Components/Page/Page.tsx +3 -5
  82. package/UI/Components/SideMenu/SideMenu.tsx +175 -40
  83. package/UI/Components/SideMenu/SideMenuDivider.tsx +17 -0
  84. package/UI/Components/SideMenu/SideMenuItem.tsx +111 -158
  85. package/UI/Components/SideMenu/SideMenuSection.tsx +53 -3
  86. package/UI/Components/Table/Table.tsx +1 -1
  87. package/UI/Components/Types/FieldType.ts +2 -0
  88. package/UI/Config.ts +5 -0
  89. package/build/dist/Models/DatabaseModels/AIAgent.js +614 -0
  90. package/build/dist/Models/DatabaseModels/AIAgent.js.map +1 -0
  91. package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js +452 -0
  92. package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js.map +1 -0
  93. package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js +451 -0
  94. package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js.map +1 -0
  95. package/build/dist/Models/DatabaseModels/AIAgentTask.js +580 -0
  96. package/build/dist/Models/DatabaseModels/AIAgentTask.js.map +1 -0
  97. package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js +438 -0
  98. package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js.map +1 -0
  99. package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +771 -0
  100. package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -0
  101. package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js +404 -0
  102. package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js.map +1 -0
  103. package/build/dist/Models/DatabaseModels/Index.js +14 -0
  104. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  105. package/build/dist/Models/DatabaseModels/Monitor.js +34 -0
  106. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  107. package/build/dist/Models/DatabaseModels/Project.js +26 -0
  108. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  109. package/build/dist/Models/DatabaseModels/TelemetryException.js +1 -1
  110. package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
  111. package/build/dist/Server/API/AIAgentAPI.js +141 -0
  112. package/build/dist/Server/API/AIAgentAPI.js.map +1 -0
  113. package/build/dist/Server/API/AIAgentDataAPI.js +415 -0
  114. package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -0
  115. package/build/dist/Server/API/AIAgentTaskAPI.js +199 -0
  116. package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -0
  117. package/build/dist/Server/API/AIAgentTaskLogAPI.js +106 -0
  118. package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -0
  119. package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js +9 -0
  120. package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js.map +1 -0
  121. package/build/dist/Server/API/GitHubAPI.js +23 -8
  122. package/build/dist/Server/API/GitHubAPI.js.map +1 -1
  123. package/build/dist/Server/API/TelemetryExceptionAPI.js +120 -0
  124. package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -0
  125. package/build/dist/Server/EnvironmentConfig.js +2 -0
  126. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  127. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js +74 -0
  128. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js.map +1 -0
  129. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js +18 -0
  130. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js.map +1 -0
  131. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js +12 -0
  132. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js.map +1 -0
  133. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js +28 -0
  134. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js.map +1 -0
  135. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js +32 -0
  136. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js.map +1 -0
  137. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js +60 -0
  138. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js.map +1 -0
  139. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js +18 -0
  140. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js.map +1 -0
  141. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js +16 -0
  142. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js.map +1 -0
  143. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js +20 -0
  144. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js.map +1 -0
  145. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js +16 -0
  146. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js.map +1 -0
  147. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js +18 -0
  148. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js.map +1 -0
  149. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +22 -0
  150. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  151. package/build/dist/Server/Services/AIAgentOwnerTeamService.js +9 -0
  152. package/build/dist/Server/Services/AIAgentOwnerTeamService.js.map +1 -0
  153. package/build/dist/Server/Services/AIAgentOwnerUserService.js +9 -0
  154. package/build/dist/Server/Services/AIAgentOwnerUserService.js.map +1 -0
  155. package/build/dist/Server/Services/AIAgentService.js +471 -0
  156. package/build/dist/Server/Services/AIAgentService.js.map +1 -0
  157. package/build/dist/Server/Services/AIAgentTaskLogService.js +9 -0
  158. package/build/dist/Server/Services/AIAgentTaskLogService.js.map +1 -0
  159. package/build/dist/Server/Services/AIAgentTaskPullRequestService.js +9 -0
  160. package/build/dist/Server/Services/AIAgentTaskPullRequestService.js.map +1 -0
  161. package/build/dist/Server/Services/AIAgentTaskService.js +158 -0
  162. package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -0
  163. package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js +36 -0
  164. package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js.map +1 -0
  165. package/build/dist/Server/Services/Index.js +10 -0
  166. package/build/dist/Server/Services/Index.js.map +1 -1
  167. package/build/dist/Server/Services/TelemetryExceptionService.js +137 -0
  168. package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
  169. package/build/dist/Server/Utils/Monitor/MonitorResource.js +168 -0
  170. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  171. package/build/dist/Server/Utils/PushNotificationUtil.js +21 -0
  172. package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
  173. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +4 -0
  174. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
  175. package/build/dist/Tests/UI/Components/Badge.test.js +5 -5
  176. package/build/dist/Tests/UI/Components/Badge.test.js.map +1 -1
  177. package/build/dist/Tests/UI/Components/Card.test.js +4 -8
  178. package/build/dist/Tests/UI/Components/Card.test.js.map +1 -1
  179. package/build/dist/Tests/UI/Components/HiddenText.test.js +2 -3
  180. package/build/dist/Tests/UI/Components/HiddenText.test.js.map +1 -1
  181. package/build/dist/Tests/UI/Components/SideMenuItem.test.js +3 -2
  182. package/build/dist/Tests/UI/Components/SideMenuItem.test.js.map +1 -1
  183. package/build/dist/Types/AI/AIAgentTaskMetadata.js +6 -0
  184. package/build/dist/Types/AI/AIAgentTaskMetadata.js.map +1 -0
  185. package/build/dist/Types/AI/AIAgentTaskStatus.js +51 -0
  186. package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -0
  187. package/build/dist/Types/AI/AIAgentTaskType.js +29 -0
  188. package/build/dist/Types/AI/AIAgentTaskType.js.map +1 -0
  189. package/build/dist/Types/Email/EmailTemplateType.js +2 -0
  190. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  191. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
  192. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
  193. package/build/dist/Types/Permission.js +160 -0
  194. package/build/dist/Types/Permission.js.map +1 -1
  195. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +6 -0
  196. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
  197. package/build/dist/UI/Components/AIAgent/AIAgent.js +32 -0
  198. package/build/dist/UI/Components/AIAgent/AIAgent.js.map +1 -0
  199. package/build/dist/UI/Components/Badge/Badge.js +9 -5
  200. package/build/dist/UI/Components/Badge/Badge.js.map +1 -1
  201. package/build/dist/UI/Components/Banner/Banner.js +1 -1
  202. package/build/dist/UI/Components/Banner/Banner.js.map +1 -1
  203. package/build/dist/UI/Components/Card/Card.js +12 -12
  204. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  205. package/build/dist/UI/Components/CodeBlock/CodeBlock.js +22 -2
  206. package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
  207. package/build/dist/UI/Components/Detail/Detail.js +117 -37
  208. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  209. package/build/dist/UI/Components/Detail/FieldLabel.js +12 -7
  210. package/build/dist/UI/Components/Detail/FieldLabel.js.map +1 -1
  211. package/build/dist/UI/Components/Detail/PlaceholderText.js +4 -1
  212. package/build/dist/UI/Components/Detail/PlaceholderText.js.map +1 -1
  213. package/build/dist/UI/Components/Footer/Footer.js +6 -6
  214. package/build/dist/UI/Components/Footer/Footer.js.map +1 -1
  215. package/build/dist/UI/Components/Header/Header.js +4 -3
  216. package/build/dist/UI/Components/Header/Header.js.map +1 -1
  217. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +7 -7
  218. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  219. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js +3 -3
  220. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js.map +1 -1
  221. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js +1 -1
  222. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js.map +1 -1
  223. package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js +4 -4
  224. package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js.map +1 -1
  225. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js +6 -6
  226. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js.map +1 -1
  227. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js +2 -2
  228. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js.map +1 -1
  229. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js +1 -1
  230. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js.map +1 -1
  231. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js +4 -4
  232. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js.map +1 -1
  233. package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js +31 -29
  234. package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
  235. package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js +1 -3
  236. package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js.map +1 -1
  237. package/build/dist/UI/Components/HiddenText/HiddenText.js +33 -14
  238. package/build/dist/UI/Components/HiddenText/HiddenText.js.map +1 -1
  239. package/build/dist/UI/Components/Icon/Icon.js +3 -4
  240. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  241. package/build/dist/UI/Components/InfoCard/InfoCard.js +3 -3
  242. package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
  243. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +1 -1
  244. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  245. package/build/dist/UI/Components/ObjectID/ObjectIDView.js +30 -0
  246. package/build/dist/UI/Components/ObjectID/ObjectIDView.js.map +1 -0
  247. package/build/dist/UI/Components/Page/Page.js +3 -3
  248. package/build/dist/UI/Components/Page/Page.js.map +1 -1
  249. package/build/dist/UI/Components/SideMenu/SideMenu.js +82 -17
  250. package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
  251. package/build/dist/UI/Components/SideMenu/SideMenuDivider.js +7 -0
  252. package/build/dist/UI/Components/SideMenu/SideMenuDivider.js.map +1 -0
  253. package/build/dist/UI/Components/SideMenu/SideMenuItem.js +68 -97
  254. package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
  255. package/build/dist/UI/Components/SideMenu/SideMenuSection.js +18 -3
  256. package/build/dist/UI/Components/SideMenu/SideMenuSection.js.map +1 -1
  257. package/build/dist/UI/Components/Table/Table.js +1 -1
  258. package/build/dist/UI/Components/Table/Table.js.map +1 -1
  259. package/build/dist/UI/Components/Types/FieldType.js +2 -0
  260. package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
  261. package/build/dist/UI/Config.js +2 -0
  262. package/build/dist/UI/Config.js.map +1 -1
  263. package/package.json +1 -1
@@ -0,0 +1,169 @@
1
+ import TelemetryException from "../../Models/DatabaseModels/TelemetryException";
2
+ import AIAgentTask from "../../Models/DatabaseModels/AIAgentTask";
3
+ import AIAgentTaskTelemetryException from "../../Models/DatabaseModels/AIAgentTaskTelemetryException";
4
+ import BadDataException from "../../Types/Exception/BadDataException";
5
+ import ObjectID from "../../Types/ObjectID";
6
+ import TelemetryExceptionService, {
7
+ Service as TelemetryExceptionServiceType,
8
+ } from "../Services/TelemetryExceptionService";
9
+ import AIAgentTaskTelemetryExceptionService from "../Services/AIAgentTaskTelemetryExceptionService";
10
+ import UserMiddleware from "../Middleware/UserAuthorization";
11
+ import Response from "../Utils/Response";
12
+ import BaseAPI from "./BaseAPI";
13
+ import {
14
+ ExpressRequest,
15
+ ExpressResponse,
16
+ NextFunction,
17
+ } from "../Utils/Express";
18
+ import CommonAPI from "./CommonAPI";
19
+ import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
20
+ import AIAgentTaskStatus, {
21
+ AIAgentTaskStatusHelper,
22
+ } from "../../Types/AI/AIAgentTaskStatus";
23
+ import QueryHelper from "../Types/Database/QueryHelper";
24
+
25
+ export default class TelemetryExceptionAPI extends BaseAPI<
26
+ TelemetryException,
27
+ TelemetryExceptionServiceType
28
+ > {
29
+ public constructor() {
30
+ super(TelemetryException, TelemetryExceptionService);
31
+
32
+ // Create AI Agent Task for an exception
33
+ this.router.post(
34
+ `${new this.entityType()
35
+ .getCrudApiPath()
36
+ ?.toString()}/create-ai-agent-task/:telemetryExceptionId`,
37
+ UserMiddleware.getUserMiddleware,
38
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
39
+ try {
40
+ await this.createAIAgentTask(req, res);
41
+ } catch (err) {
42
+ next(err);
43
+ }
44
+ },
45
+ );
46
+
47
+ // Get AI Agent Task for an exception
48
+ this.router.get(
49
+ `${new this.entityType()
50
+ .getCrudApiPath()
51
+ ?.toString()}/get-ai-agent-task/:telemetryExceptionId`,
52
+ UserMiddleware.getUserMiddleware,
53
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
54
+ try {
55
+ await this.getAIAgentTaskForException(req, res);
56
+ } catch (err) {
57
+ next(err);
58
+ }
59
+ },
60
+ );
61
+ }
62
+
63
+ private async createAIAgentTask(
64
+ req: ExpressRequest,
65
+ res: ExpressResponse,
66
+ ): Promise<void> {
67
+ const telemetryExceptionIdParam: string | undefined =
68
+ req.params["telemetryExceptionId"];
69
+
70
+ if (!telemetryExceptionIdParam) {
71
+ throw new BadDataException("Telemetry Exception ID is required");
72
+ }
73
+
74
+ let telemetryExceptionId: ObjectID;
75
+
76
+ try {
77
+ telemetryExceptionId = new ObjectID(telemetryExceptionIdParam);
78
+ } catch {
79
+ throw new BadDataException("Invalid Telemetry Exception ID");
80
+ }
81
+
82
+ const props: DatabaseCommonInteractionProps =
83
+ await CommonAPI.getDatabaseCommonInteractionProps(req);
84
+
85
+ // Create the AI Agent Task using the service
86
+ const createdTask: AIAgentTask =
87
+ await this.service.createAIAgentTaskForException({
88
+ telemetryExceptionId,
89
+ props,
90
+ });
91
+
92
+ return Response.sendJsonObjectResponse(req, res, {
93
+ aiAgentTaskId: createdTask.id!.toString(),
94
+ });
95
+ }
96
+
97
+ private async getAIAgentTaskForException(
98
+ req: ExpressRequest,
99
+ res: ExpressResponse,
100
+ ): Promise<void> {
101
+ const telemetryExceptionIdParam: string | undefined =
102
+ req.params["telemetryExceptionId"];
103
+
104
+ if (!telemetryExceptionIdParam) {
105
+ throw new BadDataException("Telemetry Exception ID is required");
106
+ }
107
+
108
+ let telemetryExceptionId: ObjectID;
109
+
110
+ try {
111
+ telemetryExceptionId = new ObjectID(telemetryExceptionIdParam);
112
+ } catch {
113
+ throw new BadDataException("Invalid Telemetry Exception ID");
114
+ }
115
+
116
+ const props: DatabaseCommonInteractionProps =
117
+ await CommonAPI.getDatabaseCommonInteractionProps(req);
118
+
119
+ // Find the most recent AI agent task for this exception that is not completed or errored
120
+ const taskLink: AIAgentTaskTelemetryException | null =
121
+ await AIAgentTaskTelemetryExceptionService.findOneBy({
122
+ query: {
123
+ telemetryExceptionId: telemetryExceptionId,
124
+ aiAgentTask: {
125
+ status: QueryHelper.notIn([
126
+ AIAgentTaskStatus.Completed,
127
+ AIAgentTaskStatus.Error,
128
+ ]),
129
+ },
130
+ },
131
+ select: {
132
+ _id: true,
133
+ aiAgentTaskId: true,
134
+ aiAgentTask: {
135
+ _id: true,
136
+ status: true,
137
+ statusMessage: true,
138
+ createdAt: true,
139
+ },
140
+ },
141
+ props,
142
+ });
143
+
144
+ if (!taskLink || !taskLink.aiAgentTask) {
145
+ return Response.sendJsonObjectResponse(req, res, {
146
+ hasActiveTask: false,
147
+ aiAgentTask: null,
148
+ });
149
+ }
150
+
151
+ const task: AIAgentTask = taskLink.aiAgentTask;
152
+
153
+ return Response.sendJsonObjectResponse(req, res, {
154
+ hasActiveTask: true,
155
+ aiAgentTask: {
156
+ _id: task.id?.toString(),
157
+ status: task.status,
158
+ statusMessage: task.statusMessage,
159
+ statusTitle: task.status
160
+ ? AIAgentTaskStatusHelper.getTitle(task.status)
161
+ : undefined,
162
+ statusDescription: task.status
163
+ ? AIAgentTaskStatusHelper.getDescription(task.status)
164
+ : undefined,
165
+ createdAt: task.createdAt,
166
+ },
167
+ });
168
+ }
169
+ }
@@ -45,6 +45,7 @@ const FRONTEND_ENV_ALLOW_LIST: Array<string> = [
45
45
  "SLACK_APP_CLIENT_ID",
46
46
  "MICROSOFT_TEAMS_APP_CLIENT_ID",
47
47
  "GITHUB_APP_CLIENT_ID",
48
+ "GITHUB_APP_NAME",
48
49
  "CAPTCHA_ENABLED",
49
50
  "CAPTCHA_SITE_KEY",
50
51
  ];
@@ -461,6 +462,8 @@ export const MicrosoftTeamsAppTenantId: string | null =
461
462
 
462
463
  // GitHub App Configuration
463
464
  export const GitHubAppId: string | null = process.env["GITHUB_APP_ID"] || null;
465
+ export const GitHubAppName: string | null =
466
+ process.env["GITHUB_APP_NAME"] || null;
464
467
  export const GitHubAppClientId: string | null =
465
468
  process.env["GITHUB_APP_CLIENT_ID"] || null;
466
469
  export const GitHubAppClientSecret: string | null =
@@ -0,0 +1,195 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1766590916627 implements MigrationInterface {
4
+ public name = "MigrationName1766590916627";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "AIAgent" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "key" character varying NOT NULL, "name" character varying(50) NOT NULL, "description" character varying(50), "slug" character varying(100) NOT NULL, "aiAgentVersion" character varying(30) NOT NULL, "lastAlive" TIMESTAMP WITH TIME ZONE, "iconFileId" uuid, "projectId" uuid, "deletedByUserId" uuid, "createdByUserId" uuid, "isGlobalAIAgent" boolean NOT NULL DEFAULT false, "connectionStatus" character varying, CONSTRAINT "UQ_6f3d82cf89d939fc35fe952b4f6" UNIQUE ("key"), CONSTRAINT "PK_301ae636fef4e6de7c3bf70129c" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE TABLE "AIAgentOwnerTeam" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "teamId" uuid NOT NULL, "aiAgentId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "isOwnerNotified" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_c7d8a8b3aabb95fa3868fcff828" PRIMARY KEY ("_id"))`,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_57891366dea4262e29ca7d9286" ON "AIAgentOwnerTeam" ("projectId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_ee75f6778240d20acd0e0ea5de" ON "AIAgentOwnerTeam" ("teamId") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_0723d49dfb7b29c8f787755673" ON "AIAgentOwnerTeam" ("aiAgentId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_0221605414e639cd2df48fb450" ON "AIAgentOwnerTeam" ("isOwnerNotified") `,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE TABLE "AIAgentOwnerUser" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "userId" uuid NOT NULL, "aiAgentId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "isOwnerNotified" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_df08e4685717bcb169324697cae" PRIMARY KEY ("_id"))`,
27
+ );
28
+ await queryRunner.query(
29
+ `CREATE INDEX "IDX_cac129218093e5984a057f268b" ON "AIAgentOwnerUser" ("projectId") `,
30
+ );
31
+ await queryRunner.query(
32
+ `CREATE INDEX "IDX_7a6dad3d4a801c718886b3a087" ON "AIAgentOwnerUser" ("userId") `,
33
+ );
34
+ await queryRunner.query(
35
+ `CREATE INDEX "IDX_27d84c74c31e7653fc77cab8cc" ON "AIAgentOwnerUser" ("aiAgentId") `,
36
+ );
37
+ await queryRunner.query(
38
+ `CREATE INDEX "IDX_88675054e489932d5df250e0b4" ON "AIAgentOwnerUser" ("isOwnerNotified") `,
39
+ );
40
+ await queryRunner.query(
41
+ `CREATE TABLE "AIAgentLabel" ("aiAgentId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_57429d04a63b8149ed4508543a2" PRIMARY KEY ("aiAgentId", "labelId"))`,
42
+ );
43
+ await queryRunner.query(
44
+ `CREATE INDEX "IDX_6939139a0104e1b331c19f7ea6" ON "AIAgentLabel" ("aiAgentId") `,
45
+ );
46
+ await queryRunner.query(
47
+ `CREATE INDEX "IDX_676606a57c0a1d45b3faf9d49f" ON "AIAgentLabel" ("labelId") `,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "AIAgent" ADD CONSTRAINT "FK_5b650f1a5349ec3baa09948642d" FOREIGN KEY ("iconFileId") REFERENCES "File"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "AIAgent" ADD CONSTRAINT "FK_0cd88831f8f382eabcc13c7f61c" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "AIAgent" ADD CONSTRAINT "FK_d28e33795c84713c421e91f3104" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "AIAgent" ADD CONSTRAINT "FK_083a49a5f23f71c4aa26a754a06" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "AIAgentOwnerTeam" ADD CONSTRAINT "FK_57891366dea4262e29ca7d92861" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
69
+ );
70
+ await queryRunner.query(
71
+ `ALTER TABLE "AIAgentOwnerTeam" ADD CONSTRAINT "FK_ee75f6778240d20acd0e0ea5de1" FOREIGN KEY ("teamId") REFERENCES "Team"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
72
+ );
73
+ await queryRunner.query(
74
+ `ALTER TABLE "AIAgentOwnerTeam" ADD CONSTRAINT "FK_0723d49dfb7b29c8f7877556739" FOREIGN KEY ("aiAgentId") REFERENCES "AIAgent"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
75
+ );
76
+ await queryRunner.query(
77
+ `ALTER TABLE "AIAgentOwnerTeam" ADD CONSTRAINT "FK_e3321a602f9d091a5e8c21dd581" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
78
+ );
79
+ await queryRunner.query(
80
+ `ALTER TABLE "AIAgentOwnerTeam" ADD CONSTRAINT "FK_26fd04196dedd19188625cbd847" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
81
+ );
82
+ await queryRunner.query(
83
+ `ALTER TABLE "AIAgentOwnerUser" ADD CONSTRAINT "FK_cac129218093e5984a057f268b0" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
84
+ );
85
+ await queryRunner.query(
86
+ `ALTER TABLE "AIAgentOwnerUser" ADD CONSTRAINT "FK_7a6dad3d4a801c718886b3a087f" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
87
+ );
88
+ await queryRunner.query(
89
+ `ALTER TABLE "AIAgentOwnerUser" ADD CONSTRAINT "FK_27d84c74c31e7653fc77cab8cc9" FOREIGN KEY ("aiAgentId") REFERENCES "AIAgent"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
90
+ );
91
+ await queryRunner.query(
92
+ `ALTER TABLE "AIAgentOwnerUser" ADD CONSTRAINT "FK_72cdcfce1cdb4ee65262dcbac69" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
93
+ );
94
+ await queryRunner.query(
95
+ `ALTER TABLE "AIAgentOwnerUser" ADD CONSTRAINT "FK_61e11581dbae0cf42967dbe219a" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
96
+ );
97
+ await queryRunner.query(
98
+ `ALTER TABLE "AIAgentLabel" ADD CONSTRAINT "FK_6939139a0104e1b331c19f7ea6c" FOREIGN KEY ("aiAgentId") REFERENCES "AIAgent"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
99
+ );
100
+ await queryRunner.query(
101
+ `ALTER TABLE "AIAgentLabel" ADD CONSTRAINT "FK_676606a57c0a1d45b3faf9d49f7" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
102
+ );
103
+ }
104
+
105
+ public async down(queryRunner: QueryRunner): Promise<void> {
106
+ await queryRunner.query(
107
+ `ALTER TABLE "AIAgentLabel" DROP CONSTRAINT "FK_676606a57c0a1d45b3faf9d49f7"`,
108
+ );
109
+ await queryRunner.query(
110
+ `ALTER TABLE "AIAgentLabel" DROP CONSTRAINT "FK_6939139a0104e1b331c19f7ea6c"`,
111
+ );
112
+ await queryRunner.query(
113
+ `ALTER TABLE "AIAgentOwnerUser" DROP CONSTRAINT "FK_61e11581dbae0cf42967dbe219a"`,
114
+ );
115
+ await queryRunner.query(
116
+ `ALTER TABLE "AIAgentOwnerUser" DROP CONSTRAINT "FK_72cdcfce1cdb4ee65262dcbac69"`,
117
+ );
118
+ await queryRunner.query(
119
+ `ALTER TABLE "AIAgentOwnerUser" DROP CONSTRAINT "FK_27d84c74c31e7653fc77cab8cc9"`,
120
+ );
121
+ await queryRunner.query(
122
+ `ALTER TABLE "AIAgentOwnerUser" DROP CONSTRAINT "FK_7a6dad3d4a801c718886b3a087f"`,
123
+ );
124
+ await queryRunner.query(
125
+ `ALTER TABLE "AIAgentOwnerUser" DROP CONSTRAINT "FK_cac129218093e5984a057f268b0"`,
126
+ );
127
+ await queryRunner.query(
128
+ `ALTER TABLE "AIAgentOwnerTeam" DROP CONSTRAINT "FK_26fd04196dedd19188625cbd847"`,
129
+ );
130
+ await queryRunner.query(
131
+ `ALTER TABLE "AIAgentOwnerTeam" DROP CONSTRAINT "FK_e3321a602f9d091a5e8c21dd581"`,
132
+ );
133
+ await queryRunner.query(
134
+ `ALTER TABLE "AIAgentOwnerTeam" DROP CONSTRAINT "FK_0723d49dfb7b29c8f7877556739"`,
135
+ );
136
+ await queryRunner.query(
137
+ `ALTER TABLE "AIAgentOwnerTeam" DROP CONSTRAINT "FK_ee75f6778240d20acd0e0ea5de1"`,
138
+ );
139
+ await queryRunner.query(
140
+ `ALTER TABLE "AIAgentOwnerTeam" DROP CONSTRAINT "FK_57891366dea4262e29ca7d92861"`,
141
+ );
142
+ await queryRunner.query(
143
+ `ALTER TABLE "AIAgent" DROP CONSTRAINT "FK_083a49a5f23f71c4aa26a754a06"`,
144
+ );
145
+ await queryRunner.query(
146
+ `ALTER TABLE "AIAgent" DROP CONSTRAINT "FK_d28e33795c84713c421e91f3104"`,
147
+ );
148
+ await queryRunner.query(
149
+ `ALTER TABLE "AIAgent" DROP CONSTRAINT "FK_0cd88831f8f382eabcc13c7f61c"`,
150
+ );
151
+ await queryRunner.query(
152
+ `ALTER TABLE "AIAgent" DROP CONSTRAINT "FK_5b650f1a5349ec3baa09948642d"`,
153
+ );
154
+ await queryRunner.query(
155
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
156
+ );
157
+ await queryRunner.query(
158
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
159
+ );
160
+ await queryRunner.query(
161
+ `DROP INDEX "public"."IDX_676606a57c0a1d45b3faf9d49f"`,
162
+ );
163
+ await queryRunner.query(
164
+ `DROP INDEX "public"."IDX_6939139a0104e1b331c19f7ea6"`,
165
+ );
166
+ await queryRunner.query(`DROP TABLE "AIAgentLabel"`);
167
+ await queryRunner.query(
168
+ `DROP INDEX "public"."IDX_88675054e489932d5df250e0b4"`,
169
+ );
170
+ await queryRunner.query(
171
+ `DROP INDEX "public"."IDX_27d84c74c31e7653fc77cab8cc"`,
172
+ );
173
+ await queryRunner.query(
174
+ `DROP INDEX "public"."IDX_7a6dad3d4a801c718886b3a087"`,
175
+ );
176
+ await queryRunner.query(
177
+ `DROP INDEX "public"."IDX_cac129218093e5984a057f268b"`,
178
+ );
179
+ await queryRunner.query(`DROP TABLE "AIAgentOwnerUser"`);
180
+ await queryRunner.query(
181
+ `DROP INDEX "public"."IDX_0221605414e639cd2df48fb450"`,
182
+ );
183
+ await queryRunner.query(
184
+ `DROP INDEX "public"."IDX_0723d49dfb7b29c8f787755673"`,
185
+ );
186
+ await queryRunner.query(
187
+ `DROP INDEX "public"."IDX_ee75f6778240d20acd0e0ea5de"`,
188
+ );
189
+ await queryRunner.query(
190
+ `DROP INDEX "public"."IDX_57891366dea4262e29ca7d9286"`,
191
+ );
192
+ await queryRunner.query(`DROP TABLE "AIAgentOwnerTeam"`);
193
+ await queryRunner.query(`DROP TABLE "AIAgent"`);
194
+ }
195
+ }
@@ -0,0 +1,31 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1766600860972 implements MigrationInterface {
4
+ public name = "MigrationName1766600860972";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
12
+ );
13
+ await queryRunner.query(`ALTER TABLE "AIAgent" DROP COLUMN "description"`);
14
+ await queryRunner.query(
15
+ `ALTER TABLE "AIAgent" ADD "description" character varying(500)`,
16
+ );
17
+ }
18
+
19
+ public async down(queryRunner: QueryRunner): Promise<void> {
20
+ await queryRunner.query(`ALTER TABLE "AIAgent" DROP COLUMN "description"`);
21
+ await queryRunner.query(
22
+ `ALTER TABLE "AIAgent" ADD "description" character varying(50)`,
23
+ );
24
+ await queryRunner.query(
25
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
26
+ );
27
+ await queryRunner.query(
28
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
29
+ );
30
+ }
31
+ }
@@ -0,0 +1,17 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1766606720183 implements MigrationInterface {
4
+ public name = "MigrationName1766606720183";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "Monitor" ADD "minimumProbeAgreement" integer`,
9
+ );
10
+ }
11
+
12
+ public async down(queryRunner: QueryRunner): Promise<void> {
13
+ await queryRunner.query(
14
+ `ALTER TABLE "Monitor" DROP COLUMN "minimumProbeAgreement"`,
15
+ );
16
+ }
17
+ }
@@ -0,0 +1,63 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1766688107858 implements MigrationInterface {
4
+ public name = "MigrationName1766688107858";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "AIAgentTask" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "aiAgentId" uuid, "taskType" character varying(100) NOT NULL, "status" character varying(100) NOT NULL DEFAULT 'Scheduled', "statusMessage" character varying, "metadata" jsonb, "startedAt" TIMESTAMP WITH TIME ZONE, "completedAt" TIMESTAMP WITH TIME ZONE, "deletedByUserId" uuid, "createdByUserId" uuid, CONSTRAINT "PK_eb04a1e2a82c4ce10c5f7c71199" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_8d59c1b022154b111bd972b6df" ON "AIAgentTask" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_660485cda8f31485ddcc34521c" ON "AIAgentTask" ("aiAgentId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_abce8c37353599dcd416f5c8b3" ON "AIAgentTask" ("taskType") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_a3e7acb3ba2d54e97989b809f6" ON "AIAgentTask" ("status") `,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "AIAgentTask" ADD CONSTRAINT "FK_8d59c1b022154b111bd972b6df5" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "AIAgentTask" ADD CONSTRAINT "FK_660485cda8f31485ddcc34521cc" FOREIGN KEY ("aiAgentId") REFERENCES "AIAgent"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "AIAgentTask" ADD CONSTRAINT "FK_ca3dba8a1e85ba0dd227636886a" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "AIAgentTask" ADD CONSTRAINT "FK_e26c0359ca57facf6af5714c12c" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
33
+ );
34
+ }
35
+
36
+ public async down(queryRunner: QueryRunner): Promise<void> {
37
+ await queryRunner.query(
38
+ `ALTER TABLE "AIAgentTask" DROP CONSTRAINT "FK_e26c0359ca57facf6af5714c12c"`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "AIAgentTask" DROP CONSTRAINT "FK_ca3dba8a1e85ba0dd227636886a"`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "AIAgentTask" DROP CONSTRAINT "FK_660485cda8f31485ddcc34521cc"`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "AIAgentTask" DROP CONSTRAINT "FK_8d59c1b022154b111bd972b6df5"`,
48
+ );
49
+ await queryRunner.query(
50
+ `DROP INDEX "public"."IDX_a3e7acb3ba2d54e97989b809f6"`,
51
+ );
52
+ await queryRunner.query(
53
+ `DROP INDEX "public"."IDX_abce8c37353599dcd416f5c8b3"`,
54
+ );
55
+ await queryRunner.query(
56
+ `DROP INDEX "public"."IDX_660485cda8f31485ddcc34521c"`,
57
+ );
58
+ await queryRunner.query(
59
+ `DROP INDEX "public"."IDX_8d59c1b022154b111bd972b6df"`,
60
+ );
61
+ await queryRunner.query(`DROP TABLE "AIAgentTask"`);
62
+ }
63
+ }
@@ -0,0 +1,75 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1766754182870 implements MigrationInterface {
4
+ public name: string = "MigrationName1766754182870";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "AIAgentTaskTelemetryException" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "aiAgentTaskId" uuid NOT NULL, "telemetryExceptionId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_83fcb4f4cefaa15c024e9b67509" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_f3c6679e1b584abf3bf32d8b29" ON "AIAgentTaskTelemetryException" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_db7e9c49d02e475240f643fdd6" ON "AIAgentTaskTelemetryException" ("aiAgentTaskId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_20bed0f07b86ae84616567a6c7" ON "AIAgentTaskTelemetryException" ("telemetryExceptionId") `,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "AIAgentTaskTelemetryException" ADD CONSTRAINT "FK_f3c6679e1b584abf3bf32d8b294" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "AIAgentTaskTelemetryException" ADD CONSTRAINT "FK_db7e9c49d02e475240f643fdd6a" FOREIGN KEY ("aiAgentTaskId") REFERENCES "AIAgentTask"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "AIAgentTaskTelemetryException" ADD CONSTRAINT "FK_20bed0f07b86ae84616567a6c71" FOREIGN KEY ("telemetryExceptionId") REFERENCES "TelemetryException"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "AIAgentTaskTelemetryException" ADD CONSTRAINT "FK_a9d0100fe62231694441d5757d8" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "AIAgentTaskTelemetryException" ADD CONSTRAINT "FK_eb913bd67e00d8eff18094c525d" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
39
+ );
40
+ }
41
+
42
+ public async down(queryRunner: QueryRunner): Promise<void> {
43
+ await queryRunner.query(
44
+ `ALTER TABLE "AIAgentTaskTelemetryException" DROP CONSTRAINT "FK_eb913bd67e00d8eff18094c525d"`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "AIAgentTaskTelemetryException" DROP CONSTRAINT "FK_a9d0100fe62231694441d5757d8"`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "AIAgentTaskTelemetryException" DROP CONSTRAINT "FK_20bed0f07b86ae84616567a6c71"`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "AIAgentTaskTelemetryException" DROP CONSTRAINT "FK_db7e9c49d02e475240f643fdd6a"`,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "AIAgentTaskTelemetryException" DROP CONSTRAINT "FK_f3c6679e1b584abf3bf32d8b294"`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
63
+ );
64
+ await queryRunner.query(
65
+ `DROP INDEX "public"."IDX_20bed0f07b86ae84616567a6c7"`,
66
+ );
67
+ await queryRunner.query(
68
+ `DROP INDEX "public"."IDX_db7e9c49d02e475240f643fdd6"`,
69
+ );
70
+ await queryRunner.query(
71
+ `DROP INDEX "public"."IDX_f3c6679e1b584abf3bf32d8b29"`,
72
+ );
73
+ await queryRunner.query(`DROP TABLE "AIAgentTaskTelemetryException"`);
74
+ }
75
+ }