@oneuptime/common 10.0.66 → 10.0.68

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 (132) hide show
  1. package/Models/AnalyticsModels/AuditLog.ts +370 -0
  2. package/Models/DatabaseModels/Alert.ts +2 -0
  3. package/Models/DatabaseModels/ApiKey.ts +2 -0
  4. package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +3 -0
  5. package/Models/DatabaseModels/GlobalConfig.ts +56 -0
  6. package/Models/DatabaseModels/Incident.ts +2 -0
  7. package/Models/DatabaseModels/Index.ts +4 -0
  8. package/Models/DatabaseModels/Label.ts +2 -0
  9. package/Models/DatabaseModels/Monitor.ts +2 -0
  10. package/Models/DatabaseModels/OnCallDutyPolicy.ts +2 -0
  11. package/Models/DatabaseModels/Project.ts +110 -0
  12. package/Models/DatabaseModels/ScheduledMaintenance.ts +2 -0
  13. package/Models/DatabaseModels/StatusPage.ts +2 -0
  14. package/Models/DatabaseModels/Team.ts +2 -0
  15. package/Models/DatabaseModels/TelegramLog.ts +1025 -0
  16. package/Models/DatabaseModels/UserNotificationRule.ts +49 -0
  17. package/Models/DatabaseModels/UserNotificationSetting.ts +17 -0
  18. package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
  19. package/Models/DatabaseModels/UserTelegram.ts +312 -0
  20. package/Server/API/UserTelegramAPI.ts +167 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.ts +325 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.ts +35 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  24. package/Server/Services/AuditLogService.ts +574 -0
  25. package/Server/Services/DatabaseService.ts +71 -0
  26. package/Server/Services/Index.ts +8 -0
  27. package/Server/Services/TelegramLogService.ts +15 -0
  28. package/Server/Services/TelegramService.ts +139 -0
  29. package/Server/Services/UserNotificationRuleService.ts +350 -1
  30. package/Server/Services/UserNotificationSettingService.ts +114 -0
  31. package/Server/Services/UserTelegramService.ts +140 -0
  32. package/Server/Utils/Monitor/MonitorResource.ts +29 -15
  33. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +29 -16
  34. package/Tests/Types/Date.test.ts +158 -0
  35. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +1 -0
  36. package/Types/AuditLog/AuditLogAction.ts +7 -0
  37. package/Types/BaseDatabase/EnableAuditLogOn.ts +5 -0
  38. package/Types/Database/EnableAuditLog.ts +18 -0
  39. package/Types/Date.ts +12 -3
  40. package/Types/Icon/IconProp.ts +1 -0
  41. package/Types/Permission.ts +24 -0
  42. package/Types/Telegram/TelegramMessage.ts +9 -0
  43. package/Types/TelegramStatus.ts +14 -0
  44. package/UI/Components/Icon/Icon.tsx +15 -0
  45. package/build/dist/Models/AnalyticsModels/AuditLog.js +337 -0
  46. package/build/dist/Models/AnalyticsModels/AuditLog.js.map +1 -0
  47. package/build/dist/Models/DatabaseModels/Alert.js +2 -0
  48. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  49. package/build/dist/Models/DatabaseModels/ApiKey.js +2 -0
  50. package/build/dist/Models/DatabaseModels/ApiKey.js.map +1 -1
  51. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
  52. package/build/dist/Models/DatabaseModels/GlobalConfig.js +59 -0
  53. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  54. package/build/dist/Models/DatabaseModels/Incident.js +2 -0
  55. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  56. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  57. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  58. package/build/dist/Models/DatabaseModels/Label.js +2 -0
  59. package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
  60. package/build/dist/Models/DatabaseModels/Monitor.js +2 -0
  61. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  62. package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js +2 -0
  63. package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js.map +1 -1
  64. package/build/dist/Models/DatabaseModels/Project.js +114 -0
  65. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  66. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +2 -0
  67. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/StatusPage.js +2 -0
  69. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  70. package/build/dist/Models/DatabaseModels/Team.js +2 -0
  71. package/build/dist/Models/DatabaseModels/Team.js.map +1 -1
  72. package/build/dist/Models/DatabaseModels/TelegramLog.js +1056 -0
  73. package/build/dist/Models/DatabaseModels/TelegramLog.js.map +1 -0
  74. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +49 -0
  75. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  76. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +19 -0
  77. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
  78. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
  79. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
  80. package/build/dist/Models/DatabaseModels/UserTelegram.js +331 -0
  81. package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -0
  82. package/build/dist/Server/API/UserTelegramAPI.js +99 -0
  83. package/build/dist/Server/API/UserTelegramAPI.js.map +1 -0
  84. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js +116 -0
  85. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js.map +1 -0
  86. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js +18 -0
  87. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js.map +1 -0
  88. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  89. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  90. package/build/dist/Server/Services/AuditLogService.js +402 -0
  91. package/build/dist/Server/Services/AuditLogService.js.map +1 -0
  92. package/build/dist/Server/Services/DatabaseService.js +68 -8
  93. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  94. package/build/dist/Server/Services/Index.js +8 -0
  95. package/build/dist/Server/Services/Index.js.map +1 -1
  96. package/build/dist/Server/Services/TelegramLogService.js +13 -0
  97. package/build/dist/Server/Services/TelegramLogService.js.map +1 -0
  98. package/build/dist/Server/Services/TelegramService.js +100 -0
  99. package/build/dist/Server/Services/TelegramService.js.map +1 -0
  100. package/build/dist/Server/Services/UserNotificationRuleService.js +272 -21
  101. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  102. package/build/dist/Server/Services/UserNotificationSettingService.js +94 -0
  103. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  104. package/build/dist/Server/Services/UserTelegramService.js +133 -0
  105. package/build/dist/Server/Services/UserTelegramService.js.map +1 -0
  106. package/build/dist/Server/Utils/Monitor/MonitorResource.js +25 -12
  107. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  108. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +24 -12
  109. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  110. package/build/dist/Tests/Types/Date.test.js +96 -0
  111. package/build/dist/Tests/Types/Date.test.js.map +1 -1
  112. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +1 -0
  113. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  114. package/build/dist/Types/AuditLog/AuditLogAction.js +8 -0
  115. package/build/dist/Types/AuditLog/AuditLogAction.js.map +1 -0
  116. package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js +2 -0
  117. package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js.map +1 -0
  118. package/build/dist/Types/Database/EnableAuditLog.js +15 -0
  119. package/build/dist/Types/Database/EnableAuditLog.js.map +1 -0
  120. package/build/dist/Types/Date.js +9 -3
  121. package/build/dist/Types/Date.js.map +1 -1
  122. package/build/dist/Types/Icon/IconProp.js +1 -0
  123. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  124. package/build/dist/Types/Permission.js +21 -0
  125. package/build/dist/Types/Permission.js.map +1 -1
  126. package/build/dist/Types/Telegram/TelegramMessage.js +2 -0
  127. package/build/dist/Types/Telegram/TelegramMessage.js.map +1 -0
  128. package/build/dist/Types/TelegramStatus.js +15 -0
  129. package/build/dist/Types/TelegramStatus.js.map +1 -0
  130. package/build/dist/UI/Components/Icon/Icon.js +5 -0
  131. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  132. package/package.json +2 -2
@@ -0,0 +1,370 @@
1
+ import AnalyticsBaseModel from "./AnalyticsBaseModel/AnalyticsBaseModel";
2
+ import Route from "../../Types/API/Route";
3
+ import AnalyticsTableEngine from "../../Types/AnalyticsDatabase/AnalyticsTableEngine";
4
+ import AnalyticsTableName from "../../Types/AnalyticsDatabase/AnalyticsTableName";
5
+ import AnalyticsTableColumn from "../../Types/AnalyticsDatabase/TableColumn";
6
+ import TableColumnType from "../../Types/AnalyticsDatabase/TableColumnType";
7
+ import { JSONArray } from "../../Types/JSON";
8
+ import ObjectID from "../../Types/ObjectID";
9
+ import Permission from "../../Types/Permission";
10
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
11
+
12
+ export default class AuditLog extends AnalyticsBaseModel {
13
+ public constructor() {
14
+ const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
15
+ key: "projectId",
16
+ title: "Project ID",
17
+ description: "ID of the project this audit log belongs to.",
18
+ required: true,
19
+ type: TableColumnType.ObjectID,
20
+ isTenantId: true,
21
+ accessControl: {
22
+ read: [
23
+ Permission.ProjectOwner,
24
+ Permission.ProjectAdmin,
25
+ Permission.ReadAuditLog,
26
+ ],
27
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
28
+ update: [],
29
+ },
30
+ });
31
+
32
+ const resourceTypeColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
33
+ key: "resourceType",
34
+ title: "Resource Type",
35
+ description:
36
+ "Type of the resource that was changed (e.g. Incident, Monitor).",
37
+ required: true,
38
+ type: TableColumnType.Text,
39
+ accessControl: {
40
+ read: [
41
+ Permission.ProjectOwner,
42
+ Permission.ProjectAdmin,
43
+ Permission.ReadAuditLog,
44
+ ],
45
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
46
+ update: [],
47
+ },
48
+ });
49
+
50
+ const resourceIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
51
+ key: "resourceId",
52
+ title: "Resource ID",
53
+ description: "ID of the resource that was changed.",
54
+ required: true,
55
+ type: TableColumnType.ObjectID,
56
+ accessControl: {
57
+ read: [
58
+ Permission.ProjectOwner,
59
+ Permission.ProjectAdmin,
60
+ Permission.ReadAuditLog,
61
+ ],
62
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
63
+ update: [],
64
+ },
65
+ });
66
+
67
+ const resourceNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
68
+ key: "resourceName",
69
+ title: "Resource Name",
70
+ description: "Display name of the resource at the time of the change.",
71
+ required: false,
72
+ type: TableColumnType.Text,
73
+ accessControl: {
74
+ read: [
75
+ Permission.ProjectOwner,
76
+ Permission.ProjectAdmin,
77
+ Permission.ReadAuditLog,
78
+ ],
79
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
80
+ update: [],
81
+ },
82
+ });
83
+
84
+ const actionColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
85
+ key: "action",
86
+ title: "Action",
87
+ description: "The action performed: Create, Update, or Delete.",
88
+ required: true,
89
+ type: TableColumnType.Text,
90
+ accessControl: {
91
+ read: [
92
+ Permission.ProjectOwner,
93
+ Permission.ProjectAdmin,
94
+ Permission.ReadAuditLog,
95
+ ],
96
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
97
+ update: [],
98
+ },
99
+ });
100
+
101
+ const userIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
102
+ key: "userId",
103
+ title: "User ID",
104
+ description: "ID of the user who performed the action, if any.",
105
+ required: false,
106
+ type: TableColumnType.ObjectID,
107
+ accessControl: {
108
+ read: [
109
+ Permission.ProjectOwner,
110
+ Permission.ProjectAdmin,
111
+ Permission.ReadAuditLog,
112
+ ],
113
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
114
+ update: [],
115
+ },
116
+ });
117
+
118
+ const userNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
119
+ key: "userName",
120
+ title: "User Name",
121
+ description: "Display name of the user at the time of the action.",
122
+ required: false,
123
+ type: TableColumnType.Text,
124
+ accessControl: {
125
+ read: [
126
+ Permission.ProjectOwner,
127
+ Permission.ProjectAdmin,
128
+ Permission.ReadAuditLog,
129
+ ],
130
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
131
+ update: [],
132
+ },
133
+ });
134
+
135
+ const userEmailColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
136
+ key: "userEmail",
137
+ title: "User Email",
138
+ description: "Email of the user at the time of the action.",
139
+ required: false,
140
+ type: TableColumnType.Text,
141
+ accessControl: {
142
+ read: [
143
+ Permission.ProjectOwner,
144
+ Permission.ProjectAdmin,
145
+ Permission.ReadAuditLog,
146
+ ],
147
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
148
+ update: [],
149
+ },
150
+ });
151
+
152
+ const userTypeColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
153
+ key: "userType",
154
+ title: "User Type",
155
+ description:
156
+ "Type of actor: User, API, Automation, MasterAdmin, or System.",
157
+ required: false,
158
+ type: TableColumnType.Text,
159
+ accessControl: {
160
+ read: [
161
+ Permission.ProjectOwner,
162
+ Permission.ProjectAdmin,
163
+ Permission.ReadAuditLog,
164
+ ],
165
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
166
+ update: [],
167
+ },
168
+ });
169
+
170
+ const apiKeyIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
171
+ key: "apiKeyId",
172
+ title: "API Key ID",
173
+ description:
174
+ "ID of the API key used for this action, if performed via API.",
175
+ required: false,
176
+ type: TableColumnType.ObjectID,
177
+ accessControl: {
178
+ read: [
179
+ Permission.ProjectOwner,
180
+ Permission.ProjectAdmin,
181
+ Permission.ReadAuditLog,
182
+ ],
183
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
184
+ update: [],
185
+ },
186
+ });
187
+
188
+ const apiKeyNameColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
189
+ key: "apiKeyName",
190
+ title: "API Key Name",
191
+ description: "Display name of the API key at the time of the action.",
192
+ required: false,
193
+ type: TableColumnType.Text,
194
+ accessControl: {
195
+ read: [
196
+ Permission.ProjectOwner,
197
+ Permission.ProjectAdmin,
198
+ Permission.ReadAuditLog,
199
+ ],
200
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
201
+ update: [],
202
+ },
203
+ });
204
+
205
+ const changesColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
206
+ key: "changes",
207
+ title: "Changes",
208
+ description:
209
+ "Field-level changes for Update actions, or full snapshot for Create/Delete. Redacted fields are omitted.",
210
+ required: true,
211
+ defaultValue: [],
212
+ type: TableColumnType.JSONArray,
213
+ codec: { codec: "ZSTD", level: 3 },
214
+ accessControl: {
215
+ read: [
216
+ Permission.ProjectOwner,
217
+ Permission.ProjectAdmin,
218
+ Permission.ReadAuditLog,
219
+ ],
220
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
221
+ update: [],
222
+ },
223
+ });
224
+
225
+ const retentionDateColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
226
+ key: "retentionDate",
227
+ title: "Retention Date",
228
+ description:
229
+ "Date after which this row is eligible for TTL deletion, computed at ingest time as createdAt + project.auditLogsRetentionInDays.",
230
+ required: true,
231
+ type: TableColumnType.Date,
232
+ defaultValue: undefined,
233
+ });
234
+
235
+ super({
236
+ tableName: AnalyticsTableName.AuditLog,
237
+ tableEngine: AnalyticsTableEngine.MergeTree,
238
+ singularName: "Audit Log",
239
+ pluralName: "Audit Logs",
240
+ accessControl: {
241
+ read: [
242
+ Permission.ProjectOwner,
243
+ Permission.ProjectAdmin,
244
+ Permission.ReadAuditLog,
245
+ ],
246
+ create: [Permission.ProjectOwner, Permission.ProjectAdmin],
247
+ update: [],
248
+ delete: [],
249
+ },
250
+ tableBillingAccessControl: {
251
+ create: PlanType.Enterprise,
252
+ read: PlanType.Enterprise,
253
+ update: PlanType.Enterprise,
254
+ delete: PlanType.Enterprise,
255
+ },
256
+ crudApiPath: new Route("/audit-log"),
257
+ tableColumns: [
258
+ projectIdColumn,
259
+ resourceTypeColumn,
260
+ resourceIdColumn,
261
+ resourceNameColumn,
262
+ actionColumn,
263
+ userIdColumn,
264
+ userNameColumn,
265
+ userEmailColumn,
266
+ userTypeColumn,
267
+ apiKeyIdColumn,
268
+ apiKeyNameColumn,
269
+ changesColumn,
270
+ retentionDateColumn,
271
+ ],
272
+ projections: [],
273
+ sortKeys: ["projectId", "createdAt", "resourceType", "resourceId"],
274
+ primaryKeys: ["projectId", "createdAt"],
275
+ partitionKey: "sipHash64(projectId) % 16",
276
+ ttlExpression: "retentionDate DELETE",
277
+ });
278
+ }
279
+
280
+ public get projectId(): ObjectID | undefined {
281
+ return this.getColumnValue("projectId") as ObjectID | undefined;
282
+ }
283
+ public set projectId(v: ObjectID | undefined) {
284
+ this.setColumnValue("projectId", v);
285
+ }
286
+
287
+ public get resourceType(): string | undefined {
288
+ return this.getColumnValue("resourceType") as string | undefined;
289
+ }
290
+ public set resourceType(v: string | undefined) {
291
+ this.setColumnValue("resourceType", v);
292
+ }
293
+
294
+ public get resourceId(): ObjectID | undefined {
295
+ return this.getColumnValue("resourceId") as ObjectID | undefined;
296
+ }
297
+ public set resourceId(v: ObjectID | undefined) {
298
+ this.setColumnValue("resourceId", v);
299
+ }
300
+
301
+ public get resourceName(): string | undefined {
302
+ return this.getColumnValue("resourceName") as string | undefined;
303
+ }
304
+ public set resourceName(v: string | undefined) {
305
+ this.setColumnValue("resourceName", v);
306
+ }
307
+
308
+ public get action(): string | undefined {
309
+ return this.getColumnValue("action") as string | undefined;
310
+ }
311
+ public set action(v: string | undefined) {
312
+ this.setColumnValue("action", v);
313
+ }
314
+
315
+ public get userId(): ObjectID | undefined {
316
+ return this.getColumnValue("userId") as ObjectID | undefined;
317
+ }
318
+ public set userId(v: ObjectID | undefined) {
319
+ this.setColumnValue("userId", v);
320
+ }
321
+
322
+ public get userName(): string | undefined {
323
+ return this.getColumnValue("userName") as string | undefined;
324
+ }
325
+ public set userName(v: string | undefined) {
326
+ this.setColumnValue("userName", v);
327
+ }
328
+
329
+ public get userEmail(): string | undefined {
330
+ return this.getColumnValue("userEmail") as string | undefined;
331
+ }
332
+ public set userEmail(v: string | undefined) {
333
+ this.setColumnValue("userEmail", v);
334
+ }
335
+
336
+ public get userType(): string | undefined {
337
+ return this.getColumnValue("userType") as string | undefined;
338
+ }
339
+ public set userType(v: string | undefined) {
340
+ this.setColumnValue("userType", v);
341
+ }
342
+
343
+ public get apiKeyId(): ObjectID | undefined {
344
+ return this.getColumnValue("apiKeyId") as ObjectID | undefined;
345
+ }
346
+ public set apiKeyId(v: ObjectID | undefined) {
347
+ this.setColumnValue("apiKeyId", v);
348
+ }
349
+
350
+ public get apiKeyName(): string | undefined {
351
+ return this.getColumnValue("apiKeyName") as string | undefined;
352
+ }
353
+ public set apiKeyName(v: string | undefined) {
354
+ this.setColumnValue("apiKeyName", v);
355
+ }
356
+
357
+ public get changes(): JSONArray | undefined {
358
+ return this.getColumnValue("changes") as JSONArray | undefined;
359
+ }
360
+ public set changes(v: JSONArray | undefined) {
361
+ this.setColumnValue("changes", v);
362
+ }
363
+
364
+ public get retentionDate(): Date | undefined {
365
+ return this.getColumnValue("retentionDate") as Date | undefined;
366
+ }
367
+ public set retentionDate(v: Date | undefined) {
368
+ this.setColumnValue("retentionDate", v);
369
+ }
370
+ }
@@ -18,6 +18,7 @@ import ColumnType from "../../Types/Database/ColumnType";
18
18
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
19
19
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
20
20
  import EnableMCP from "../../Types/Database/EnableMCP";
21
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
21
22
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
22
23
  import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
23
24
  import TableColumn from "../../Types/Database/TableColumn";
@@ -87,6 +88,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
87
88
  update: true,
88
89
  read: true,
89
90
  })
91
+ @EnableAuditLog()
90
92
  @TableMetadata({
91
93
  tableName: "Alert",
92
94
  singularName: "Alert",
@@ -9,6 +9,7 @@ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableB
9
9
  import ColumnLength from "../../Types/Database/ColumnLength";
10
10
  import ColumnType from "../../Types/Database/ColumnType";
11
11
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
12
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
12
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
13
14
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
14
15
  import TableColumn from "../../Types/Database/TableColumn";
@@ -57,6 +58,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
57
58
  Permission.EditProjectApiKey,
58
59
  ],
59
60
  })
61
+ @EnableAuditLog()
60
62
  @TableMetadata({
61
63
  tableName: "ApiKey",
62
64
  singularName: "API Key",
@@ -2,6 +2,7 @@ import EnableRealtimeEventsOn from "../../../Types/Realtime/EnableRealtimeEvents
2
2
  import Route from "../../../Types/API/Route";
3
3
  import { ColumnAccessControl } from "../../../Types/BaseDatabase/AccessControl";
4
4
  import ColumnBillingAccessControl from "../../../Types/BaseDatabase/ColumnBillingAccessControl";
5
+ import EnableAuditLogOn from "../../../Types/BaseDatabase/EnableAuditLogOn";
5
6
  import EnableWorkflowOn from "../../../Types/BaseDatabase/EnableWorkflowOn";
6
7
  import ModelPermission from "../../../Types/BaseDatabase/ModelPermission";
7
8
  import { PlanType } from "../../../Types/Billing/SubscriptionPlan";
@@ -121,6 +122,8 @@ export default class DatabaseBaseModel extends BaseEntity {
121
122
 
122
123
  public enableWorkflowOn!: EnableWorkflowOn;
123
124
 
125
+ public enableAuditLogOn!: EnableAuditLogOn | undefined;
126
+
124
127
  public enableDocumentation!: boolean;
125
128
  public isMasterAdminApiDocs!: boolean;
126
129
 
@@ -502,6 +502,62 @@ export default class GlobalConfig extends GlobalConfigModel {
502
502
  })
503
503
  public metaWhatsAppWebhookVerifyToken?: string = undefined;
504
504
 
505
+ @ColumnAccessControl({
506
+ create: [],
507
+ read: [],
508
+ update: [],
509
+ })
510
+ @TableColumn({
511
+ type: TableColumnType.VeryLongText,
512
+ title: "Telegram Bot Token",
513
+ description:
514
+ "Bot token issued by @BotFather for sending Telegram messages.",
515
+ })
516
+ @Column({
517
+ type: ColumnType.VeryLongText,
518
+ nullable: true,
519
+ unique: true,
520
+ })
521
+ public telegramBotToken?: string = undefined;
522
+
523
+ @ColumnAccessControl({
524
+ create: [],
525
+ read: [],
526
+ update: [],
527
+ })
528
+ @TableColumn({
529
+ type: TableColumnType.ShortText,
530
+ title: "Telegram Bot Username",
531
+ description:
532
+ "Username of your OneUptime Telegram bot (without the leading @). Used to build verification deep links.",
533
+ })
534
+ @Column({
535
+ type: ColumnType.ShortText,
536
+ length: ColumnLength.ShortText,
537
+ nullable: true,
538
+ unique: true,
539
+ })
540
+ public telegramBotUsername?: string = undefined;
541
+
542
+ @ColumnAccessControl({
543
+ create: [],
544
+ read: [],
545
+ update: [],
546
+ })
547
+ @TableColumn({
548
+ type: TableColumnType.ShortText,
549
+ title: "Telegram Webhook Secret Token",
550
+ description:
551
+ "Secret token passed to Telegram setWebhook. Telegram sends it back in the X-Telegram-Bot-Api-Secret-Token header.",
552
+ })
553
+ @Column({
554
+ type: ColumnType.ShortText,
555
+ length: ColumnLength.ShortText,
556
+ nullable: true,
557
+ unique: true,
558
+ })
559
+ public telegramWebhookSecretToken?: string = undefined;
560
+
505
561
  @ColumnAccessControl({
506
562
  create: [],
507
563
  read: [],
@@ -19,6 +19,7 @@ import ColumnType from "../../Types/Database/ColumnType";
19
19
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
20
20
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
21
21
  import EnableMCP from "../../Types/Database/EnableMCP";
22
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
22
23
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
23
24
  import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
24
25
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
@@ -91,6 +92,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
91
92
  update: true,
92
93
  read: true,
93
94
  })
95
+ @EnableAuditLog()
94
96
  @TableMetadata({
95
97
  tableName: "Incident",
96
98
  singularName: "Incident",
@@ -140,6 +140,7 @@ import ShortLink from "./ShortLink";
140
140
  // SMS
141
141
  import SmsLog from "./SmsLog";
142
142
  import WhatsAppLog from "./WhatsAppLog";
143
+ import TelegramLog from "./TelegramLog";
143
144
  import PushNotificationLog from "./PushNotificationLog";
144
145
  import WorkspaceNotificationLog from "./WorkspaceNotificationLog";
145
146
  // Status Page
@@ -176,6 +177,7 @@ import UserCall from "./UserCall";
176
177
  import UserEmail from "./UserEmail";
177
178
  import UserPush from "./UserPush";
178
179
  import UserWhatsApp from "./UserWhatsApp";
180
+ import UserTelegram from "./UserTelegram";
179
181
  // User Notification Rules
180
182
  import UserNotificationRule from "./UserNotificationRule";
181
183
  import UserNotificationSetting from "./UserNotificationSetting";
@@ -414,6 +416,7 @@ const AllModelTypes: Array<{
414
416
 
415
417
  SmsLog,
416
418
  WhatsAppLog,
419
+ TelegramLog,
417
420
  PushNotificationLog,
418
421
  WorkspaceNotificationLog,
419
422
  CallLog,
@@ -424,6 +427,7 @@ const AllModelTypes: Array<{
424
427
  UserCall,
425
428
  UserPush,
426
429
  UserWhatsApp,
430
+ UserTelegram,
427
431
  UserIncomingCallNumber,
428
432
 
429
433
  UserNotificationRule,
@@ -11,6 +11,7 @@ import ColumnLength from "../../Types/Database/ColumnLength";
11
11
  import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
14
15
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
16
  import ColorField from "../../Types/Database/ColorField";
16
17
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
@@ -64,6 +65,7 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
64
65
  update: true,
65
66
  read: true,
66
67
  })
68
+ @EnableAuditLog()
67
69
  @CrudApiEndpoint(new Route("/label"))
68
70
  @SlugifyColumn("name", "slug")
69
71
  @TableMetadata({
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableMCP from "../../Types/Database/EnableMCP";
15
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
15
16
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
16
17
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
17
18
  import TableColumn from "../../Types/Database/TableColumn";
@@ -80,6 +81,7 @@ import NotificationRuleWorkspaceChannel from "../../Types/Workspace/Notification
80
81
  update: true,
81
82
  read: true,
82
83
  })
84
+ @EnableAuditLog()
83
85
  @CrudApiEndpoint(new Route("/monitor"))
84
86
  @SlugifyColumn("name", "slug")
85
87
  @Entity({
@@ -30,6 +30,7 @@ import {
30
30
  ManyToOne,
31
31
  } from "typeorm";
32
32
  import NotificationRuleWorkspaceChannel from "../../Types/Workspace/NotificationRules/NotificationRuleWorkspaceChannel";
33
+ import EnableAuditLog from "../../Types/Database/EnableAuditLog";
33
34
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
34
35
 
35
36
  @EnableDocumentation()
@@ -42,6 +43,7 @@ import EnableWorkflow from "../../Types/Database/EnableWorkflow";
42
43
  update: true,
43
44
  read: true,
44
45
  })
46
+ @EnableAuditLog()
45
47
  @TableAccessControl({
46
48
  create: [
47
49
  Permission.ProjectOwner,