@oneuptime/common 7.0.3707 → 7.0.3712

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 (44) hide show
  1. package/Server/API/StatusPageAPI.ts +44 -1
  2. package/Server/Services/ScheduledMaintenanceService.ts +2 -1
  3. package/Server/Services/StatusPageSubscriberService.ts +160 -12
  4. package/Server/Services/WorkspaceNotificationRuleService.ts +205 -11
  5. package/Server/Services/WorkspaceProjectAuthTokenService.ts +1 -0
  6. package/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.ts +18 -7
  7. package/Server/Utils/Workspace/Slack/Slack.ts +352 -45
  8. package/Server/Utils/Workspace/Slack/app-manifest.json +9 -4
  9. package/Server/Utils/Workspace/WorkspaceBase.ts +31 -2
  10. package/Types/Workflow/Component.ts +1 -0
  11. package/Types/Workflow/Components/BaseModel.ts +30 -0
  12. package/Types/Workflow/Components/Manual.ts +10 -0
  13. package/Types/Workflow/Components/Schedule.ts +1 -0
  14. package/Types/Workflow/Components/Webhook.ts +26 -0
  15. package/UI/Components/Workflow/RunForm.tsx +23 -25
  16. package/build/dist/Server/API/StatusPageAPI.js +19 -0
  17. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  18. package/build/dist/Server/Services/ScheduledMaintenanceService.js +1 -1
  19. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  20. package/build/dist/Server/Services/StatusPageSubscriberService.js +116 -7
  21. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  22. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +136 -8
  23. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  24. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +1 -0
  25. package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -1
  26. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js +14 -5
  27. package/build/dist/Server/Types/Workflow/Components/BaseModel/OnTriggerBaseModel.js.map +1 -1
  28. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +251 -36
  29. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  30. package/build/dist/Server/Utils/Workspace/Slack/app-manifest.json +9 -4
  31. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js +12 -2
  32. package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
  33. package/build/dist/Types/Workflow/Components/BaseModel.js +30 -0
  34. package/build/dist/Types/Workflow/Components/BaseModel.js.map +1 -1
  35. package/build/dist/Types/Workflow/Components/Manual.js +10 -0
  36. package/build/dist/Types/Workflow/Components/Manual.js.map +1 -1
  37. package/build/dist/Types/Workflow/Components/Schedule.js +1 -0
  38. package/build/dist/Types/Workflow/Components/Schedule.js.map +1 -1
  39. package/build/dist/Types/Workflow/Components/Webhook.js +26 -0
  40. package/build/dist/Types/Workflow/Components/Webhook.js.map +1 -1
  41. package/build/dist/UI/Components/Workflow/RunForm.js +16 -14
  42. package/build/dist/UI/Components/Workflow/RunForm.js.map +1 -1
  43. package/package.json +2 -2
  44. /package/Server/Utils/Workspace/Slack/{app-manifest-temp.json → app-manifest.example.json} +0 -0
@@ -1942,6 +1942,8 @@ export default class StatusPageAPI extends BaseAPI<
1942
1942
  req.params["statusPageId"] as string,
1943
1943
  );
1944
1944
 
1945
+ logger.debug(`Subscribing to status page with ID: ${objectId}`);
1946
+
1945
1947
  if (
1946
1948
  !(await this.service.hasReadAccess(
1947
1949
  objectId,
@@ -1949,6 +1951,7 @@ export default class StatusPageAPI extends BaseAPI<
1949
1951
  req,
1950
1952
  ))
1951
1953
  ) {
1954
+ logger.debug(`No read access to status page with ID: ${objectId}`);
1952
1955
  throw new NotAuthenticatedException(
1953
1956
  "You are not authenticated to access this status page",
1954
1957
  );
@@ -1972,19 +1975,28 @@ export default class StatusPageAPI extends BaseAPI<
1972
1975
  });
1973
1976
 
1974
1977
  if (!statusPage) {
1978
+ logger.debug(`Status page not found with ID: ${objectId}`);
1975
1979
  throw new BadDataException("Status Page not found");
1976
1980
  }
1977
1981
 
1982
+ logger.debug(`Status page found: ${JSON.stringify(statusPage)}`);
1983
+
1978
1984
  if (
1979
1985
  req.body.data["subscriberEmail"] &&
1980
1986
  !statusPage.enableEmailSubscribers
1981
1987
  ) {
1988
+ logger.debug(
1989
+ `Email subscribers not enabled for status page with ID: ${objectId}`,
1990
+ );
1982
1991
  throw new BadDataException(
1983
1992
  "Email subscribers not enabled for this status page.",
1984
1993
  );
1985
1994
  }
1986
1995
 
1987
1996
  if (req.body.data["subscriberPhone"] && !statusPage.enableSmsSubscribers) {
1997
+ logger.debug(
1998
+ `SMS subscribers not enabled for status page with ID: ${objectId}`,
1999
+ );
1988
2000
  throw new BadDataException(
1989
2001
  "SMS subscribers not enabled for this status page.",
1990
2002
  );
@@ -1996,6 +2008,9 @@ export default class StatusPageAPI extends BaseAPI<
1996
2008
  !req.body.data["subscriberEmail"] &&
1997
2009
  !req.body.data["subscriberPhone"]
1998
2010
  ) {
2011
+ logger.debug(
2012
+ `No email or phone provided for subscription to status page with ID: ${objectId}`,
2013
+ );
1999
2014
  throw new BadDataException(
2000
2015
  "Email or phone is required to subscribe to this status page.",
2001
2016
  );
@@ -2014,12 +2029,18 @@ export default class StatusPageAPI extends BaseAPI<
2014
2029
  let isUpdate: boolean = false;
2015
2030
 
2016
2031
  if (!req.params["subscriberId"]) {
2032
+ logger.debug(
2033
+ `Creating new subscriber for status page with ID: ${objectId}`,
2034
+ );
2017
2035
  statusPageSubscriber = new StatusPageSubscriber();
2018
2036
  } else {
2019
2037
  const subscriberId: ObjectID = new ObjectID(
2020
2038
  req.params["subscriberId"] as string,
2021
2039
  );
2022
2040
 
2041
+ logger.debug(
2042
+ `Updating existing subscriber with ID: ${subscriberId} for status page with ID: ${objectId}`,
2043
+ );
2023
2044
  statusPageSubscriber = await StatusPageSubscriberService.findOneBy({
2024
2045
  query: {
2025
2046
  _id: subscriberId.toString(),
@@ -2030,6 +2051,7 @@ export default class StatusPageAPI extends BaseAPI<
2030
2051
  });
2031
2052
 
2032
2053
  if (!statusPageSubscriber) {
2054
+ logger.debug(`Subscriber not found with ID: ${subscriberId}`);
2033
2055
  throw new BadDataException("Subscriber not found");
2034
2056
  }
2035
2057
 
@@ -2037,10 +2059,12 @@ export default class StatusPageAPI extends BaseAPI<
2037
2059
  }
2038
2060
 
2039
2061
  if (email) {
2062
+ logger.debug(`Setting subscriber email: ${email}`);
2040
2063
  statusPageSubscriber.subscriberEmail = email;
2041
2064
  }
2042
2065
 
2043
2066
  if (phone) {
2067
+ logger.debug(`Setting subscriber phone: ${phone}`);
2044
2068
  statusPageSubscriber.subscriberPhone = phone;
2045
2069
  }
2046
2070
 
@@ -2048,6 +2072,9 @@ export default class StatusPageAPI extends BaseAPI<
2048
2072
  req.body.data["statusPageResources"] &&
2049
2073
  !statusPage.allowSubscribersToChooseResources
2050
2074
  ) {
2075
+ logger.debug(
2076
+ `Subscribers not allowed to choose resources for status page with ID: ${objectId}`,
2077
+ );
2051
2078
  throw new BadDataException(
2052
2079
  "Subscribers are not allowed to choose resources for this status page.",
2053
2080
  );
@@ -2057,6 +2084,9 @@ export default class StatusPageAPI extends BaseAPI<
2057
2084
  req.body.data["statusPageEventTypes"] &&
2058
2085
  !statusPage.allowSubscribersToChooseEventTypes
2059
2086
  ) {
2087
+ logger.debug(
2088
+ `Subscribers not allowed to choose event types for status page with ID: ${objectId}`,
2089
+ );
2060
2090
  throw new BadDataException(
2061
2091
  "Subscribers are not allowed to choose event types for this status page.",
2062
2092
  );
@@ -2077,6 +2107,9 @@ export default class StatusPageAPI extends BaseAPI<
2077
2107
  req.body.data["statusPageResources"] &&
2078
2108
  req.body.data["statusPageResources"].length > 0
2079
2109
  ) {
2110
+ logger.debug(
2111
+ `Setting subscriber resources: ${JSON.stringify(req.body.data["statusPageResources"])}`,
2112
+ );
2080
2113
  statusPageSubscriber.statusPageResources = req.body.data[
2081
2114
  "statusPageResources"
2082
2115
  ] as Array<StatusPageResource>;
@@ -2086,6 +2119,9 @@ export default class StatusPageAPI extends BaseAPI<
2086
2119
  req.body.data["statusPageEventTypes"] &&
2087
2120
  req.body.data["statusPageEventTypes"].length > 0
2088
2121
  ) {
2122
+ logger.debug(
2123
+ `Setting subscriber event types: ${JSON.stringify(req.body.data["statusPageEventTypes"])}`,
2124
+ );
2089
2125
  statusPageSubscriber.statusPageEventTypes = req.body.data[
2090
2126
  "statusPageEventTypes"
2091
2127
  ] as Array<StatusPageEventType>;
@@ -2093,7 +2129,7 @@ export default class StatusPageAPI extends BaseAPI<
2093
2129
 
2094
2130
  if (isUpdate) {
2095
2131
  // check isUnsubscribed is set to false.
2096
-
2132
+ logger.debug(`Updating subscriber with ID: ${statusPageSubscriber.id}`);
2097
2133
  statusPageSubscriber.isUnsubscribed = Boolean(
2098
2134
  req.body.data["isUnsubscribed"],
2099
2135
  );
@@ -2111,6 +2147,9 @@ export default class StatusPageAPI extends BaseAPI<
2111
2147
  },
2112
2148
  });
2113
2149
  } else {
2150
+ logger.debug(
2151
+ `Creating new subscriber: ${JSON.stringify(statusPageSubscriber)}`,
2152
+ );
2114
2153
  await StatusPageSubscriberService.create({
2115
2154
  data: statusPageSubscriber,
2116
2155
  props: {
@@ -2118,6 +2157,10 @@ export default class StatusPageAPI extends BaseAPI<
2118
2157
  },
2119
2158
  });
2120
2159
  }
2160
+
2161
+ logger.debug(
2162
+ `Subscription process completed for status page with ID: ${objectId}`,
2163
+ );
2121
2164
  }
2122
2165
 
2123
2166
  public async getSubscriber(
@@ -276,7 +276,8 @@ export class Service extends DatabaseService<Model> {
276
276
  ),
277
277
  unsubscribeUrl: unsubscribeUrl,
278
278
  },
279
- subject: "[Scheduled Maintenance] " + statusPageName,
279
+ subject:
280
+ "[Scheduled Maintenance] " + (event.title || statusPageName),
280
281
  },
281
282
  {
282
283
  mailServer: ProjectSmtpConfigService.toEmailServer(