@oneuptime/common 7.0.2994 → 7.0.3018

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 (174) hide show
  1. package/Models/AnalyticsModels/ExceptionInstance.ts +488 -0
  2. package/Models/AnalyticsModels/Index.ts +2 -0
  3. package/Models/AnalyticsModels/Span.ts +2 -2
  4. package/Models/DatabaseModels/CopilotAction.ts +232 -38
  5. package/Models/DatabaseModels/CopilotActionTypePriority.ts +325 -0
  6. package/Models/DatabaseModels/Index.ts +6 -0
  7. package/Models/DatabaseModels/TelemetryException.ts +978 -0
  8. package/Server/API/CopilotActionAPI.ts +69 -7
  9. package/Server/API/StatusAPI.ts +61 -51
  10. package/Server/EnvironmentConfig.ts +3 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.ts +93 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts +60 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts +17 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.ts +51 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.ts +23 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.ts +13 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.ts +17 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +14 -0
  19. package/Server/Infrastructure/QueueWorker.ts +2 -2
  20. package/Server/Services/CopilotActionTypePriorityService.ts +66 -0
  21. package/Server/Services/DatabaseService.ts +4 -5
  22. package/Server/Services/ExceptionInstanceService.ts +11 -0
  23. package/Server/Services/Index.ts +7 -0
  24. package/Server/Services/StatusPageDomainService.ts +118 -59
  25. package/Server/Services/TelemetryExceptionService.ts +10 -0
  26. package/Server/Types/Database/Permissions/Index.ts +1 -1
  27. package/Server/Types/Database/UpdateByID.ts +1 -1
  28. package/Server/Types/Workflow/Components/Email.ts +32 -25
  29. package/Server/Utils/CodeRepository/CodeRepository.ts +10 -14
  30. package/Server/Utils/CodeRepository/CodeRepositoryFile.ts +0 -7
  31. package/Server/Utils/Greenlock/Greenlock.ts +331 -204
  32. package/Server/Utils/Logger.ts +8 -2
  33. package/Server/Utils/Telemetry.ts +109 -25
  34. package/Types/Code/CodeType.ts +1 -0
  35. package/Types/Copilot/CopilotActionProps/DirectoryActionProp.ts +3 -0
  36. package/Types/Copilot/CopilotActionProps/ExceptionActionProp.ts +4 -0
  37. package/Types/Copilot/CopilotActionProps/FileActionProp.ts +5 -0
  38. package/Types/Copilot/CopilotActionProps/FunctionActionProp.ts +5 -0
  39. package/Types/Copilot/CopilotActionProps/Index.ts +96 -0
  40. package/Types/Copilot/CopilotActionProps/SpanActionProp.ts +4 -0
  41. package/Types/Copilot/CopilotActionStatus.ts +109 -1
  42. package/Types/Copilot/CopilotActionType.ts +203 -1
  43. package/Types/Database/PartialEntity.ts +14 -1
  44. package/Types/Date.ts +9 -1
  45. package/Types/Icon/IconProp.ts +3 -0
  46. package/Types/Permission.ts +65 -0
  47. package/Types/Workflow/Components/Email.ts +4 -4
  48. package/UI/Components/ActionCard/ActionCard.tsx +66 -0
  49. package/UI/Components/Alerts/Alert.tsx +69 -60
  50. package/UI/Components/Card/Card.tsx +1 -0
  51. package/UI/Components/Detail/Detail.tsx +6 -1
  52. package/UI/Components/GanttChart/Row/Row.tsx +4 -2
  53. package/UI/Components/GanttChart/Row/RowLabel.tsx +7 -3
  54. package/UI/Components/Icon/Icon.tsx +24 -0
  55. package/UI/Components/LogsViewer/LogsViewer.tsx +1 -1
  56. package/UI/Components/Types/FieldType.ts +1 -0
  57. package/UI/Components/Workflow/WorkflowStatus.tsx +2 -2
  58. package/UI/Config.ts +2 -0
  59. package/UI/Utils/Telemetry.ts +7 -2
  60. package/Utils/Crypto.ts +11 -0
  61. package/build/dist/Models/AnalyticsModels/ExceptionInstance.js +445 -0
  62. package/build/dist/Models/AnalyticsModels/ExceptionInstance.js.map +1 -0
  63. package/build/dist/Models/AnalyticsModels/Index.js +2 -0
  64. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  65. package/build/dist/Models/AnalyticsModels/Span.js +2 -2
  66. package/build/dist/Models/DatabaseModels/CopilotAction.js +237 -40
  67. package/build/dist/Models/DatabaseModels/CopilotAction.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js +343 -0
  69. package/build/dist/Models/DatabaseModels/CopilotActionTypePriority.js.map +1 -0
  70. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  71. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  72. package/build/dist/Models/DatabaseModels/TelemetryException.js +1010 -0
  73. package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -0
  74. package/build/dist/Server/API/CopilotActionAPI.js +56 -9
  75. package/build/dist/Server/API/CopilotActionAPI.js.map +1 -1
  76. package/build/dist/Server/API/StatusAPI.js +51 -44
  77. package/build/dist/Server/API/StatusAPI.js.map +1 -1
  78. package/build/dist/Server/EnvironmentConfig.js +1 -0
  79. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  80. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js +38 -0
  81. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js.map +1 -0
  82. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js +26 -0
  83. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js.map +1 -0
  84. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js +12 -0
  85. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js.map +1 -0
  86. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.js +24 -0
  87. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725291476867-MigrationName.js.map +1 -0
  88. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.js +14 -0
  89. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725357719072-MigrationName.js.map +1 -0
  90. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.js +12 -0
  91. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725360199561-MigrationName.js.map +1 -0
  92. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.js +12 -0
  93. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725379949648-MigrationName.js.map +1 -0
  94. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +14 -0
  95. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  96. package/build/dist/Server/Infrastructure/QueueWorker.js +2 -2
  97. package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
  98. package/build/dist/Server/Services/CopilotActionTypePriorityService.js +45 -0
  99. package/build/dist/Server/Services/CopilotActionTypePriorityService.js.map +1 -0
  100. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  101. package/build/dist/Server/Services/ExceptionInstanceService.js +9 -0
  102. package/build/dist/Server/Services/ExceptionInstanceService.js.map +1 -0
  103. package/build/dist/Server/Services/Index.js +6 -0
  104. package/build/dist/Server/Services/Index.js.map +1 -1
  105. package/build/dist/Server/Services/StatusPageDomainService.js +101 -53
  106. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  107. package/build/dist/Server/Services/TelemetryExceptionService.js +9 -0
  108. package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -0
  109. package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
  110. package/build/dist/Server/Types/Workflow/Components/Email.js +26 -27
  111. package/build/dist/Server/Types/Workflow/Components/Email.js.map +1 -1
  112. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js +5 -13
  113. package/build/dist/Server/Utils/CodeRepository/CodeRepository.js.map +1 -1
  114. package/build/dist/Server/Utils/Greenlock/Greenlock.js +234 -157
  115. package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
  116. package/build/dist/Server/Utils/Logger.js +5 -1
  117. package/build/dist/Server/Utils/Logger.js.map +1 -1
  118. package/build/dist/Server/Utils/Telemetry.js +63 -22
  119. package/build/dist/Server/Utils/Telemetry.js.map +1 -1
  120. package/build/dist/Types/Code/CodeType.js +1 -0
  121. package/build/dist/Types/Code/CodeType.js.map +1 -1
  122. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js +2 -0
  123. package/build/dist/Types/Copilot/CopilotActionProps/DirectoryActionProp.js.map +1 -0
  124. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js +2 -0
  125. package/build/dist/Types/Copilot/CopilotActionProps/ExceptionActionProp.js.map +1 -0
  126. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js +2 -0
  127. package/build/dist/Types/Copilot/CopilotActionProps/FileActionProp.js.map +1 -0
  128. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js +2 -0
  129. package/build/dist/Types/Copilot/CopilotActionProps/FunctionActionProp.js.map +1 -0
  130. package/build/dist/Types/Copilot/CopilotActionProps/Index.js +64 -0
  131. package/build/dist/Types/Copilot/CopilotActionProps/Index.js.map +1 -0
  132. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js +2 -0
  133. package/build/dist/Types/Copilot/CopilotActionProps/SpanActionProp.js.map +1 -0
  134. package/build/dist/Types/Copilot/CopilotActionStatus.js +89 -0
  135. package/build/dist/Types/Copilot/CopilotActionStatus.js.map +1 -1
  136. package/build/dist/Types/Copilot/CopilotActionType.js +165 -1
  137. package/build/dist/Types/Copilot/CopilotActionType.js.map +1 -1
  138. package/build/dist/Types/Database/PartialEntity.js +3 -0
  139. package/build/dist/Types/Database/PartialEntity.js.map +1 -1
  140. package/build/dist/Types/Date.js +7 -1
  141. package/build/dist/Types/Date.js.map +1 -1
  142. package/build/dist/Types/Icon/IconProp.js +3 -0
  143. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  144. package/build/dist/Types/Permission.js +57 -0
  145. package/build/dist/Types/Permission.js.map +1 -1
  146. package/build/dist/Types/Workflow/Components/Email.js +4 -4
  147. package/build/dist/Types/Workflow/Components/Email.js.map +1 -1
  148. package/build/dist/UI/Components/ActionCard/ActionCard.js +27 -0
  149. package/build/dist/UI/Components/ActionCard/ActionCard.js.map +1 -0
  150. package/build/dist/UI/Components/Alerts/Alert.js +36 -45
  151. package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
  152. package/build/dist/UI/Components/Card/Card.js +1 -1
  153. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  154. package/build/dist/UI/Components/Detail/Detail.js +5 -1
  155. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  156. package/build/dist/UI/Components/GanttChart/Row/Row.js +2 -2
  157. package/build/dist/UI/Components/GanttChart/Row/Row.js.map +1 -1
  158. package/build/dist/UI/Components/GanttChart/Row/RowLabel.js +3 -3
  159. package/build/dist/UI/Components/GanttChart/Row/RowLabel.js.map +1 -1
  160. package/build/dist/UI/Components/Icon/Icon.js +9 -0
  161. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  162. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
  163. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  164. package/build/dist/UI/Components/Types/FieldType.js +1 -0
  165. package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
  166. package/build/dist/UI/Components/Workflow/WorkflowStatus.js +2 -2
  167. package/build/dist/UI/Components/Workflow/WorkflowStatus.js.map +1 -1
  168. package/build/dist/UI/Config.js +1 -0
  169. package/build/dist/UI/Config.js.map +1 -1
  170. package/build/dist/UI/Utils/Telemetry.js +6 -3
  171. package/build/dist/UI/Utils/Telemetry.js.map +1 -1
  172. package/build/dist/Utils/Crypto.js +10 -0
  173. package/build/dist/Utils/Crypto.js.map +1 -0
  174. package/package.json +11 -11
@@ -15,6 +15,10 @@ import ObjectID from "Common/Types/ObjectID";
15
15
  import CopilotAction from "Common/Models/DatabaseModels/CopilotAction";
16
16
  import CopilotCodeRepositoryService from "../Services/CopilotCodeRepositoryService";
17
17
  import CodeRepositoryAuthorization from "../Middleware/CodeRepositoryAuthorization";
18
+ import CopilotActionStatus from "../../Types/Copilot/CopilotActionStatus";
19
+ import CopilotActionTypePriority from "../../Models/DatabaseModels/CopilotActionTypePriority";
20
+ import CopilotActionTypePriorityService from "../Services/CopilotActionTypePriorityService";
21
+ import SortOrder from "../../Types/BaseDatabase/SortOrder";
18
22
 
19
23
  export default class CopilotActionAPI extends BaseAPI<
20
24
  CopilotAction,
@@ -26,7 +30,7 @@ export default class CopilotActionAPI extends BaseAPI<
26
30
  this.router.get(
27
31
  `${new this.entityType()
28
32
  .getCrudApiPath()
29
- ?.toString()}/copilot-actions-by-file/:secretkey`,
33
+ ?.toString()}/copilot-action-types-by-priority/:secretkey`,
30
34
  CodeRepositoryAuthorization.isAuthorizedRepository,
31
35
  async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
32
36
  try {
@@ -36,10 +40,68 @@ export default class CopilotActionAPI extends BaseAPI<
36
40
  throw new BadDataException("Secret key is required");
37
41
  }
38
42
 
39
- const filePath: string = req.body["filePath"]!;
43
+ const codeRepository: CopilotCodeRepository | null =
44
+ await CopilotCodeRepositoryService.findOneBy({
45
+ query: {
46
+ secretToken: new ObjectID(secretkey),
47
+ },
48
+ select: {
49
+ _id: true,
50
+ },
51
+ props: {
52
+ isRoot: true,
53
+ },
54
+ });
55
+
56
+ if (!codeRepository) {
57
+ throw new BadDataException(
58
+ "Code repository not found. Secret key is invalid.",
59
+ );
60
+ }
40
61
 
41
- if (!filePath) {
42
- throw new BadDataException("File path is required");
62
+ const copilotActionTypes: Array<CopilotActionTypePriority> =
63
+ await CopilotActionTypePriorityService.findBy({
64
+ query: {
65
+ codeRepositoryId: codeRepository.id!,
66
+ },
67
+ select: {
68
+ _id: true,
69
+ actionType: true,
70
+ priority: true,
71
+ },
72
+ skip: 0,
73
+ sort: {
74
+ priority: SortOrder.Ascending,
75
+ },
76
+ limit: LIMIT_PER_PROJECT,
77
+ props: {
78
+ isRoot: true,
79
+ },
80
+ });
81
+
82
+ return Response.sendJsonObjectResponse(req, res, {
83
+ actionTypes: CopilotActionTypePriority.toJSONArray(
84
+ copilotActionTypes,
85
+ CopilotActionTypePriority,
86
+ ),
87
+ });
88
+ } catch (err) {
89
+ next(err);
90
+ }
91
+ },
92
+ );
93
+
94
+ this.router.get(
95
+ `${new this.entityType()
96
+ .getCrudApiPath()
97
+ ?.toString()}/copilot-actions-in-queue/:secretkey`,
98
+ CodeRepositoryAuthorization.isAuthorizedRepository,
99
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
100
+ try {
101
+ const secretkey: string = req.params["secretkey"]!;
102
+
103
+ if (!secretkey) {
104
+ throw new BadDataException("Secret key is required");
43
105
  }
44
106
 
45
107
  const serviceCatalogId: string = req.body["serviceCatalogId"]!;
@@ -71,14 +133,13 @@ export default class CopilotActionAPI extends BaseAPI<
71
133
  await CopilotActionService.findBy({
72
134
  query: {
73
135
  codeRepositoryId: codeRepository.id!,
74
- filePath: filePath,
75
136
  serviceCatalogId: new ObjectID(serviceCatalogId),
137
+ copilotActionStatus: CopilotActionStatus.IN_QUEUE,
76
138
  },
77
139
  select: {
78
140
  _id: true,
79
141
  codeRepositoryId: true,
80
142
  serviceCatalogId: true,
81
- filePath: true,
82
143
  copilotActionStatus: true,
83
144
  copilotActionType: true,
84
145
  createdAt: true,
@@ -110,7 +171,7 @@ export default class CopilotActionAPI extends BaseAPI<
110
171
  this.router.post(
111
172
  `${new this.entityType()
112
173
  .getCrudApiPath()
113
- ?.toString()}/add-copilot-action/:secretkey`,
174
+ ?.toString()}/queue-copilot-action/:secretkey`,
114
175
  CodeRepositoryAuthorization.isAuthorizedRepository,
115
176
  async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
116
177
  try {
@@ -147,6 +208,7 @@ export default class CopilotActionAPI extends BaseAPI<
147
208
 
148
209
  copilotAction.codeRepositoryId = codeRepository.id!;
149
210
  copilotAction.projectId = codeRepository.projectId!;
211
+ copilotAction.copilotActionStatus = CopilotActionStatus.IN_QUEUE;
150
212
 
151
213
  const createdAction: CopilotAction =
152
214
  await CopilotActionService.create({
@@ -6,7 +6,7 @@ import Express, {
6
6
  } from "../Utils/Express";
7
7
  import logger from "../Utils/Logger";
8
8
  import Response from "../Utils/Response";
9
- import Telemetry from "../Utils/Telemetry";
9
+ import Telemetry, { Span, TelemetryCounter } from "../Utils/Telemetry";
10
10
  import Exception from "Common/Types/Exception/Exception";
11
11
  import ServerException from "Common/Types/Exception/ServerException";
12
12
 
@@ -16,36 +16,36 @@ export interface StatusAPIOptions {
16
16
  }
17
17
 
18
18
  export default class StatusAPI {
19
- public static statusCheckSuccessCounter = Telemetry.getCounter({
20
- name: "status.check.success",
21
- description: "Status check counter",
22
- });
23
-
24
- // ready counter
25
- public static stausReadySuccess = Telemetry.getCounter({
26
- name: "status.ready.success",
27
- description: "Ready check counter",
28
- });
29
- // live counter
30
-
31
- public static stausLiveSuccess = Telemetry.getCounter({
32
- name: "status.live.success",
33
- description: "Live check counter",
34
- });
35
-
36
- // ready failed counter
37
- public static stausReadyFailed = Telemetry.getCounter({
38
- name: "status.ready.failed",
39
- description: "Ready check counter",
40
- });
41
-
42
- // live failed counter
43
- public static stausLiveFailed = Telemetry.getCounter({
44
- name: "status.live.failed",
45
- description: "Live check counter",
46
- });
47
-
48
19
  public static init(options: StatusAPIOptions): ExpressRouter {
20
+ const statusCheckSuccessCounter: TelemetryCounter = Telemetry.getCounter({
21
+ name: "status.check.success",
22
+ description: "Status check counter",
23
+ });
24
+
25
+ // ready counter
26
+ const stausReadySuccess: TelemetryCounter = Telemetry.getCounter({
27
+ name: "status.ready.success",
28
+ description: "Ready check counter",
29
+ });
30
+ // live counter
31
+
32
+ const stausLiveSuccess: TelemetryCounter = Telemetry.getCounter({
33
+ name: "status.live.success",
34
+ description: "Live check counter",
35
+ });
36
+
37
+ // ready failed counter
38
+ const stausReadyFailed: TelemetryCounter = Telemetry.getCounter({
39
+ name: "status.ready.failed",
40
+ description: "Ready check counter",
41
+ });
42
+
43
+ // live failed counter
44
+ const stausLiveFailed: TelemetryCounter = Telemetry.getCounter({
45
+ name: "status.live.failed",
46
+ description: "Live check counter",
47
+ });
48
+
49
49
  const router: ExpressRouter = Express.getRouter();
50
50
 
51
51
  router.get("/app-name", (_req: ExpressRequest, res: ExpressResponse) => {
@@ -54,7 +54,7 @@ export default class StatusAPI {
54
54
 
55
55
  // General status
56
56
  router.get("/status", (req: ExpressRequest, res: ExpressResponse) => {
57
- this.statusCheckSuccessCounter.add(1);
57
+ statusCheckSuccessCounter.add(1);
58
58
 
59
59
  logger.info("Status check: ok");
60
60
 
@@ -67,24 +67,33 @@ export default class StatusAPI {
67
67
  router.get(
68
68
  "/status/ready",
69
69
  async (req: ExpressRequest, res: ExpressResponse) => {
70
- try {
71
- logger.debug("Ready check");
72
- await options.readyCheck();
73
- logger.info("Ready check: ok");
74
- this.stausReadySuccess.add(1);
75
- Response.sendJsonObjectResponse(req, res, {
76
- status: "ok",
77
- });
78
- } catch (e) {
79
- this.stausReadyFailed.add(1);
80
- Response.sendErrorResponse(
81
- req,
82
- res,
83
- e instanceof Exception
84
- ? e
85
- : new ServerException("Server is not ready"),
86
- );
87
- }
70
+ return Telemetry.startActiveSpan({
71
+ name: "/status/ready",
72
+ fn: async (span: Span) => {
73
+ try {
74
+ logger.debug("Ready check");
75
+ await options.readyCheck();
76
+ logger.info("Ready check: ok");
77
+ stausReadySuccess.add(1);
78
+
79
+ Response.sendJsonObjectResponse(req, res, {
80
+ status: "ok",
81
+ });
82
+ span.end();
83
+ } catch (e) {
84
+ span.recordException(e as Exception);
85
+ stausReadyFailed.add(1);
86
+ Response.sendErrorResponse(
87
+ req,
88
+ res,
89
+ e instanceof Exception
90
+ ? e
91
+ : new ServerException("Server is not ready"),
92
+ );
93
+ span.end();
94
+ }
95
+ },
96
+ });
88
97
  },
89
98
  );
90
99
 
@@ -96,12 +105,13 @@ export default class StatusAPI {
96
105
  logger.debug("Live check");
97
106
  await options.readyCheck();
98
107
  logger.info("Live check: ok");
99
- this.stausLiveSuccess.add(1);
108
+ stausLiveSuccess.add(1);
109
+
100
110
  Response.sendJsonObjectResponse(req, res, {
101
111
  status: "ok",
102
112
  });
103
113
  } catch (e) {
104
- this.stausLiveFailed.add(1);
114
+ stausLiveFailed.add(1);
105
115
  Response.sendErrorResponse(
106
116
  req,
107
117
  res,
@@ -255,3 +255,6 @@ export const AccountsClientUrl: URL = new URL(
255
255
  Host,
256
256
  AccountsRoute,
257
257
  );
258
+
259
+ export const DisableTelemetry: boolean =
260
+ process.env["DISABLE_TELEMETRY"] === "true";
@@ -0,0 +1,93 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1724610006927 implements MigrationInterface {
4
+ public name = "MigrationName1724610006927";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "TelemetryException" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "version" integer NOT NULL, "projectId" uuid NOT NULL, "telemetryServiceId" uuid NOT NULL, "message" character varying, "stackTrace" character varying, "exceptionType" character varying, "fingerprint" character varying(100), "createdByUserId" uuid, "deletedByUserId" uuid, "markedAsResolvedAt" TIMESTAMP WITH TIME ZONE, "markedAsMutedAt" TIMESTAMP WITH TIME ZONE, "firstSeenAt" TIMESTAMP WITH TIME ZONE, "lastSeenAt" TIMESTAMP WITH TIME ZONE, "assignToUserId" uuid, "assignToTeamId" uuid, "markedAsResolvedByUserId" uuid, "markedAsMutedByUserId" uuid, CONSTRAINT "PK_53717afe73c3e72c11713e5e25f" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_3310c3a807a7e8bca9d1bd8e0e" ON "TelemetryException" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_6470c69cb5f53c5899c0483df5" ON "TelemetryException" ("telemetryServiceId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_e270eb229cd583c653c2176db9" ON "TelemetryException" ("fingerprint") `,
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 "TelemetryException" ADD CONSTRAINT "FK_3310c3a807a7e8bca9d1bd8e0eb" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_6470c69cb5f53c5899c0483df5f" FOREIGN KEY ("telemetryServiceId") REFERENCES "TelemetryService"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_d2e1b4f5dcaebbf14ed6cbd303d" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_757f473e68b584bc42fcfbd9373" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_f7ec3f51dae2b4963cfb8fe5c46" FOREIGN KEY ("assignToUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_63221e8bd973ab71a49598d6c88" FOREIGN KEY ("assignToTeamId") REFERENCES "Team"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_10c7733499d5afa9b857f4a00c5" FOREIGN KEY ("markedAsResolvedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_199e3572d19b75e59f2082251f8" FOREIGN KEY ("markedAsMutedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
+ );
49
+ }
50
+
51
+ public async down(queryRunner: QueryRunner): Promise<void> {
52
+ await queryRunner.query(
53
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_199e3572d19b75e59f2082251f8"`,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_10c7733499d5afa9b857f4a00c5"`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_63221e8bd973ab71a49598d6c88"`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_f7ec3f51dae2b4963cfb8fe5c46"`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_757f473e68b584bc42fcfbd9373"`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_d2e1b4f5dcaebbf14ed6cbd303d"`,
69
+ );
70
+ await queryRunner.query(
71
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_6470c69cb5f53c5899c0483df5f"`,
72
+ );
73
+ await queryRunner.query(
74
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_3310c3a807a7e8bca9d1bd8e0eb"`,
75
+ );
76
+ await queryRunner.query(
77
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
78
+ );
79
+ await queryRunner.query(
80
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
81
+ );
82
+ await queryRunner.query(
83
+ `DROP INDEX "public"."IDX_e270eb229cd583c653c2176db9"`,
84
+ );
85
+ await queryRunner.query(
86
+ `DROP INDEX "public"."IDX_6470c69cb5f53c5899c0483df5"`,
87
+ );
88
+ await queryRunner.query(
89
+ `DROP INDEX "public"."IDX_3310c3a807a7e8bca9d1bd8e0e"`,
90
+ );
91
+ await queryRunner.query(`DROP TABLE "TelemetryException"`);
92
+ }
93
+ }
@@ -0,0 +1,60 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1724613666632 implements MigrationInterface {
4
+ public name = "MigrationName1724613666632";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_199e3572d19b75e59f2082251f8"`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "TelemetryException" DROP COLUMN "markedAsMutedAt"`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "TelemetryException" DROP COLUMN "markedAsMutedByUserId"`,
15
+ );
16
+ await queryRunner.query(
17
+ `ALTER TABLE "TelemetryException" ADD "markedAsArchivedAt" TIMESTAMP WITH TIME ZONE`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "TelemetryException" ADD "markedAsArchivedByUserId" uuid`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "TelemetryException" ADD "isResolved" boolean NOT NULL DEFAULT false`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "TelemetryException" ADD "isArchived" boolean NOT NULL DEFAULT false`,
27
+ );
28
+
29
+ await queryRunner.query(
30
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_3def22373f0cb84e16cb355b5e5" FOREIGN KEY ("markedAsArchivedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
31
+ );
32
+ }
33
+
34
+ public async down(queryRunner: QueryRunner): Promise<void> {
35
+ await queryRunner.query(
36
+ `ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_3def22373f0cb84e16cb355b5e5"`,
37
+ );
38
+ await queryRunner.query(
39
+ `ALTER TABLE "TelemetryException" DROP COLUMN "isArchived"`,
40
+ );
41
+ await queryRunner.query(
42
+ `ALTER TABLE "TelemetryException" DROP COLUMN "isResolved"`,
43
+ );
44
+ await queryRunner.query(
45
+ `ALTER TABLE "TelemetryException" DROP COLUMN "markedAsArchivedByUserId"`,
46
+ );
47
+ await queryRunner.query(
48
+ `ALTER TABLE "TelemetryException" DROP COLUMN "markedAsArchivedAt"`,
49
+ );
50
+ await queryRunner.query(
51
+ `ALTER TABLE "TelemetryException" ADD "markedAsMutedByUserId" uuid`,
52
+ );
53
+ await queryRunner.query(
54
+ `ALTER TABLE "TelemetryException" ADD "markedAsMutedAt" TIMESTAMP WITH TIME ZONE`,
55
+ );
56
+ await queryRunner.query(
57
+ `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_199e3572d19b75e59f2082251f8" FOREIGN KEY ("markedAsMutedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
58
+ );
59
+ }
60
+ }
@@ -0,0 +1,17 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1724659071843 implements MigrationInterface {
4
+ public name = "MigrationName1724659071843";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`,
9
+ );
10
+ }
11
+
12
+ public async down(queryRunner: QueryRunner): Promise<void> {
13
+ await queryRunner.query(
14
+ `ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`,
15
+ );
16
+ }
17
+ }
@@ -0,0 +1,51 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725291476867 implements MigrationInterface {
4
+ public name = "MigrationName1725291476867";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "CopilotActionTypePriority" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "version" integer NOT NULL, "projectId" uuid NOT NULL, "codeRepositoryId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "actionType" character varying(100) NOT NULL, "priority" integer NOT NULL DEFAULT '1', CONSTRAINT "PK_e87af58e75ac25610e48807703e" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_d8e9d95bc4e4094b84d812950f" ON "CopilotActionTypePriority" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_a4c64c718646aebbfe469d6c95" ON "CopilotActionTypePriority" ("codeRepositoryId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `ALTER TABLE "CopilotActionTypePriority" ADD CONSTRAINT "FK_d8e9d95bc4e4094b84d812950f2" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "CopilotActionTypePriority" ADD CONSTRAINT "FK_a4c64c718646aebbfe469d6c950" FOREIGN KEY ("codeRepositoryId") REFERENCES "CopilotCodeRepository"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "CopilotActionTypePriority" ADD CONSTRAINT "FK_039fd3af73a2c910eee5ed67669" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "CopilotActionTypePriority" ADD CONSTRAINT "FK_01864ec4b8b5f343e484a09128a" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
27
+ );
28
+ }
29
+
30
+ public async down(queryRunner: QueryRunner): Promise<void> {
31
+ await queryRunner.query(
32
+ `ALTER TABLE "CopilotActionTypePriority" DROP CONSTRAINT "FK_01864ec4b8b5f343e484a09128a"`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "CopilotActionTypePriority" DROP CONSTRAINT "FK_039fd3af73a2c910eee5ed67669"`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "CopilotActionTypePriority" DROP CONSTRAINT "FK_a4c64c718646aebbfe469d6c950"`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "CopilotActionTypePriority" DROP CONSTRAINT "FK_d8e9d95bc4e4094b84d812950f2"`,
42
+ );
43
+ await queryRunner.query(
44
+ `DROP INDEX "public"."IDX_a4c64c718646aebbfe469d6c95"`,
45
+ );
46
+ await queryRunner.query(
47
+ `DROP INDEX "public"."IDX_d8e9d95bc4e4094b84d812950f"`,
48
+ );
49
+ await queryRunner.query(`DROP TABLE "CopilotActionTypePriority"`);
50
+ }
51
+ }
@@ -0,0 +1,23 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725357719072 implements MigrationInterface {
4
+ public name = "MigrationName1725357719072";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "CopilotAction" ADD "copilotActionProp" jsonb`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "CopilotAction" ADD "statusMessage" text`,
12
+ );
13
+ }
14
+
15
+ public async down(queryRunner: QueryRunner): Promise<void> {
16
+ await queryRunner.query(
17
+ `ALTER TABLE "CopilotAction" DROP COLUMN "statusMessage"`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "CopilotAction" DROP COLUMN "copilotActionProp"`,
21
+ );
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725360199561 implements MigrationInterface {
4
+ public name = "MigrationName1725360199561";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE "CopilotAction" ADD "logs" text`);
8
+ }
9
+
10
+ public async down(queryRunner: QueryRunner): Promise<void> {
11
+ await queryRunner.query(`ALTER TABLE "CopilotAction" DROP COLUMN "logs"`);
12
+ }
13
+ }
@@ -0,0 +1,17 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725379949648 implements MigrationInterface {
4
+ public name = "MigrationName1725379949648";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "CopilotAction" ADD "isPriority" boolean NOT NULL DEFAULT false`,
9
+ );
10
+ }
11
+
12
+ public async down(queryRunner: QueryRunner): Promise<void> {
13
+ await queryRunner.query(
14
+ `ALTER TABLE "CopilotAction" DROP COLUMN "isPriority"`,
15
+ );
16
+ }
17
+ }
@@ -41,6 +41,13 @@ import { MigrationName1722892318363 } from "./1722892318363-MigrationName";
41
41
  import { MigrationName1723825511054 } from "./1723825511054-MigrationName";
42
42
  import { MigrationName1723828588502 } from "./1723828588502-MigrationName";
43
43
  import { MigrationName1724078044172 } from "./1724078044172-MigrationName";
44
+ import { MigrationName1724610006927 } from "./1724610006927-MigrationName";
45
+ import { MigrationName1724613666632 } from "./1724613666632-MigrationName";
46
+ import { MigrationName1724659071843 } from "./1724659071843-MigrationName";
47
+ import { MigrationName1725291476867 } from "./1725291476867-MigrationName";
48
+ import { MigrationName1725357719072 } from "./1725357719072-MigrationName";
49
+ import { MigrationName1725360199561 } from "./1725360199561-MigrationName";
50
+ import { MigrationName1725379949648 } from "./1725379949648-MigrationName";
44
51
 
45
52
  export default [
46
53
  InitialMigration,
@@ -86,4 +93,11 @@ export default [
86
93
  MigrationName1723825511054,
87
94
  MigrationName1723828588502,
88
95
  MigrationName1724078044172,
96
+ MigrationName1724610006927,
97
+ MigrationName1724613666632,
98
+ MigrationName1724659071843,
99
+ MigrationName1725291476867,
100
+ MigrationName1725357719072,
101
+ MigrationName1725360199561,
102
+ MigrationName1725379949648,
89
103
  ];
@@ -31,7 +31,7 @@ export default class QueueWorker {
31
31
  }
32
32
 
33
33
  public static async runJobWithTimeout(
34
- timeout: number,
34
+ timeoutInMS: number,
35
35
  jobCallback: PromiseVoidFunction,
36
36
  ): Promise<void> {
37
37
  type TimeoutPromise = (ms: number) => Promise<void>;
@@ -46,6 +46,6 @@ export default class QueueWorker {
46
46
  );
47
47
  };
48
48
 
49
- return await Promise.race([timeoutPromise(timeout), jobCallback()]);
49
+ return await Promise.race([timeoutPromise(timeoutInMS), jobCallback()]);
50
50
  }
51
51
  }