@oneuptime/common 7.0.4263 → 7.0.4298

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 (75) hide show
  1. package/Models/DatabaseModels/StatusPage.ts +39 -0
  2. package/Server/API/OpenAPI.ts +29 -0
  3. package/Server/API/StatusPageAPI.ts +85 -114
  4. package/Server/EnvironmentConfig.ts +1 -8
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1748456937826-MigrationName.ts +15 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  7. package/Server/Services/BillingInvoiceService.ts +5 -3
  8. package/Server/Services/DomainService.ts +16 -0
  9. package/Server/Services/StatusPageDomainService.ts +114 -41
  10. package/Server/Services/StatusPageService.ts +89 -24
  11. package/Server/Types/ConfigLogLevel.ts +9 -0
  12. package/Server/Types/Domain.ts +25 -0
  13. package/Server/Utils/Logger.ts +2 -1
  14. package/Server/Utils/OpenAPI.ts +370 -0
  15. package/Tests/Server/API/BaseAPI.test.ts +4 -0
  16. package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +7 -6
  17. package/Types/Billing/SubscriptionStatus.ts +1 -0
  18. package/Types/Exception/ExceptionCode.ts +1 -0
  19. package/Types/Exception/ForbiddenException.ts +8 -0
  20. package/Types/IP/IP.ts +88 -0
  21. package/UI/Components/ModelTable/BaseModelTable.tsx +0 -2
  22. package/UI/Utils/API/API.ts +15 -5
  23. package/UI/Utils/Cookie.ts +9 -0
  24. package/UI/Utils/User.ts +1 -0
  25. package/Utils/Schema/ModelSchema.ts +247 -0
  26. package/build/dist/Models/DatabaseModels/StatusPage.js +40 -0
  27. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  28. package/build/dist/Server/API/OpenAPI.js +14 -0
  29. package/build/dist/Server/API/OpenAPI.js.map +1 -0
  30. package/build/dist/Server/API/StatusPageAPI.js +78 -62
  31. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  32. package/build/dist/Server/EnvironmentConfig.js +1 -8
  33. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  34. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1748456937826-MigrationName.js +12 -0
  35. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1748456937826-MigrationName.js.map +1 -0
  36. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  37. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  38. package/build/dist/Server/Services/BillingInvoiceService.js +3 -3
  39. package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
  40. package/build/dist/Server/Services/DomainService.js +13 -0
  41. package/build/dist/Server/Services/DomainService.js.map +1 -1
  42. package/build/dist/Server/Services/StatusPageDomainService.js +87 -30
  43. package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
  44. package/build/dist/Server/Services/StatusPageService.js +66 -21
  45. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  46. package/build/dist/Server/Types/ConfigLogLevel.js +10 -0
  47. package/build/dist/Server/Types/ConfigLogLevel.js.map +1 -0
  48. package/build/dist/Server/Types/Domain.js +22 -0
  49. package/build/dist/Server/Types/Domain.js.map +1 -1
  50. package/build/dist/Server/Utils/Logger.js +2 -1
  51. package/build/dist/Server/Utils/Logger.js.map +1 -1
  52. package/build/dist/Server/Utils/OpenAPI.js +334 -0
  53. package/build/dist/Server/Utils/OpenAPI.js.map +1 -0
  54. package/build/dist/Tests/Server/API/BaseAPI.test.js +4 -0
  55. package/build/dist/Tests/Server/API/BaseAPI.test.js.map +1 -1
  56. package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +7 -6
  57. package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js.map +1 -1
  58. package/build/dist/Types/Billing/SubscriptionStatus.js +1 -0
  59. package/build/dist/Types/Billing/SubscriptionStatus.js.map +1 -1
  60. package/build/dist/Types/Exception/ExceptionCode.js +1 -0
  61. package/build/dist/Types/Exception/ExceptionCode.js.map +1 -1
  62. package/build/dist/Types/Exception/ForbiddenException.js +8 -0
  63. package/build/dist/Types/Exception/ForbiddenException.js.map +1 -0
  64. package/build/dist/Types/IP/IP.js +66 -0
  65. package/build/dist/Types/IP/IP.js.map +1 -1
  66. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  67. package/build/dist/UI/Utils/API/API.js +11 -5
  68. package/build/dist/UI/Utils/API/API.js.map +1 -1
  69. package/build/dist/UI/Utils/Cookie.js +8 -0
  70. package/build/dist/UI/Utils/Cookie.js.map +1 -1
  71. package/build/dist/UI/Utils/User.js +1 -0
  72. package/build/dist/UI/Utils/User.js.map +1 -1
  73. package/build/dist/Utils/Schema/ModelSchema.js +181 -0
  74. package/build/dist/Utils/Schema/ModelSchema.js.map +1 -0
  75. package/package.json +4 -2
@@ -34,7 +34,6 @@ import QueryHelper from "../Types/Database/QueryHelper";
34
34
  import logger from "../Utils/Logger";
35
35
  import Response from "../Utils/Response";
36
36
  import BaseAPI from "./BaseAPI";
37
- import CommonAPI from "./CommonAPI";
38
37
  import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
39
38
  import ArrayUtil from "../../Utils/Array";
40
39
  import SortOrder from "../../Types/BaseDatabase/SortOrder";
@@ -471,13 +470,14 @@ export default class StatusPageAPI extends BaseAPI {
471
470
  this.router.post(`${(_k = new this.entityType()
472
471
  .getCrudApiPath()) === null || _k === void 0 ? void 0 : _k.toString()}/resources/:statusPageId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
473
472
  try {
474
- const objectId = new ObjectID(req.params["statusPageId"]);
475
- if (!(await this.service.hasReadAccess(objectId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
476
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
477
- }
473
+ const statusPageId = new ObjectID(req.params["statusPageId"]);
474
+ await this.checkHasReadAccess({
475
+ statusPageId: statusPageId,
476
+ req: req,
477
+ });
478
478
  const resources = await StatusPageResourceService.findBy({
479
479
  query: {
480
- statusPageId: objectId,
480
+ statusPageId: statusPageId,
481
481
  },
482
482
  select: {
483
483
  _id: true,
@@ -510,9 +510,10 @@ export default class StatusPageAPI extends BaseAPI {
510
510
  if (!statusPageId || !statusPageResourceId) {
511
511
  throw new BadDataException("Status Page or Resource not found");
512
512
  }
513
- if (!(await this.service.hasReadAccess(statusPageId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
514
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
515
- }
513
+ await this.checkHasReadAccess({
514
+ statusPageId: statusPageId,
515
+ req: req,
516
+ });
516
517
  // get start and end date from request body.
517
518
  // if no end date is provided then it will be current date.
518
519
  // if no start date is provided then it will be 14 days ago from end date.
@@ -682,14 +683,15 @@ export default class StatusPageAPI extends BaseAPI {
682
683
  this.router.post(`${(_m = new this.entityType()
683
684
  .getCrudApiPath()) === null || _m === void 0 ? void 0 : _m.toString()}/overview/:statusPageId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
684
685
  try {
685
- const objectId = new ObjectID(req.params["statusPageId"]);
686
- if (!(await this.service.hasReadAccess(objectId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
687
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
688
- }
686
+ const statusPageId = new ObjectID(req.params["statusPageId"]);
687
+ await this.checkHasReadAccess({
688
+ statusPageId: statusPageId,
689
+ req: req,
690
+ });
689
691
  const startDate = OneUptimeDate.getSomeDaysAgo(90);
690
692
  const endDate = OneUptimeDate.getCurrentDate();
691
693
  const { monitorStatuses, monitorGroupCurrentStatuses, statusPageResources, statusPage, monitorsOnStatusPage, monitorStatusTimelines, statusPageGroups, monitorsInGroup, } = await this.getStatusPageResourcesAndTimelines({
692
- statusPageId: objectId,
694
+ statusPageId: statusPageId,
693
695
  startDateForMonitorTimeline: startDate,
694
696
  endDateForMonitorTimeline: endDate,
695
697
  });
@@ -808,7 +810,7 @@ export default class StatusPageAPI extends BaseAPI {
808
810
  if (statusPage.showAnnouncementsOnStatusPage) {
809
811
  activeAnnouncements = await StatusPageAnnouncementService.findBy({
810
812
  query: {
811
- statusPages: objectId,
813
+ statusPages: statusPageId,
812
814
  showAnnouncementAt: QueryHelper.lessThan(today),
813
815
  endAnnouncementAt: QueryHelper.greaterThanOrNull(today),
814
816
  projectId: statusPage.projectId,
@@ -861,7 +863,7 @@ export default class StatusPageAPI extends BaseAPI {
861
863
  currentScheduledMaintenanceState: {
862
864
  isOngoingState: true,
863
865
  },
864
- statusPages: objectId,
866
+ statusPages: statusPageId,
865
867
  projectId: statusPage.projectId,
866
868
  isVisibleOnStatusPage: true,
867
869
  },
@@ -884,7 +886,7 @@ export default class StatusPageAPI extends BaseAPI {
884
886
  currentScheduledMaintenanceState: {
885
887
  isScheduledState: true,
886
888
  },
887
- statusPages: objectId,
889
+ statusPages: statusPageId,
888
890
  projectId: statusPage.projectId,
889
891
  isVisibleOnStatusPage: true,
890
892
  },
@@ -962,7 +964,7 @@ export default class StatusPageAPI extends BaseAPI {
962
964
  // get all status page bar chart rules
963
965
  const statusPageHistoryChartBarColorRules = await StatusPageHistoryChartBarColorRuleService.findBy({
964
966
  query: {
965
- statusPageId: objectId,
967
+ statusPageId: statusPageId,
966
968
  },
967
969
  select: {
968
970
  _id: true,
@@ -1051,7 +1053,7 @@ export default class StatusPageAPI extends BaseAPI {
1051
1053
  .getCrudApiPath()) === null || _s === void 0 ? void 0 : _s.toString()}/incidents/:statusPageId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
1052
1054
  try {
1053
1055
  const objectId = new ObjectID(req.params["statusPageId"]);
1054
- const response = await this.getIncidents(objectId, null, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1056
+ const response = await this.getIncidents(objectId, null, req);
1055
1057
  return Response.sendJsonObjectResponse(req, res, response);
1056
1058
  }
1057
1059
  catch (err) {
@@ -1062,7 +1064,7 @@ export default class StatusPageAPI extends BaseAPI {
1062
1064
  .getCrudApiPath()) === null || _t === void 0 ? void 0 : _t.toString()}/scheduled-maintenance-events/:statusPageId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
1063
1065
  try {
1064
1066
  const objectId = new ObjectID(req.params["statusPageId"]);
1065
- const response = await this.getScheduledMaintenanceEvents(objectId, null, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1067
+ const response = await this.getScheduledMaintenanceEvents(objectId, null, req);
1066
1068
  return Response.sendJsonObjectResponse(req, res, response);
1067
1069
  }
1068
1070
  catch (err) {
@@ -1073,7 +1075,7 @@ export default class StatusPageAPI extends BaseAPI {
1073
1075
  .getCrudApiPath()) === null || _u === void 0 ? void 0 : _u.toString()}/announcements/:statusPageId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
1074
1076
  try {
1075
1077
  const objectId = new ObjectID(req.params["statusPageId"]);
1076
- const response = await this.getAnnouncements(objectId, null, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1078
+ const response = await this.getAnnouncements(objectId, null, req);
1077
1079
  return Response.sendJsonObjectResponse(req, res, response);
1078
1080
  }
1079
1081
  catch (err) {
@@ -1085,7 +1087,7 @@ export default class StatusPageAPI extends BaseAPI {
1085
1087
  try {
1086
1088
  const objectId = new ObjectID(req.params["statusPageId"]);
1087
1089
  const incidentId = new ObjectID(req.params["incidentId"]);
1088
- const response = await this.getIncidents(objectId, incidentId, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1090
+ const response = await this.getIncidents(objectId, incidentId, req);
1089
1091
  return Response.sendJsonObjectResponse(req, res, response);
1090
1092
  }
1091
1093
  catch (err) {
@@ -1097,7 +1099,7 @@ export default class StatusPageAPI extends BaseAPI {
1097
1099
  try {
1098
1100
  const objectId = new ObjectID(req.params["statusPageId"]);
1099
1101
  const scheduledMaintenanceId = new ObjectID(req.params["scheduledMaintenanceId"]);
1100
- const response = await this.getScheduledMaintenanceEvents(objectId, scheduledMaintenanceId, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1102
+ const response = await this.getScheduledMaintenanceEvents(objectId, scheduledMaintenanceId, req);
1101
1103
  return Response.sendJsonObjectResponse(req, res, response);
1102
1104
  }
1103
1105
  catch (err) {
@@ -1109,7 +1111,7 @@ export default class StatusPageAPI extends BaseAPI {
1109
1111
  try {
1110
1112
  const objectId = new ObjectID(req.params["statusPageId"]);
1111
1113
  const announcementId = new ObjectID(req.params["announcementId"]);
1112
- const response = await this.getAnnouncements(objectId, announcementId, await CommonAPI.getDatabaseCommonInteractionProps(req), req);
1114
+ const response = await this.getAnnouncements(objectId, announcementId, req);
1113
1115
  return Response.sendJsonObjectResponse(req, res, response);
1114
1116
  }
1115
1117
  catch (err) {
@@ -1117,10 +1119,11 @@ export default class StatusPageAPI extends BaseAPI {
1117
1119
  }
1118
1120
  });
1119
1121
  }
1120
- async getScheduledMaintenanceEvents(statusPageId, scheduledMaintenanceId, props, req) {
1121
- if (!(await this.service.hasReadAccess(statusPageId, props, req))) {
1122
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1123
- }
1122
+ async getScheduledMaintenanceEvents(statusPageId, scheduledMaintenanceId, req) {
1123
+ await this.checkHasReadAccess({
1124
+ statusPageId: statusPageId,
1125
+ req: req,
1126
+ });
1124
1127
  const statusPage = await StatusPageService.findOneBy({
1125
1128
  query: {
1126
1129
  _id: statusPageId.toString(),
@@ -1358,10 +1361,11 @@ export default class StatusPageAPI extends BaseAPI {
1358
1361
  };
1359
1362
  return response;
1360
1363
  }
1361
- async getAnnouncements(statusPageId, announcementId, props, req) {
1362
- if (!(await this.service.hasReadAccess(statusPageId, props, req))) {
1363
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1364
- }
1364
+ async getAnnouncements(statusPageId, announcementId, req) {
1365
+ await this.checkHasReadAccess({
1366
+ statusPageId: statusPageId,
1367
+ req: req,
1368
+ });
1365
1369
  const statusPage = await StatusPageService.findOneBy({
1366
1370
  query: {
1367
1371
  _id: statusPageId.toString(),
@@ -1442,15 +1446,15 @@ export default class StatusPageAPI extends BaseAPI {
1442
1446
  return response;
1443
1447
  }
1444
1448
  async manageExistingSubscription(req) {
1445
- const objectId = new ObjectID(req.params["statusPageId"]);
1446
- logger.debug(`Managing Existing Subscription for Status Page: ${objectId}`);
1447
- if (!(await this.service.hasReadAccess(objectId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
1448
- logger.debug(`No read access to status page with ID: ${objectId}`);
1449
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1450
- }
1449
+ const statusPageId = new ObjectID(req.params["statusPageId"]);
1450
+ logger.debug(`Managing Existing Subscription for Status Page: ${statusPageId}`);
1451
+ await this.checkHasReadAccess({
1452
+ statusPageId: statusPageId,
1453
+ req: req,
1454
+ });
1451
1455
  const statusPage = await StatusPageService.findOneBy({
1452
1456
  query: {
1453
- _id: objectId.toString(),
1457
+ _id: statusPageId.toString(),
1454
1458
  },
1455
1459
  select: {
1456
1460
  _id: true,
@@ -1466,27 +1470,27 @@ export default class StatusPageAPI extends BaseAPI {
1466
1470
  },
1467
1471
  });
1468
1472
  if (!statusPage) {
1469
- logger.debug(`Status page not found with ID: ${objectId}`);
1473
+ logger.debug(`Status page not found with ID: ${statusPageId}`);
1470
1474
  throw new BadDataException("Status Page not found");
1471
1475
  }
1472
1476
  if (!statusPage.showSubscriberPageOnStatusPage) {
1473
- logger.debug(`Subscriber page not enabled for status page with ID: ${objectId}`);
1477
+ logger.debug(`Subscriber page not enabled for status page with ID: ${statusPageId}`);
1474
1478
  throw new BadDataException("Subscribes not enabled for this status page.");
1475
1479
  }
1476
1480
  logger.debug(`Status page found: ${JSON.stringify(statusPage)}`);
1477
1481
  if (req.body.data["subscriberEmail"] &&
1478
1482
  !statusPage.enableEmailSubscribers) {
1479
- logger.debug(`Email subscribers not enabled for status page with ID: ${objectId}`);
1483
+ logger.debug(`Email subscribers not enabled for status page with ID: ${statusPageId}`);
1480
1484
  throw new BadDataException("Email subscribers not enabled for this status page.");
1481
1485
  }
1482
1486
  if (req.body.data["subscriberPhone"] && !statusPage.enableSmsSubscribers) {
1483
- logger.debug(`SMS subscribers not enabled for status page with ID: ${objectId}`);
1487
+ logger.debug(`SMS subscribers not enabled for status page with ID: ${statusPageId}`);
1484
1488
  throw new BadDataException("SMS subscribers not enabled for this status page.");
1485
1489
  }
1486
1490
  // if no email or phone, throw error.
1487
1491
  if (!req.body.data["subscriberEmail"] &&
1488
1492
  !req.body.data["subscriberPhone"]) {
1489
- logger.debug(`No email or phone provided for subscription to status page with ID: ${objectId}`);
1493
+ logger.debug(`No email or phone provided for subscription to status page with ID: ${statusPageId}`);
1490
1494
  throw new BadDataException("Email or phone is required to subscribe to this status page.");
1491
1495
  }
1492
1496
  const email = req.body.data["subscriberEmail"]
@@ -1501,7 +1505,7 @@ export default class StatusPageAPI extends BaseAPI {
1501
1505
  statusPageSubscriber = await StatusPageSubscriberService.findOneBy({
1502
1506
  query: {
1503
1507
  subscriberEmail: email,
1504
- statusPageId: objectId,
1508
+ statusPageId: statusPageId,
1505
1509
  },
1506
1510
  select: {
1507
1511
  _id: true,
@@ -1517,7 +1521,7 @@ export default class StatusPageAPI extends BaseAPI {
1517
1521
  statusPageSubscriber = await StatusPageSubscriberService.findOneBy({
1518
1522
  query: {
1519
1523
  subscriberPhone: phone,
1520
- statusPageId: objectId,
1524
+ statusPageId: statusPageId,
1521
1525
  },
1522
1526
  select: {
1523
1527
  _id: true,
@@ -1537,10 +1541,10 @@ export default class StatusPageAPI extends BaseAPI {
1537
1541
  }
1538
1542
  throw new BadDataException(`Subscription not found for this status page. Please make sure your ${emailOrPhone} is correct.`);
1539
1543
  }
1540
- const statusPageURL = await StatusPageService.getStatusPageURL(objectId);
1544
+ const statusPageURL = await StatusPageService.getStatusPageURL(statusPageId);
1541
1545
  const manageUrlink = StatusPageSubscriberService.getUnsubscribeLink(URL.fromString(statusPageURL), statusPageSubscriber.id).toString();
1542
1546
  const statusPages = await StatusPageSubscriberService.getStatusPagesToSendNotification([
1543
- objectId,
1547
+ statusPageId,
1544
1548
  ]);
1545
1549
  for (const statusPage of statusPages) {
1546
1550
  // send email to subscriber or sms if phone is provided.
@@ -1591,10 +1595,10 @@ export default class StatusPageAPI extends BaseAPI {
1591
1595
  async subscribeToStatusPage(req) {
1592
1596
  const objectId = new ObjectID(req.params["statusPageId"]);
1593
1597
  logger.debug(`Subscribing to status page with ID: ${objectId}`);
1594
- if (!(await this.service.hasReadAccess(objectId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
1595
- logger.debug(`No read access to status page with ID: ${objectId}`);
1596
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1597
- }
1598
+ await this.checkHasReadAccess({
1599
+ statusPageId: objectId,
1600
+ req: req,
1601
+ });
1598
1602
  const statusPage = await StatusPageService.findOneBy({
1599
1603
  query: {
1600
1604
  _id: objectId.toString(),
@@ -1727,9 +1731,10 @@ export default class StatusPageAPI extends BaseAPI {
1727
1731
  }
1728
1732
  async getSubscriber(req) {
1729
1733
  const objectId = new ObjectID(req.params["statusPageId"]);
1730
- if (!(await this.service.hasReadAccess(objectId, await CommonAPI.getDatabaseCommonInteractionProps(req), req))) {
1731
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1732
- }
1734
+ await this.checkHasReadAccess({
1735
+ statusPageId: objectId,
1736
+ req: req,
1737
+ });
1733
1738
  const statusPage = await StatusPageService.findOneBy({
1734
1739
  query: {
1735
1740
  _id: objectId.toString(),
@@ -1768,10 +1773,11 @@ export default class StatusPageAPI extends BaseAPI {
1768
1773
  }
1769
1774
  return statusPageSubscriber;
1770
1775
  }
1771
- async getIncidents(statusPageId, incidentId, props, req) {
1772
- if (!(await this.service.hasReadAccess(statusPageId, props, req))) {
1773
- throw new NotAuthenticatedException("You are not authenticated to access this status page");
1774
- }
1776
+ async getIncidents(statusPageId, incidentId, req) {
1777
+ await this.checkHasReadAccess({
1778
+ statusPageId: statusPageId,
1779
+ req: req,
1780
+ });
1775
1781
  const statusPage = await StatusPageService.findOneBy({
1776
1782
  query: {
1777
1783
  _id: statusPageId.toString(),
@@ -2198,17 +2204,27 @@ export default class StatusPageAPI extends BaseAPI {
2198
2204
  monitorsInGroup,
2199
2205
  };
2200
2206
  }
2207
+ async checkHasReadAccess(data) {
2208
+ const accessResult = await this.service.hasReadAccess({
2209
+ statusPageId: data.statusPageId,
2210
+ req: data.req,
2211
+ });
2212
+ if (!accessResult.hasReadAccess) {
2213
+ throw (accessResult.error ||
2214
+ new NotAuthenticatedException("You are not authenticated to access this status page"));
2215
+ }
2216
+ }
2201
2217
  }
2202
2218
  __decorate([
2203
2219
  CaptureSpan(),
2204
2220
  __metadata("design:type", Function),
2205
- __metadata("design:paramtypes", [ObjectID, Object, Object, Object]),
2221
+ __metadata("design:paramtypes", [ObjectID, Object, Object]),
2206
2222
  __metadata("design:returntype", Promise)
2207
2223
  ], StatusPageAPI.prototype, "getScheduledMaintenanceEvents", null);
2208
2224
  __decorate([
2209
2225
  CaptureSpan(),
2210
2226
  __metadata("design:type", Function),
2211
- __metadata("design:paramtypes", [ObjectID, Object, Object, Object]),
2227
+ __metadata("design:paramtypes", [ObjectID, Object, Object]),
2212
2228
  __metadata("design:returntype", Promise)
2213
2229
  ], StatusPageAPI.prototype, "getAnnouncements", null);
2214
2230
  __decorate([
@@ -2232,7 +2248,7 @@ __decorate([
2232
2248
  __decorate([
2233
2249
  CaptureSpan(),
2234
2250
  __metadata("design:type", Function),
2235
- __metadata("design:paramtypes", [ObjectID, Object, Object, Object]),
2251
+ __metadata("design:paramtypes", [ObjectID, Object, Object]),
2236
2252
  __metadata("design:returntype", Promise)
2237
2253
  ], StatusPageAPI.prototype, "getIncidents", null);
2238
2254
  __decorate([