@oneuptime/common 8.0.5311 → 8.0.5326

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 (124) hide show
  1. package/Models/DatabaseModels/GlobalConfig.ts +90 -0
  2. package/Models/DatabaseModels/Index.ts +4 -0
  3. package/Models/DatabaseModels/Project.ts +27 -0
  4. package/Models/DatabaseModels/UserNotificationRule.ts +48 -0
  5. package/Models/DatabaseModels/UserNotificationSetting.ts +16 -0
  6. package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
  7. package/Models/DatabaseModels/UserWhatsApp.ts +288 -0
  8. package/Models/DatabaseModels/WhatsAppLog.ts +884 -0
  9. package/Server/API/NotificationAPI.ts +4 -4
  10. package/Server/API/ProjectSSO.ts +41 -33
  11. package/Server/API/ShortLinkAPI.ts +33 -25
  12. package/Server/API/UserCallAPI.ts +82 -73
  13. package/Server/API/UserEmailAPI.ts +82 -73
  14. package/Server/API/UserOnCallLogTimelineAPI.ts +227 -214
  15. package/Server/API/UserPushAPI.ts +177 -169
  16. package/Server/API/UserSmsAPI.ts +82 -73
  17. package/Server/API/UserWhatsAppAPI.ts +136 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.ts +105 -0
  19. package/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.ts +71 -0
  20. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  21. package/Server/Services/Index.ts +4 -0
  22. package/Server/Services/MonitorService.ts +32 -4
  23. package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +36 -4
  24. package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +34 -4
  25. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +34 -4
  26. package/Server/Services/OnCallDutyPolicyScheduleService.ts +47 -6
  27. package/Server/Services/ProbeService.ts +17 -2
  28. package/Server/Services/UserNotificationRuleService.ts +258 -7
  29. package/Server/Services/UserNotificationSettingService.ts +60 -0
  30. package/Server/Services/UserWhatsAppService.ts +203 -0
  31. package/Server/Services/WhatsAppLogService.ts +15 -0
  32. package/Server/Services/WhatsAppService.ts +141 -0
  33. package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +17 -5
  34. package/Server/Types/Workflow/Components/Webhook.ts +2 -2
  35. package/Server/Utils/StartServer.ts +57 -31
  36. package/Server/Utils/WhatsAppTemplateUtil.ts +247 -0
  37. package/Types/Icon/IconProp.ts +1 -0
  38. package/Types/WhatsApp/WhatsAppMessage.ts +12 -0
  39. package/Types/WhatsApp/WhatsAppTemplates.ts +197 -0
  40. package/Types/WhatsAppStatus.ts +8 -0
  41. package/UI/Components/Icon/Icon.tsx +12 -0
  42. package/build/dist/Models/DatabaseModels/GlobalConfig.js +98 -0
  43. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  44. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  45. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  46. package/build/dist/Models/DatabaseModels/Project.js +29 -0
  47. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  48. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +48 -0
  49. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  50. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +18 -0
  51. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
  52. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
  53. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
  54. package/build/dist/Models/DatabaseModels/UserWhatsApp.js +308 -0
  55. package/build/dist/Models/DatabaseModels/UserWhatsApp.js.map +1 -0
  56. package/build/dist/Models/DatabaseModels/WhatsAppLog.js +911 -0
  57. package/build/dist/Models/DatabaseModels/WhatsAppLog.js.map +1 -0
  58. package/build/dist/Server/API/NotificationAPI.js +2 -2
  59. package/build/dist/Server/API/NotificationAPI.js.map +1 -1
  60. package/build/dist/Server/API/ProjectSSO.js +26 -21
  61. package/build/dist/Server/API/ProjectSSO.js.map +1 -1
  62. package/build/dist/Server/API/ShortLinkAPI.js +17 -12
  63. package/build/dist/Server/API/ShortLinkAPI.js.map +1 -1
  64. package/build/dist/Server/API/UserCallAPI.js +54 -44
  65. package/build/dist/Server/API/UserCallAPI.js.map +1 -1
  66. package/build/dist/Server/API/UserEmailAPI.js +54 -44
  67. package/build/dist/Server/API/UserEmailAPI.js.map +1 -1
  68. package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +142 -127
  69. package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
  70. package/build/dist/Server/API/UserPushAPI.js +111 -96
  71. package/build/dist/Server/API/UserPushAPI.js.map +1 -1
  72. package/build/dist/Server/API/UserSmsAPI.js +54 -44
  73. package/build/dist/Server/API/UserSmsAPI.js.map +1 -1
  74. package/build/dist/Server/API/UserWhatsAppAPI.js +76 -0
  75. package/build/dist/Server/API/UserWhatsAppAPI.js.map +1 -0
  76. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.js +42 -0
  77. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759838763506-MigrationName.js.map +1 -0
  78. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.js +30 -0
  79. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759839342566-MigrationName.js.map +1 -0
  80. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  81. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  82. package/build/dist/Server/Services/Index.js +4 -0
  83. package/build/dist/Server/Services/Index.js.map +1 -1
  84. package/build/dist/Server/Services/MonitorService.js +23 -2
  85. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  86. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +29 -6
  87. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
  88. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +27 -6
  89. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
  90. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +26 -5
  91. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  92. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +34 -3
  93. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  94. package/build/dist/Server/Services/ProbeService.js +12 -1
  95. package/build/dist/Server/Services/ProbeService.js.map +1 -1
  96. package/build/dist/Server/Services/UserNotificationRuleService.js +196 -19
  97. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  98. package/build/dist/Server/Services/UserNotificationSettingService.js +45 -0
  99. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  100. package/build/dist/Server/Services/UserWhatsAppService.js +179 -0
  101. package/build/dist/Server/Services/UserWhatsAppService.js.map +1 -0
  102. package/build/dist/Server/Services/WhatsAppLogService.js +13 -0
  103. package/build/dist/Server/Services/WhatsAppLogService.js.map +1 -0
  104. package/build/dist/Server/Services/WhatsAppService.js +103 -0
  105. package/build/dist/Server/Services/WhatsAppService.js.map +1 -0
  106. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +14 -4
  107. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
  108. package/build/dist/Server/Types/Workflow/Components/Webhook.js +2 -2
  109. package/build/dist/Server/Types/Workflow/Components/Webhook.js.map +1 -1
  110. package/build/dist/Server/Utils/StartServer.js +41 -19
  111. package/build/dist/Server/Utils/StartServer.js.map +1 -1
  112. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +124 -0
  113. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -0
  114. package/build/dist/Types/Icon/IconProp.js +1 -0
  115. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  116. package/build/dist/Types/WhatsApp/WhatsAppMessage.js +2 -0
  117. package/build/dist/Types/WhatsApp/WhatsAppMessage.js.map +1 -0
  118. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +118 -0
  119. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -0
  120. package/build/dist/Types/WhatsAppStatus.js +9 -0
  121. package/build/dist/Types/WhatsAppStatus.js.map +1 -0
  122. package/build/dist/UI/Components/Icon/Icon.js +6 -0
  123. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  124. package/package.json +1 -1
@@ -16,45 +16,50 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI {
16
16
  var _a, _b, _c;
17
17
  super(UserOnCallLogTimeline, UserOnCallLogTimelineService);
18
18
  this.router.post(`${(_a = new this.entityType()
19
- .getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/call/gather-input/:itemId`, NotificationMiddleware.isValidCallNotificationRequest, async (req, res) => {
20
- req = req;
21
- if (!req.params["itemId"]) {
22
- return Response.sendErrorResponse(req, res, new BadDataException("Invalid item ID"));
23
- }
24
- const token = req.callTokenData;
25
- const itemId = new ObjectID(req.params["itemId"]);
26
- const timelineItem = await this.service.findOneById({
27
- id: itemId,
28
- select: {
29
- _id: true,
30
- projectId: true,
31
- triggeredByIncidentId: true,
32
- triggeredByAlertId: true,
33
- },
34
- props: {
35
- isRoot: true,
36
- },
37
- });
38
- if (!timelineItem) {
39
- return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
40
- }
41
- // check digits.
42
- if (req.body["Digits"] === "1") {
43
- // then ack incident
44
- await this.service.updateOneById({
19
+ .getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/call/gather-input/:itemId`, NotificationMiddleware.isValidCallNotificationRequest, async (req, res, next) => {
20
+ try {
21
+ req = req;
22
+ if (!req.params["itemId"]) {
23
+ return Response.sendErrorResponse(req, res, new BadDataException("Invalid item ID"));
24
+ }
25
+ const token = req.callTokenData;
26
+ const itemId = new ObjectID(req.params["itemId"]);
27
+ const timelineItem = await this.service.findOneById({
45
28
  id: itemId,
46
- data: {
47
- acknowledgedAt: OneUptimeDate.getCurrentDate(),
48
- isAcknowledged: true,
49
- status: UserNotificationStatus.Acknowledged,
50
- statusMessage: "Notification Acknowledged",
29
+ select: {
30
+ _id: true,
31
+ projectId: true,
32
+ triggeredByIncidentId: true,
33
+ triggeredByAlertId: true,
51
34
  },
52
35
  props: {
53
36
  isRoot: true,
54
37
  },
55
38
  });
39
+ if (!timelineItem) {
40
+ return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
41
+ }
42
+ // check digits.
43
+ if (req.body["Digits"] === "1") {
44
+ // then ack incident
45
+ await this.service.updateOneById({
46
+ id: itemId,
47
+ data: {
48
+ acknowledgedAt: OneUptimeDate.getCurrentDate(),
49
+ isAcknowledged: true,
50
+ status: UserNotificationStatus.Acknowledged,
51
+ statusMessage: "Notification Acknowledged",
52
+ },
53
+ props: {
54
+ isRoot: true,
55
+ },
56
+ });
57
+ }
58
+ return NotificationMiddleware.sendResponse(req, res, token);
59
+ }
60
+ catch (error) {
61
+ return next(error);
56
62
  }
57
- return NotificationMiddleware.sendResponse(req, res, token);
58
63
  });
59
64
  /*
60
65
  * We have this ack page to show the user a confirmation page before acknowledging the notification.
@@ -62,114 +67,124 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI {
62
67
  * so we need to create this page for the user to confirm that they want to acknowledge the notification.
63
68
  */
64
69
  this.router.get(`${(_b = new this.entityType()
65
- .getCrudApiPath()) === null || _b === void 0 ? void 0 : _b.toString()}/acknowledge-page/:itemId`, async (req, res) => {
70
+ .getCrudApiPath()) === null || _b === void 0 ? void 0 : _b.toString()}/acknowledge-page/:itemId`, async (req, res, next) => {
66
71
  var _a, _b;
67
- req = req;
68
- if (!req.params["itemId"]) {
69
- return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
70
- }
71
- const itemId = new ObjectID(req.params["itemId"]);
72
- const timelineItem = await this.service.findOneById({
73
- id: itemId,
74
- select: {
75
- _id: true,
76
- projectId: true,
77
- triggeredByIncidentId: true,
78
- triggeredByIncident: {
79
- title: true,
80
- description: true,
72
+ try {
73
+ req = req;
74
+ if (!req.params["itemId"]) {
75
+ return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
76
+ }
77
+ const itemId = new ObjectID(req.params["itemId"]);
78
+ const timelineItem = await this.service.findOneById({
79
+ id: itemId,
80
+ select: {
81
+ _id: true,
82
+ projectId: true,
83
+ triggeredByIncidentId: true,
84
+ triggeredByIncident: {
85
+ title: true,
86
+ description: true,
87
+ },
88
+ triggeredByAlertId: true,
89
+ triggeredByAlert: {
90
+ title: true,
91
+ description: true,
92
+ },
81
93
  },
82
- triggeredByAlertId: true,
83
- triggeredByAlert: {
84
- title: true,
85
- description: true,
94
+ props: {
95
+ isRoot: true,
86
96
  },
87
- },
88
- props: {
89
- isRoot: true,
90
- },
91
- });
92
- if (!timelineItem) {
93
- return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
97
+ });
98
+ if (!timelineItem) {
99
+ return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
100
+ }
101
+ const notificationType = timelineItem.triggeredByIncidentId
102
+ ? "Incident"
103
+ : "Alert";
104
+ const host = await DatabaseConfig.getHost();
105
+ const httpProtocol = await DatabaseConfig.getHttpProtocol();
106
+ return Response.render(req, res, "/usr/src/Common/Server/Views/AcknowledgeUserOnCallNotification.ejs", {
107
+ title: `Acknowledge ${notificationType} - ${((_a = timelineItem.triggeredByIncident) === null || _a === void 0 ? void 0 : _a.title) || ((_b = timelineItem.triggeredByAlert) === null || _b === void 0 ? void 0 : _b.title)}`,
108
+ message: `Do you want to acknowledge this ${notificationType}?`,
109
+ acknowledgeText: `Acknowledge ${notificationType}`,
110
+ acknowledgeUrl: new URL(httpProtocol, host, new Route(AppApiRoute.toString())
111
+ .addRoute(new UserOnCallLogTimeline().crudApiPath)
112
+ .addRoute("/acknowledge/" + itemId.toString())).toString(),
113
+ });
114
+ }
115
+ catch (error) {
116
+ return next(error);
94
117
  }
95
- const notificationType = timelineItem.triggeredByIncidentId
96
- ? "Incident"
97
- : "Alert";
98
- const host = await DatabaseConfig.getHost();
99
- const httpProtocol = await DatabaseConfig.getHttpProtocol();
100
- return Response.render(req, res, "/usr/src/Common/Server/Views/AcknowledgeUserOnCallNotification.ejs", {
101
- title: `Acknowledge ${notificationType} - ${((_a = timelineItem.triggeredByIncident) === null || _a === void 0 ? void 0 : _a.title) || ((_b = timelineItem.triggeredByAlert) === null || _b === void 0 ? void 0 : _b.title)}`,
102
- message: `Do you want to acknowledge this ${notificationType}?`,
103
- acknowledgeText: `Acknowledge ${notificationType}`,
104
- acknowledgeUrl: new URL(httpProtocol, host, new Route(AppApiRoute.toString())
105
- .addRoute(new UserOnCallLogTimeline().crudApiPath)
106
- .addRoute("/acknowledge/" + itemId.toString())).toString(),
107
- });
108
118
  });
109
119
  // This is the link that actually acknowledges the notification.
110
120
  this.router.get(`${(_c = new this.entityType()
111
- .getCrudApiPath()) === null || _c === void 0 ? void 0 : _c.toString()}/acknowledge/:itemId`, async (req, res) => {
121
+ .getCrudApiPath()) === null || _c === void 0 ? void 0 : _c.toString()}/acknowledge/:itemId`, async (req, res, next) => {
112
122
  var _a, _b, _c, _d, _e;
113
- req = req;
114
- if (!req.params["itemId"]) {
115
- return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
116
- }
117
- const itemId = new ObjectID(req.params["itemId"]);
118
- const timelineItem = await this.service.findOneById({
119
- id: itemId,
120
- select: {
121
- _id: true,
122
- projectId: true,
123
- triggeredByIncidentId: true,
124
- triggeredByAlertId: true,
125
- triggeredByAlert: {
126
- title: true,
123
+ try {
124
+ req = req;
125
+ if (!req.params["itemId"]) {
126
+ return Response.sendErrorResponse(req, res, new BadDataException("Item ID is required"));
127
+ }
128
+ const itemId = new ObjectID(req.params["itemId"]);
129
+ const timelineItem = await this.service.findOneById({
130
+ id: itemId,
131
+ select: {
132
+ _id: true,
133
+ projectId: true,
134
+ triggeredByIncidentId: true,
135
+ triggeredByAlertId: true,
136
+ triggeredByAlert: {
137
+ title: true,
138
+ },
139
+ triggeredByIncident: {
140
+ title: true,
141
+ },
142
+ acknowledgedAt: true,
143
+ isAcknowledged: true,
127
144
  },
128
- triggeredByIncident: {
129
- title: true,
145
+ props: {
146
+ isRoot: true,
130
147
  },
131
- acknowledgedAt: true,
132
- isAcknowledged: true,
133
- },
134
- props: {
135
- isRoot: true,
136
- },
137
- });
138
- if (!timelineItem) {
139
- return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
140
- }
141
- const host = await DatabaseConfig.getHost();
142
- const httpProtocol = await DatabaseConfig.getHttpProtocol();
143
- if (timelineItem.isAcknowledged) {
144
- // already acknowledged. Then show already acknowledged page with view details button.
145
- const viewDetailsUrl = new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_a = timelineItem.projectId) === null || _a === void 0 ? void 0 : _a.toString()}/${timelineItem.triggeredByIncidentId ? "incidents" : "alerts"}/${timelineItem.triggeredByIncidentId ? timelineItem.triggeredByIncidentId.toString() : timelineItem.triggeredByAlertId.toString()}`));
146
- return Response.render(req, res, "/usr/src/Common/Server/Views/ViewMessage.ejs", {
147
- title: `Notification Already Acknowledged - ${((_b = timelineItem.triggeredByIncident) === null || _b === void 0 ? void 0 : _b.title) || ((_c = timelineItem.triggeredByAlert) === null || _c === void 0 ? void 0 : _c.title)}`,
148
- message: `This notification has already been acknowledged.`,
149
- viewDetailsText: `View ${timelineItem.triggeredByIncidentId ? "Incident" : "Alert"}`,
150
- viewDetailsUrl: viewDetailsUrl.toString(),
151
148
  });
149
+ if (!timelineItem) {
150
+ return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
151
+ }
152
+ const host = await DatabaseConfig.getHost();
153
+ const httpProtocol = await DatabaseConfig.getHttpProtocol();
154
+ if (timelineItem.isAcknowledged) {
155
+ // already acknowledged. Then show already acknowledged page with view details button.
156
+ const viewDetailsUrl = new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_a = timelineItem.projectId) === null || _a === void 0 ? void 0 : _a.toString()}/${timelineItem.triggeredByIncidentId ? "incidents" : "alerts"}/${timelineItem.triggeredByIncidentId ? timelineItem.triggeredByIncidentId.toString() : timelineItem.triggeredByAlertId.toString()}`));
157
+ return Response.render(req, res, "/usr/src/Common/Server/Views/ViewMessage.ejs", {
158
+ title: `Notification Already Acknowledged - ${((_b = timelineItem.triggeredByIncident) === null || _b === void 0 ? void 0 : _b.title) || ((_c = timelineItem.triggeredByAlert) === null || _c === void 0 ? void 0 : _c.title)}`,
159
+ message: `This notification has already been acknowledged.`,
160
+ viewDetailsText: `View ${timelineItem.triggeredByIncidentId ? "Incident" : "Alert"}`,
161
+ viewDetailsUrl: viewDetailsUrl.toString(),
162
+ });
163
+ }
164
+ await this.service.updateOneById({
165
+ id: itemId,
166
+ data: {
167
+ acknowledgedAt: OneUptimeDate.getCurrentDate(),
168
+ isAcknowledged: true,
169
+ status: UserNotificationStatus.Acknowledged,
170
+ statusMessage: "Notification Acknowledged",
171
+ },
172
+ props: {
173
+ isRoot: true,
174
+ },
175
+ });
176
+ // redirect to dashboard to incidents page.
177
+ if (timelineItem.triggeredByIncidentId) {
178
+ return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_d = timelineItem.projectId) === null || _d === void 0 ? void 0 : _d.toString()}/incidents/${timelineItem.triggeredByIncidentId.toString()}`)));
179
+ }
180
+ if (timelineItem.triggeredByAlertId) {
181
+ return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_e = timelineItem.projectId) === null || _e === void 0 ? void 0 : _e.toString()}/alerts/${timelineItem.triggeredByAlertId.toString()}`)));
182
+ }
183
+ return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
152
184
  }
153
- await this.service.updateOneById({
154
- id: itemId,
155
- data: {
156
- acknowledgedAt: OneUptimeDate.getCurrentDate(),
157
- isAcknowledged: true,
158
- status: UserNotificationStatus.Acknowledged,
159
- statusMessage: "Notification Acknowledged",
160
- },
161
- props: {
162
- isRoot: true,
163
- },
164
- });
165
- // redirect to dashboard to incidents page.
166
- if (timelineItem.triggeredByIncidentId) {
167
- return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_d = timelineItem.projectId) === null || _d === void 0 ? void 0 : _d.toString()}/incidents/${timelineItem.triggeredByIncidentId.toString()}`)));
168
- }
169
- if (timelineItem.triggeredByAlertId) {
170
- return Response.redirect(req, res, new URL(httpProtocol, host, DashboardRoute.addRoute(`/${(_e = timelineItem.projectId) === null || _e === void 0 ? void 0 : _e.toString()}/alerts/${timelineItem.triggeredByAlertId.toString()}`)));
185
+ catch (error) {
186
+ return next(error);
171
187
  }
172
- return Response.sendErrorResponse(req, res, new BadDataException("Invalid item Id"));
173
188
  });
174
189
  }
175
190
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserOnCallLogTimelineAPI.js","sourceRoot":"","sources":["../../../../Server/API/UserOnCallLogTimelineAPI.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,sBAAsB,MAAM,sCAAsC,CAAC;AAC1E,OAAO,4BAEN,MAAM,0CAA0C,CAAC;AAMlD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,GAAG,MAAM,qBAAqB,CAAC;AACtC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AAEtE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,sBAAsB,MAAM,qDAAqD,CAAC;AACzF,OAAO,qBAAqB,MAA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AAM;oBACV,IAAI,EAAE;wBACJ,cAAc,EAAE,aAAa,CAAC,cAAc,EAAE;wBAC9C,cAAc,EAAE,IAAI;wBACpB,MAAM,EAAE,sBAAsB,CAAC,YAAY;wBAC3C,aAAa,EAAE,2BAA2B;qBAC3C;oBACD,KAAK,EAAE;wBACL,MAAM,EAAE,IAAI;qBACb;iBACF,CAAC,CAAC;gBAEH,2CAA2C;gBAE3C,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;oBACvC,OAAO,QAAQ,CAAC,QAAQ,CACtB,GAAG,EACH,GAAG,EACH,IAAI,GAAG,CACL,YAAY,EACZ,IAAI,EACJ,cAAc,CAAC,QAAQ,CACrB,IAAI,MAAA,YAAY,CAAC,SAAS,0CAAE,QAAQ,EAAE,cAAc,YAAY,CAAC,qBAAsB,CAAC,QAAQ,EAAE,EAAE,CACrG,CACF,CACF,CAAC;gBACJ,CAAC;gBAED,IAAI,YAAY,CAAC,kBAAkB,EAAE,CAAC;oBACpC,OAAO,QAAQ,CAAC,QAAQ,CACtB,GAAG,EACH,GAAG,EACH,IAAI,GAAG,CACL,YAAY,EACZ,IAAI,EACJ,cAAc,CAAC,QAAQ,CACrB,IAAI,MAAA,YAAY,CAAC,SAAS,0CAAE,QAAQ,EAAE,WAAW,YAAY,CAAC,kBAAmB,CAAC,QAAQ,EAAE,EAAE,CAC/F,CACF,CACF,CAAC;gBACJ,CAAC;gBAED,OAAO,QAAQ,CAAC,iBAAiB,CAC/B,GAAG,EACH,GAAG,EACH,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CACxC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -63,120 +63,135 @@ export default class UserPushAPI extends BaseAPI {
63
63
  next(error);
64
64
  }
65
65
  });
66
- this.router.post(`/user-push/:deviceId/test-notification`, UserMiddleware.getUserMiddleware, async (req, res) => {
66
+ this.router.post(`/user-push/:deviceId/test-notification`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
67
67
  var _a;
68
- req = req;
69
- if (!req.params["deviceId"]) {
70
- return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
71
- }
72
- // Get the device
73
- const device = await this.service.findOneById({
74
- id: new ObjectID(req.params["deviceId"]),
75
- props: {
76
- isRoot: true,
77
- },
78
- select: {
79
- userId: true,
80
- deviceName: true,
81
- deviceToken: true,
82
- deviceType: true,
83
- isVerified: true,
84
- projectId: true,
85
- },
86
- });
87
- if (!device) {
88
- return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
89
- }
90
- // Check if the device belongs to the current user
91
- if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
92
- req.userAuthorization.userId.toString()) {
93
- return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
94
- }
95
- if (!device.isVerified) {
96
- return Response.sendErrorResponse(req, res, new BadDataException("Device is not verified"));
97
- }
98
68
  try {
99
- // Send test notification
100
- const testMessage = PushNotificationUtil.createGenericNotification({
101
- title: "Test Notification from OneUptime",
102
- body: "This is a test notification to verify your device is working correctly.",
103
- clickAction: "/dashboard",
104
- tag: "test-notification",
105
- requireInteraction: false,
106
- });
107
- await PushNotificationService.sendPushNotification({
108
- devices: [
109
- Object.assign({ token: device.deviceToken }, (device.deviceName && {
110
- name: device.deviceName,
111
- })),
112
- ],
113
- message: testMessage,
114
- deviceType: device.deviceType,
115
- }, {
116
- isSensitive: false,
117
- projectId: device.projectId,
118
- userId: device.userId,
69
+ req = req;
70
+ if (!req.params["deviceId"]) {
71
+ return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
72
+ }
73
+ // Get the device
74
+ const device = await this.service.findOneById({
75
+ id: new ObjectID(req.params["deviceId"]),
76
+ props: {
77
+ isRoot: true,
78
+ },
79
+ select: {
80
+ userId: true,
81
+ deviceName: true,
82
+ deviceToken: true,
83
+ deviceType: true,
84
+ isVerified: true,
85
+ projectId: true,
86
+ },
119
87
  });
88
+ if (!device) {
89
+ return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
90
+ }
91
+ // Check if the device belongs to the current user
92
+ if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
93
+ req.userAuthorization.userId.toString()) {
94
+ return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
95
+ }
96
+ if (!device.isVerified) {
97
+ return Response.sendErrorResponse(req, res, new BadDataException("Device is not verified"));
98
+ }
99
+ try {
100
+ // Send test notification
101
+ const testMessage = PushNotificationUtil.createGenericNotification({
102
+ title: "Test Notification from OneUptime",
103
+ body: "This is a test notification to verify your device is working correctly.",
104
+ clickAction: "/dashboard",
105
+ tag: "test-notification",
106
+ requireInteraction: false,
107
+ });
108
+ await PushNotificationService.sendPushNotification({
109
+ devices: [
110
+ Object.assign({ token: device.deviceToken }, (device.deviceName && {
111
+ name: device.deviceName,
112
+ })),
113
+ ],
114
+ message: testMessage,
115
+ deviceType: device.deviceType,
116
+ }, {
117
+ isSensitive: false,
118
+ projectId: device.projectId,
119
+ userId: device.userId,
120
+ });
121
+ }
122
+ catch (error) {
123
+ throw new BadDataException(`Failed to send test notification: ${error.message}`);
124
+ }
120
125
  return Response.sendJsonObjectResponse(req, res, {
121
126
  success: true,
122
127
  message: "Test notification sent successfully",
123
128
  });
124
129
  }
125
130
  catch (error) {
126
- return Response.sendErrorResponse(req, res, new BadDataException(`Failed to send test notification: ${error.message}`));
131
+ return next(error);
127
132
  }
128
133
  });
129
- this.router.post(`/user-push/:deviceId/verify`, UserMiddleware.getUserMiddleware, async (req, res) => {
134
+ this.router.post(`/user-push/:deviceId/verify`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
130
135
  var _a;
131
- req = req;
132
- if (!req.params["deviceId"]) {
133
- return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
134
- }
135
- const device = await this.service.findOneById({
136
- id: new ObjectID(req.params["deviceId"]),
137
- props: {
138
- isRoot: true,
139
- },
140
- select: {
141
- userId: true,
142
- },
143
- });
144
- if (!device) {
145
- return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
136
+ try {
137
+ req = req;
138
+ if (!req.params["deviceId"]) {
139
+ return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
140
+ }
141
+ const device = await this.service.findOneById({
142
+ id: new ObjectID(req.params["deviceId"]),
143
+ props: {
144
+ isRoot: true,
145
+ },
146
+ select: {
147
+ userId: true,
148
+ },
149
+ });
150
+ if (!device) {
151
+ return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
152
+ }
153
+ // Check if the device belongs to the current user
154
+ if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
155
+ req.userAuthorization.userId.toString()) {
156
+ return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
157
+ }
158
+ await this.service.verifyDevice(device._id.toString());
159
+ return Response.sendEmptySuccessResponse(req, res);
146
160
  }
147
- // Check if the device belongs to the current user
148
- if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
149
- req.userAuthorization.userId.toString()) {
150
- return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
161
+ catch (error) {
162
+ return next(error);
151
163
  }
152
- await this.service.verifyDevice(device._id.toString());
153
- return Response.sendEmptySuccessResponse(req, res);
154
164
  });
155
- this.router.post(`/user-push/:deviceId/unverify`, UserMiddleware.getUserMiddleware, async (req, res) => {
165
+ this.router.post(`/user-push/:deviceId/unverify`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
156
166
  var _a;
157
- req = req;
158
- if (!req.params["deviceId"]) {
159
- return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
160
- }
161
- const device = await this.service.findOneById({
162
- id: new ObjectID(req.params["deviceId"]),
163
- props: {
164
- isRoot: true,
165
- },
166
- select: {
167
- userId: true,
168
- },
169
- });
170
- if (!device) {
171
- return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
167
+ try {
168
+ req = req;
169
+ if (!req.params["deviceId"]) {
170
+ return Response.sendErrorResponse(req, res, new BadDataException("Device ID is required"));
171
+ }
172
+ const device = await this.service.findOneById({
173
+ id: new ObjectID(req.params["deviceId"]),
174
+ props: {
175
+ isRoot: true,
176
+ },
177
+ select: {
178
+ userId: true,
179
+ },
180
+ });
181
+ if (!device) {
182
+ return Response.sendErrorResponse(req, res, new BadDataException("Device not found"));
183
+ }
184
+ // Check if the device belongs to the current user
185
+ if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
186
+ req.userAuthorization.userId.toString()) {
187
+ return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
188
+ }
189
+ await this.service.unverifyDevice(device._id.toString());
190
+ return Response.sendEmptySuccessResponse(req, res);
172
191
  }
173
- // Check if the device belongs to the current user
174
- if (((_a = device.userId) === null || _a === void 0 ? void 0 : _a.toString()) !==
175
- req.userAuthorization.userId.toString()) {
176
- return Response.sendErrorResponse(req, res, new BadDataException("Unauthorized access to device"));
192
+ catch (error) {
193
+ return next(error);
177
194
  }
178
- await this.service.unverifyDevice(device._id.toString());
179
- return Response.sendEmptySuccessResponse(req, res);
180
195
  });
181
196
  }
182
197
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserPushAPI.js","sourceRoot":"","sources":["../../../../Server/API/UserPushAPI.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAC7D,OAAO,eAEN,MAAM,6BAA6B,CAAC;AACrC,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAOjE,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,QAAQ,MAAM,sCAAsC,C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