@oneuptime/common 10.0.66 → 10.0.67

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 (79) hide show
  1. package/Models/DatabaseModels/GlobalConfig.ts +56 -0
  2. package/Models/DatabaseModels/Index.ts +4 -0
  3. package/Models/DatabaseModels/Project.ts +30 -0
  4. package/Models/DatabaseModels/TelegramLog.ts +1025 -0
  5. package/Models/DatabaseModels/UserNotificationRule.ts +49 -0
  6. package/Models/DatabaseModels/UserNotificationSetting.ts +17 -0
  7. package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
  8. package/Models/DatabaseModels/UserTelegram.ts +312 -0
  9. package/Server/API/UserTelegramAPI.ts +167 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.ts +325 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  12. package/Server/Services/Index.ts +6 -0
  13. package/Server/Services/TelegramLogService.ts +15 -0
  14. package/Server/Services/TelegramService.ts +139 -0
  15. package/Server/Services/UserNotificationRuleService.ts +350 -1
  16. package/Server/Services/UserNotificationSettingService.ts +114 -0
  17. package/Server/Services/UserTelegramService.ts +140 -0
  18. package/Server/Utils/Monitor/MonitorResource.ts +29 -15
  19. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +29 -16
  20. package/Tests/Types/Date.test.ts +158 -0
  21. package/Types/Date.ts +12 -3
  22. package/Types/Icon/IconProp.ts +1 -0
  23. package/Types/Permission.ts +11 -0
  24. package/Types/Telegram/TelegramMessage.ts +9 -0
  25. package/Types/TelegramStatus.ts +14 -0
  26. package/UI/Components/Icon/Icon.tsx +15 -0
  27. package/build/dist/Models/DatabaseModels/GlobalConfig.js +59 -0
  28. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  29. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  30. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  31. package/build/dist/Models/DatabaseModels/Project.js +32 -0
  32. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  33. package/build/dist/Models/DatabaseModels/TelegramLog.js +1056 -0
  34. package/build/dist/Models/DatabaseModels/TelegramLog.js.map +1 -0
  35. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +49 -0
  36. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  37. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +19 -0
  38. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
  39. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
  40. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
  41. package/build/dist/Models/DatabaseModels/UserTelegram.js +331 -0
  42. package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -0
  43. package/build/dist/Server/API/UserTelegramAPI.js +99 -0
  44. package/build/dist/Server/API/UserTelegramAPI.js.map +1 -0
  45. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js +116 -0
  46. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js.map +1 -0
  47. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  48. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  49. package/build/dist/Server/Services/Index.js +6 -0
  50. package/build/dist/Server/Services/Index.js.map +1 -1
  51. package/build/dist/Server/Services/TelegramLogService.js +13 -0
  52. package/build/dist/Server/Services/TelegramLogService.js.map +1 -0
  53. package/build/dist/Server/Services/TelegramService.js +100 -0
  54. package/build/dist/Server/Services/TelegramService.js.map +1 -0
  55. package/build/dist/Server/Services/UserNotificationRuleService.js +272 -21
  56. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  57. package/build/dist/Server/Services/UserNotificationSettingService.js +94 -0
  58. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  59. package/build/dist/Server/Services/UserTelegramService.js +133 -0
  60. package/build/dist/Server/Services/UserTelegramService.js.map +1 -0
  61. package/build/dist/Server/Utils/Monitor/MonitorResource.js +25 -12
  62. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  63. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +24 -12
  64. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  65. package/build/dist/Tests/Types/Date.test.js +96 -0
  66. package/build/dist/Tests/Types/Date.test.js.map +1 -1
  67. package/build/dist/Types/Date.js +9 -3
  68. package/build/dist/Types/Date.js.map +1 -1
  69. package/build/dist/Types/Icon/IconProp.js +1 -0
  70. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  71. package/build/dist/Types/Permission.js +10 -0
  72. package/build/dist/Types/Permission.js.map +1 -1
  73. package/build/dist/Types/Telegram/TelegramMessage.js +2 -0
  74. package/build/dist/Types/Telegram/TelegramMessage.js.map +1 -0
  75. package/build/dist/Types/TelegramStatus.js +15 -0
  76. package/build/dist/Types/TelegramStatus.js.map +1 -0
  77. package/build/dist/UI/Components/Icon/Icon.js +5 -0
  78. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  79. package/package.json +2 -2
@@ -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: [],
@@ -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,
@@ -1146,6 +1146,36 @@ export default class Project extends TenantModel {
1146
1146
  })
1147
1147
  public enableWhatsAppNotifications?: boolean = undefined;
1148
1148
 
1149
+ @ColumnAccessControl({
1150
+ create: [],
1151
+ read: [
1152
+ Permission.ProjectOwner,
1153
+ Permission.ProjectAdmin,
1154
+ Permission.ProjectMember,
1155
+ Permission.Viewer,
1156
+ Permission.ReadProject,
1157
+ Permission.UnAuthorizedSsoUser,
1158
+ Permission.ProjectUser,
1159
+ Permission.ReadAllProjectResources,
1160
+ ],
1161
+ update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
1162
+ })
1163
+ @TableColumn({
1164
+ required: true,
1165
+ isDefaultValueColumn: true,
1166
+ type: TableColumnType.Boolean,
1167
+ title: "Enable Telegram Notifications",
1168
+ description: "Enable Telegram notifications for this project.",
1169
+ defaultValue: false,
1170
+ example: false,
1171
+ })
1172
+ @Column({
1173
+ nullable: false,
1174
+ default: false,
1175
+ type: ColumnType.Boolean,
1176
+ })
1177
+ public enableTelegramNotifications?: boolean = undefined;
1178
+
1149
1179
  @ColumnAccessControl({
1150
1180
  create: [],
1151
1181
  read: [