@oneuptime/common 10.0.39 → 10.0.41

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 (285) hide show
  1. package/Models/AnalyticsModels/Index.ts +4 -0
  2. package/Models/AnalyticsModels/Profile.ts +687 -0
  3. package/Models/AnalyticsModels/ProfileSample.ts +547 -0
  4. package/Models/DatabaseModels/Dashboard.ts +357 -0
  5. package/Models/DatabaseModels/DashboardDomain.ts +658 -0
  6. package/Models/DatabaseModels/Index.ts +2 -0
  7. package/Models/DatabaseModels/StatusPage.ts +41 -0
  8. package/Server/API/DashboardAPI.ts +408 -0
  9. package/Server/API/DashboardDomainAPI.ts +235 -0
  10. package/Server/API/StatusPageAPI.ts +36 -2
  11. package/Server/API/TelemetryAPI.ts +393 -0
  12. package/Server/EnvironmentConfig.ts +12 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts +97 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts +17 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.ts +50 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts +59 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  18. package/Server/Middleware/UserAuthorization.ts +96 -1
  19. package/Server/Services/DashboardDomainService.ts +647 -0
  20. package/Server/Services/DashboardService.ts +174 -3
  21. package/Server/Services/IncidentService.ts +295 -50
  22. package/Server/Services/IncidentStateTimelineService.ts +1 -0
  23. package/Server/Services/Index.ts +6 -0
  24. package/Server/Services/MonitorService.ts +5 -0
  25. package/Server/Services/ProfileAggregationService.ts +559 -0
  26. package/Server/Services/ProfileSampleService.ts +11 -0
  27. package/Server/Services/ProfileService.ts +11 -0
  28. package/Server/Services/TelemetryUsageBillingService.ts +77 -3
  29. package/Server/Services/WorkspaceNotificationSummaryService.ts +15 -1
  30. package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +9 -0
  31. package/Server/Utils/Cookie.ts +48 -0
  32. package/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.ts +34 -0
  33. package/Server/Utils/Monitor/DataToProcess.ts +3 -1
  34. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +299 -0
  35. package/Server/Utils/Profile/PprofEncoder.ts +225 -0
  36. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +53 -16
  37. package/Server/Utils/Workspace/Slack/Slack.ts +26 -6
  38. package/ServiceRoute.ts +2 -0
  39. package/Tests/UI/Components/ComponentsModal.test.tsx +19 -15
  40. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +2 -0
  41. package/Types/CookieName.ts +1 -0
  42. package/Types/Dashboard/Chart/ChartType.ts +5 -0
  43. package/Types/Dashboard/DashboardComponentType.ts +4 -0
  44. package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +10 -0
  45. package/Types/Dashboard/DashboardComponents/DashboardChartComponent.ts +1 -2
  46. package/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.ts +17 -0
  47. package/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.ts +15 -0
  48. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.ts +14 -0
  49. package/Types/Dashboard/DashboardComponents/DashboardTextComponent.ts +1 -0
  50. package/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.ts +13 -0
  51. package/Types/Dashboard/DashboardComponents/DashboardValueComponent.ts +2 -0
  52. package/Types/Dashboard/DashboardTemplates.ts +964 -0
  53. package/Types/Dashboard/DashboardVariable.ts +23 -0
  54. package/Types/Dashboard/DashboardViewConfig.ts +59 -0
  55. package/Types/Dashboard/MasterPassword.ts +10 -0
  56. package/Types/Icon/IconProp.ts +1 -0
  57. package/Types/Incident/IncidentMetricType.ts +3 -0
  58. package/Types/MeteredPlan/ProductType.ts +1 -0
  59. package/Types/Metrics/MetricQueryConfigData.ts +3 -0
  60. package/Types/Monitor/CriteriaFilter.ts +3 -0
  61. package/Types/Monitor/KubernetesAlertTemplates.ts +78 -7
  62. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +20 -0
  63. package/Types/Monitor/MonitorStep.ts +25 -0
  64. package/Types/Monitor/MonitorStepProfileMonitor.ts +96 -0
  65. package/Types/Monitor/MonitorType.ts +11 -0
  66. package/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.ts +12 -0
  67. package/Types/Permission.ts +87 -0
  68. package/Types/Telemetry/TelemetryType.ts +1 -0
  69. package/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.ts +1 -0
  70. package/UI/Components/Button/Button.tsx +1 -1
  71. package/UI/Components/Card/Card.tsx +8 -4
  72. package/UI/Components/Charts/Area/AreaChart.tsx +4 -0
  73. package/UI/Components/Charts/Bar/BarChart.tsx +4 -0
  74. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +26 -0
  75. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +26 -0
  76. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +26 -0
  77. package/UI/Components/Charts/Line/LineChart.tsx +4 -0
  78. package/UI/Components/Charts/Types/ReferenceLineProps.ts +6 -0
  79. package/UI/Components/Icon/Icon.tsx +33 -0
  80. package/UI/Components/ModelTable/BaseModelTable.tsx +13 -10
  81. package/UI/Components/MoreMenu/MoreMenu.tsx +15 -2
  82. package/UI/Components/MoreMenu/MoreMenuItem.tsx +4 -4
  83. package/UI/Components/Workflow/Component.tsx +450 -209
  84. package/UI/Components/Workflow/ComponentPortViewer.tsx +57 -20
  85. package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +65 -25
  86. package/UI/Components/Workflow/ComponentSettingsModal.tsx +202 -37
  87. package/UI/Components/Workflow/ComponentsModal.tsx +180 -93
  88. package/UI/Components/Workflow/Workflow.tsx +105 -9
  89. package/UI/Config.ts +9 -0
  90. package/Utils/Dashboard/Components/DashboardChartComponent.ts +53 -22
  91. package/Utils/Dashboard/Components/DashboardGaugeComponent.ts +124 -0
  92. package/Utils/Dashboard/Components/DashboardLogStreamComponent.ts +110 -0
  93. package/Utils/Dashboard/Components/DashboardTableComponent.ts +86 -0
  94. package/Utils/Dashboard/Components/DashboardTextComponent.ts +32 -7
  95. package/Utils/Dashboard/Components/DashboardTraceListComponent.ts +86 -0
  96. package/Utils/Dashboard/Components/DashboardValueComponent.ts +39 -3
  97. package/Utils/Dashboard/Components/Index.ts +28 -0
  98. package/Utils/ValueFormatter.ts +170 -0
  99. package/build/dist/Models/AnalyticsModels/Index.js +4 -0
  100. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  101. package/build/dist/Models/AnalyticsModels/Profile.js +621 -0
  102. package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -0
  103. package/build/dist/Models/AnalyticsModels/ProfileSample.js +497 -0
  104. package/build/dist/Models/AnalyticsModels/ProfileSample.js.map +1 -0
  105. package/build/dist/Models/DatabaseModels/Dashboard.js +365 -0
  106. package/build/dist/Models/DatabaseModels/Dashboard.js.map +1 -1
  107. package/build/dist/Models/DatabaseModels/DashboardDomain.js +691 -0
  108. package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -0
  109. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  110. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  111. package/build/dist/Models/DatabaseModels/StatusPage.js +42 -0
  112. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  113. package/build/dist/Server/API/DashboardAPI.js +293 -0
  114. package/build/dist/Server/API/DashboardAPI.js.map +1 -0
  115. package/build/dist/Server/API/DashboardDomainAPI.js +124 -0
  116. package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -0
  117. package/build/dist/Server/API/StatusPageAPI.js +26 -2
  118. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  119. package/build/dist/Server/API/TelemetryAPI.js +222 -0
  120. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  121. package/build/dist/Server/EnvironmentConfig.js +4 -0
  122. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  123. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js +40 -0
  124. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js.map +1 -0
  125. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js +12 -0
  126. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js.map +1 -0
  127. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js +23 -0
  128. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js.map +1 -0
  129. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js +26 -0
  130. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js.map +1 -0
  131. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  132. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  133. package/build/dist/Server/Middleware/UserAuthorization.js +41 -0
  134. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  135. package/build/dist/Server/Services/DashboardDomainService.js +595 -0
  136. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -0
  137. package/build/dist/Server/Services/DashboardService.js +117 -3
  138. package/build/dist/Server/Services/DashboardService.js.map +1 -1
  139. package/build/dist/Server/Services/IncidentService.js +231 -55
  140. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  141. package/build/dist/Server/Services/IncidentStateTimelineService.js +1 -1
  142. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  143. package/build/dist/Server/Services/Index.js +6 -0
  144. package/build/dist/Server/Services/Index.js.map +1 -1
  145. package/build/dist/Server/Services/MonitorService.js +5 -2
  146. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  147. package/build/dist/Server/Services/ProfileAggregationService.js +356 -0
  148. package/build/dist/Server/Services/ProfileAggregationService.js.map +1 -0
  149. package/build/dist/Server/Services/ProfileSampleService.js +9 -0
  150. package/build/dist/Server/Services/ProfileSampleService.js.map +1 -0
  151. package/build/dist/Server/Services/ProfileService.js +9 -0
  152. package/build/dist/Server/Services/ProfileService.js.map +1 -0
  153. package/build/dist/Server/Services/TelemetryUsageBillingService.js +61 -4
  154. package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
  155. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +13 -1
  156. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
  157. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +8 -0
  158. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
  159. package/build/dist/Server/Utils/Cookie.js +36 -0
  160. package/build/dist/Server/Utils/Cookie.js.map +1 -1
  161. package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js +34 -0
  162. package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js.map +1 -0
  163. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +173 -0
  164. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  165. package/build/dist/Server/Utils/Profile/PprofEncoder.js +129 -0
  166. package/build/dist/Server/Utils/Profile/PprofEncoder.js.map +1 -0
  167. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +36 -14
  168. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  169. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +23 -6
  170. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  171. package/build/dist/ServiceRoute.js +1 -0
  172. package/build/dist/ServiceRoute.js.map +1 -1
  173. package/build/dist/Tests/UI/Components/ComponentsModal.test.js +15 -15
  174. package/build/dist/Tests/UI/Components/ComponentsModal.test.js.map +1 -1
  175. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +2 -0
  176. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  177. package/build/dist/Types/CookieName.js +1 -0
  178. package/build/dist/Types/CookieName.js.map +1 -1
  179. package/build/dist/Types/Dashboard/Chart/ChartType.js +5 -0
  180. package/build/dist/Types/Dashboard/Chart/ChartType.js.map +1 -1
  181. package/build/dist/Types/Dashboard/DashboardComponentType.js +4 -0
  182. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  183. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
  184. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
  185. package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js +2 -0
  186. package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js.map +1 -0
  187. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js +2 -0
  188. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js.map +1 -0
  189. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js +2 -0
  190. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js.map +1 -0
  191. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js +2 -0
  192. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js.map +1 -0
  193. package/build/dist/Types/Dashboard/DashboardTemplates.js +853 -0
  194. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -0
  195. package/build/dist/Types/Dashboard/DashboardVariable.js +7 -0
  196. package/build/dist/Types/Dashboard/DashboardVariable.js.map +1 -0
  197. package/build/dist/Types/Dashboard/DashboardViewConfig.js +50 -1
  198. package/build/dist/Types/Dashboard/DashboardViewConfig.js.map +1 -1
  199. package/build/dist/Types/Dashboard/MasterPassword.js +5 -0
  200. package/build/dist/Types/Dashboard/MasterPassword.js.map +1 -0
  201. package/build/dist/Types/Icon/IconProp.js +1 -0
  202. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  203. package/build/dist/Types/Incident/IncidentMetricType.js +3 -0
  204. package/build/dist/Types/Incident/IncidentMetricType.js.map +1 -1
  205. package/build/dist/Types/MeteredPlan/ProductType.js +1 -0
  206. package/build/dist/Types/MeteredPlan/ProductType.js.map +1 -1
  207. package/build/dist/Types/Metrics/MetricQueryConfigData.js +1 -0
  208. package/build/dist/Types/Metrics/MetricQueryConfigData.js.map +1 -1
  209. package/build/dist/Types/Monitor/CriteriaFilter.js +2 -0
  210. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  211. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +58 -7
  212. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  213. package/build/dist/Types/Monitor/MonitorStep.js +15 -0
  214. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  215. package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js +59 -0
  216. package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js.map +1 -0
  217. package/build/dist/Types/Monitor/MonitorType.js +10 -0
  218. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  219. package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js +2 -0
  220. package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js.map +1 -0
  221. package/build/dist/Types/Permission.js +75 -0
  222. package/build/dist/Types/Permission.js.map +1 -1
  223. package/build/dist/Types/Telemetry/TelemetryType.js +1 -0
  224. package/build/dist/Types/Telemetry/TelemetryType.js.map +1 -1
  225. package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js +1 -0
  226. package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js.map +1 -1
  227. package/build/dist/UI/Components/Button/Button.js +1 -1
  228. package/build/dist/UI/Components/Button/Button.js.map +1 -1
  229. package/build/dist/UI/Components/Card/Card.js +4 -4
  230. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  231. package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
  232. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  233. package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
  234. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  235. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +5 -2
  236. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  237. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +5 -2
  238. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  239. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
  240. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  241. package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
  242. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  243. package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js +2 -0
  244. package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js.map +1 -0
  245. package/build/dist/UI/Components/Icon/Icon.js +11 -0
  246. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  247. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +12 -9
  248. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  249. package/build/dist/UI/Components/MoreMenu/MoreMenu.js +8 -2
  250. package/build/dist/UI/Components/MoreMenu/MoreMenu.js.map +1 -1
  251. package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js +4 -4
  252. package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js.map +1 -1
  253. package/build/dist/UI/Components/Workflow/Component.js +311 -143
  254. package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
  255. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +44 -18
  256. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
  257. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +48 -22
  258. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
  259. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +127 -21
  260. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
  261. package/build/dist/UI/Components/Workflow/ComponentsModal.js +107 -52
  262. package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
  263. package/build/dist/UI/Components/Workflow/Workflow.js +87 -12
  264. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  265. package/build/dist/UI/Config.js +3 -1
  266. package/build/dist/UI/Config.js.map +1 -1
  267. package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js +50 -21
  268. package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js.map +1 -1
  269. package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js +104 -0
  270. package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js.map +1 -0
  271. package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js +91 -0
  272. package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js.map +1 -0
  273. package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js +70 -0
  274. package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js.map +1 -0
  275. package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js +28 -7
  276. package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js.map +1 -1
  277. package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js +70 -0
  278. package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js.map +1 -0
  279. package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js +34 -3
  280. package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js.map +1 -1
  281. package/build/dist/Utils/Dashboard/Components/Index.js +16 -0
  282. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  283. package/build/dist/Utils/ValueFormatter.js +132 -0
  284. package/build/dist/Utils/ValueFormatter.js.map +1 -0
  285. package/package.json +1 -1
@@ -0,0 +1,408 @@
1
+ import UserMiddleware from "../Middleware/UserAuthorization";
2
+ import DashboardService, {
3
+ Service as DashboardServiceType,
4
+ } from "../Services/DashboardService";
5
+ import DashboardDomainService from "../Services/DashboardDomainService";
6
+ import CookieUtil from "../Utils/Cookie";
7
+ import logger from "../Utils/Logger";
8
+ import {
9
+ ExpressRequest,
10
+ ExpressResponse,
11
+ NextFunction,
12
+ } from "../Utils/Express";
13
+ import Response from "../Utils/Response";
14
+ import BaseAPI from "./BaseAPI";
15
+ import BadDataException from "../../Types/Exception/BadDataException";
16
+ import NotFoundException from "../../Types/Exception/NotFoundException";
17
+ import HashedString from "../../Types/HashedString";
18
+ import ObjectID from "../../Types/ObjectID";
19
+ import Dashboard from "../../Models/DatabaseModels/Dashboard";
20
+ import DashboardDomain from "../../Models/DatabaseModels/DashboardDomain";
21
+ import { EncryptionSecret } from "../EnvironmentConfig";
22
+ import { DASHBOARD_MASTER_PASSWORD_INVALID_MESSAGE } from "../../Types/Dashboard/MasterPassword";
23
+ import NotAuthenticatedException from "../../Types/Exception/NotAuthenticatedException";
24
+ import ForbiddenException from "../../Types/Exception/ForbiddenException";
25
+ import JSONFunctions from "../../Types/JSONFunctions";
26
+
27
+ export default class DashboardAPI extends BaseAPI<
28
+ Dashboard,
29
+ DashboardServiceType
30
+ > {
31
+ public constructor() {
32
+ super(Dashboard, DashboardService);
33
+
34
+ // SEO endpoint - resolve dashboard by ID or domain
35
+ this.router.get(
36
+ `${new this.entityType()
37
+ .getCrudApiPath()
38
+ ?.toString()}/seo/:dashboardIdOrDomain`,
39
+ UserMiddleware.getUserMiddleware,
40
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
41
+ try {
42
+ const dashboardIdOrDomain: string = req.params[
43
+ "dashboardIdOrDomain"
44
+ ] as string;
45
+
46
+ let dashboardId: ObjectID | null = null;
47
+
48
+ if (dashboardIdOrDomain && dashboardIdOrDomain.includes(".")) {
49
+ // This is a domain - resolve to dashboard ID
50
+ const dashboardDomain: DashboardDomain | null =
51
+ await DashboardDomainService.findOneBy({
52
+ query: {
53
+ fullDomain: dashboardIdOrDomain,
54
+ domain: {
55
+ isVerified: true,
56
+ } as any,
57
+ },
58
+ select: {
59
+ dashboardId: true,
60
+ },
61
+ props: {
62
+ isRoot: true,
63
+ },
64
+ });
65
+
66
+ if (!dashboardDomain || !dashboardDomain.dashboardId) {
67
+ return Response.sendErrorResponse(
68
+ req,
69
+ res,
70
+ new NotFoundException("Dashboard not found"),
71
+ );
72
+ }
73
+
74
+ dashboardId = dashboardDomain.dashboardId;
75
+ } else {
76
+ try {
77
+ dashboardId = new ObjectID(dashboardIdOrDomain);
78
+ } catch (err) {
79
+ logger.error(err);
80
+ return Response.sendErrorResponse(
81
+ req,
82
+ res,
83
+ new BadDataException("Invalid dashboard ID"),
84
+ );
85
+ }
86
+ }
87
+
88
+ const dashboard: Dashboard | null =
89
+ await DashboardService.findOneById({
90
+ id: dashboardId,
91
+ select: {
92
+ _id: true,
93
+ name: true,
94
+ description: true,
95
+ pageTitle: true,
96
+ pageDescription: true,
97
+ },
98
+ props: {
99
+ isRoot: true,
100
+ },
101
+ });
102
+
103
+ if (!dashboard) {
104
+ return Response.sendErrorResponse(
105
+ req,
106
+ res,
107
+ new NotFoundException("Dashboard not found"),
108
+ );
109
+ }
110
+
111
+ return Response.sendJsonObjectResponse(req, res, {
112
+ _id: dashboard._id?.toString() || "",
113
+ title: dashboard.pageTitle || dashboard.name || "Dashboard",
114
+ description:
115
+ dashboard.pageDescription ||
116
+ dashboard.description ||
117
+ "View dashboard metrics and insights.",
118
+ });
119
+ } catch (err) {
120
+ next(err);
121
+ }
122
+ },
123
+ );
124
+
125
+ // Domain resolution endpoint
126
+ this.router.post(
127
+ `${new this.entityType().getCrudApiPath()?.toString()}/domain`,
128
+ UserMiddleware.getUserMiddleware,
129
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
130
+ try {
131
+ if (!req.body["domain"]) {
132
+ throw new BadDataException("domain is required in request body");
133
+ }
134
+
135
+ const domain: string = req.body["domain"] as string;
136
+
137
+ const dashboardDomain: DashboardDomain | null =
138
+ await DashboardDomainService.findOneBy({
139
+ query: {
140
+ fullDomain: domain,
141
+ domain: {
142
+ isVerified: true,
143
+ } as any,
144
+ },
145
+ select: {
146
+ dashboardId: true,
147
+ },
148
+ props: {
149
+ isRoot: true,
150
+ },
151
+ });
152
+
153
+ if (!dashboardDomain) {
154
+ throw new BadDataException("No dashboard found with this domain");
155
+ }
156
+
157
+ const objectId: ObjectID = dashboardDomain.dashboardId!;
158
+
159
+ return Response.sendJsonObjectResponse(req, res, {
160
+ dashboardId: objectId.toString(),
161
+ });
162
+ } catch (err) {
163
+ next(err);
164
+ }
165
+ },
166
+ );
167
+
168
+ // Metadata endpoint - returns dashboard info for the public viewer
169
+ this.router.post(
170
+ `${new this.entityType()
171
+ .getCrudApiPath()
172
+ ?.toString()}/metadata/:dashboardId`,
173
+ UserMiddleware.getUserMiddleware,
174
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
175
+ try {
176
+ const dashboardId: ObjectID = new ObjectID(
177
+ req.params["dashboardId"] as string,
178
+ );
179
+
180
+ const dashboard: Dashboard | null =
181
+ await DashboardService.findOneById({
182
+ id: dashboardId,
183
+ select: {
184
+ _id: true,
185
+ name: true,
186
+ description: true,
187
+ isPublicDashboard: true,
188
+ enableMasterPassword: true,
189
+ pageTitle: true,
190
+ pageDescription: true,
191
+ logoFile: {
192
+ file: true,
193
+ fileType: true,
194
+ },
195
+ faviconFile: {
196
+ file: true,
197
+ fileType: true,
198
+ },
199
+ },
200
+ props: {
201
+ isRoot: true,
202
+ },
203
+ });
204
+
205
+ if (!dashboard) {
206
+ throw new NotFoundException("Dashboard not found");
207
+ }
208
+
209
+ return Response.sendJsonObjectResponse(req, res, {
210
+ _id: dashboard._id?.toString() || "",
211
+ name: dashboard.name || "Dashboard",
212
+ description: dashboard.description || "",
213
+ isPublicDashboard: dashboard.isPublicDashboard || false,
214
+ enableMasterPassword: dashboard.enableMasterPassword || false,
215
+ pageTitle: dashboard.pageTitle || "",
216
+ pageDescription: dashboard.pageDescription || "",
217
+ logoFile: DashboardAPI.getFileAsBase64JSONObject(
218
+ dashboard.logoFile,
219
+ ),
220
+ faviconFile: DashboardAPI.getFileAsBase64JSONObject(
221
+ dashboard.faviconFile,
222
+ ),
223
+ });
224
+ } catch (err) {
225
+ next(err);
226
+ }
227
+ },
228
+ );
229
+
230
+ // Public view-config endpoint - returns dashboard view config for the public viewer
231
+ this.router.post(
232
+ `${new this.entityType()
233
+ .getCrudApiPath()
234
+ ?.toString()}/view-config/:dashboardId`,
235
+ UserMiddleware.getUserMiddleware,
236
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
237
+ try {
238
+ const dashboardId: ObjectID = new ObjectID(
239
+ req.params["dashboardId"] as string,
240
+ );
241
+
242
+ // Check read access (handles public check, IP whitelist, master password)
243
+ const accessResult: {
244
+ hasReadAccess: boolean;
245
+ error?: NotAuthenticatedException | ForbiddenException;
246
+ } = await DashboardService.hasReadAccess({
247
+ dashboardId,
248
+ req,
249
+ });
250
+
251
+ if (!accessResult.hasReadAccess) {
252
+ throw (
253
+ accessResult.error ||
254
+ new BadDataException("Access denied to this dashboard.")
255
+ );
256
+ }
257
+
258
+ const dashboard: Dashboard | null =
259
+ await DashboardService.findOneById({
260
+ id: dashboardId,
261
+ select: {
262
+ _id: true,
263
+ name: true,
264
+ description: true,
265
+ dashboardViewConfig: true,
266
+ pageTitle: true,
267
+ pageDescription: true,
268
+ logoFile: {
269
+ file: true,
270
+ fileType: true,
271
+ },
272
+ },
273
+ props: {
274
+ isRoot: true,
275
+ },
276
+ });
277
+
278
+ if (!dashboard) {
279
+ throw new NotFoundException("Dashboard not found");
280
+ }
281
+
282
+ return Response.sendJsonObjectResponse(req, res, {
283
+ _id: dashboard._id?.toString() || "",
284
+ name: dashboard.name || "Dashboard",
285
+ description: dashboard.description || "",
286
+ pageTitle: dashboard.pageTitle || "",
287
+ pageDescription: dashboard.pageDescription || "",
288
+ logoFile: DashboardAPI.getFileAsBase64JSONObject(
289
+ dashboard.logoFile,
290
+ ),
291
+ dashboardViewConfig: dashboard.dashboardViewConfig
292
+ ? JSONFunctions.serialize(dashboard.dashboardViewConfig as any)
293
+ : null,
294
+ });
295
+ } catch (err) {
296
+ next(err);
297
+ }
298
+ },
299
+ );
300
+
301
+ this.router.post(
302
+ `${new this.entityType()
303
+ .getCrudApiPath()
304
+ ?.toString()}/master-password/:dashboardId`,
305
+ UserMiddleware.getUserMiddleware,
306
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
307
+ try {
308
+ if (!req.params["dashboardId"]) {
309
+ throw new BadDataException("Dashboard ID not found");
310
+ }
311
+
312
+ const dashboardId: ObjectID = new ObjectID(
313
+ req.params["dashboardId"] as string,
314
+ );
315
+
316
+ const password: string | undefined =
317
+ req.body && (req.body["password"] as string);
318
+
319
+ if (!password) {
320
+ throw new BadDataException("Master password is required.");
321
+ }
322
+
323
+ const dashboard: Dashboard | null =
324
+ await DashboardService.findOneById({
325
+ id: dashboardId,
326
+ select: {
327
+ _id: true,
328
+ projectId: true,
329
+ enableMasterPassword: true,
330
+ masterPassword: true,
331
+ isPublicDashboard: true,
332
+ },
333
+ props: {
334
+ isRoot: true,
335
+ },
336
+ });
337
+
338
+ if (!dashboard) {
339
+ throw new NotFoundException("Dashboard not found");
340
+ }
341
+
342
+ if (!dashboard.isPublicDashboard) {
343
+ throw new BadDataException(
344
+ "This dashboard is not publicly accessible.",
345
+ );
346
+ }
347
+
348
+ if (!dashboard.enableMasterPassword || !dashboard.masterPassword) {
349
+ throw new BadDataException(
350
+ "Master password has not been configured for this dashboard.",
351
+ );
352
+ }
353
+
354
+ const hashedInput: string = await HashedString.hashValue(
355
+ password,
356
+ EncryptionSecret,
357
+ );
358
+
359
+ if (hashedInput !== dashboard.masterPassword.toString()) {
360
+ throw new BadDataException(
361
+ DASHBOARD_MASTER_PASSWORD_INVALID_MESSAGE,
362
+ );
363
+ }
364
+
365
+ CookieUtil.setDashboardMasterPasswordCookie({
366
+ expressResponse: res,
367
+ dashboardId,
368
+ });
369
+
370
+ return Response.sendEmptySuccessResponse(req, res);
371
+ } catch (err) {
372
+ next(err);
373
+ }
374
+ },
375
+ );
376
+ }
377
+
378
+ private static getFileAsBase64JSONObject(
379
+ file: any,
380
+ ): { file: string; fileType: string } | null {
381
+ if (!file || !file.file) {
382
+ return null;
383
+ }
384
+
385
+ let base64: string;
386
+ const fileBuffer: any = file.file;
387
+
388
+ if (Buffer.isBuffer(fileBuffer)) {
389
+ base64 = fileBuffer.toString("base64");
390
+ } else if (
391
+ fileBuffer &&
392
+ typeof fileBuffer === "object" &&
393
+ fileBuffer.value &&
394
+ fileBuffer.value.data
395
+ ) {
396
+ base64 = Buffer.from(fileBuffer.value.data).toString("base64");
397
+ } else if (typeof fileBuffer === "string") {
398
+ base64 = fileBuffer;
399
+ } else {
400
+ return null;
401
+ }
402
+
403
+ return {
404
+ file: base64,
405
+ fileType: (file.fileType as string) || "image/png",
406
+ };
407
+ }
408
+ }
@@ -0,0 +1,235 @@
1
+ import { DashboardCNameRecord } from "../EnvironmentConfig";
2
+ import UserMiddleware from "../Middleware/UserAuthorization";
3
+ import DashboardDomainService, {
4
+ Service as DashboardDomainServiceType,
5
+ } from "../Services/DashboardDomainService";
6
+ import {
7
+ ExpressRequest,
8
+ ExpressResponse,
9
+ NextFunction,
10
+ } from "../Utils/Express";
11
+ import logger from "../Utils/Logger";
12
+ import Response from "../Utils/Response";
13
+ import BaseAPI from "./BaseAPI";
14
+ import CommonAPI from "./CommonAPI";
15
+ import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
16
+ import BadDataException from "../../Types/Exception/BadDataException";
17
+ import ObjectID from "../../Types/ObjectID";
18
+ import PositiveNumber from "../../Types/PositiveNumber";
19
+ import DashboardDomain from "../../Models/DatabaseModels/DashboardDomain";
20
+
21
+ export default class DashboardDomainAPI extends BaseAPI<
22
+ DashboardDomain,
23
+ DashboardDomainServiceType
24
+ > {
25
+ public constructor() {
26
+ super(DashboardDomain, DashboardDomainService);
27
+
28
+ // CNAME verification api
29
+ this.router.get(
30
+ `${new this.entityType().getCrudApiPath()?.toString()}/verify-cname/:id`,
31
+ UserMiddleware.getUserMiddleware,
32
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
33
+ try {
34
+ if (!DashboardCNameRecord) {
35
+ return Response.sendErrorResponse(
36
+ req,
37
+ res,
38
+ new BadDataException(
39
+ `Custom Domains not enabled for this
40
+ OneUptime installation. Please contact
41
+ your server admin to enable this
42
+ feature.`,
43
+ ),
44
+ );
45
+ }
46
+
47
+ const databaseProps: DatabaseCommonInteractionProps =
48
+ await CommonAPI.getDatabaseCommonInteractionProps(req);
49
+
50
+ const id: ObjectID = new ObjectID(req.params["id"] as string);
51
+
52
+ const domainCount: PositiveNumber =
53
+ await DashboardDomainService.countBy({
54
+ query: {
55
+ _id: id.toString(),
56
+ },
57
+ props: databaseProps,
58
+ });
59
+
60
+ if (domainCount.toNumber() === 0) {
61
+ return Response.sendErrorResponse(
62
+ req,
63
+ res,
64
+ new BadDataException(
65
+ "The domain does not exist or user does not have access to it.",
66
+ ),
67
+ );
68
+ }
69
+
70
+ const domain: DashboardDomain | null =
71
+ await DashboardDomainService.findOneBy({
72
+ query: {
73
+ _id: id.toString(),
74
+ },
75
+ select: {
76
+ _id: true,
77
+ fullDomain: true,
78
+ },
79
+ props: {
80
+ isRoot: true,
81
+ },
82
+ });
83
+
84
+ if (!domain) {
85
+ return Response.sendErrorResponse(
86
+ req,
87
+ res,
88
+ new BadDataException("Invalid token."),
89
+ );
90
+ }
91
+
92
+ if (!domain.fullDomain) {
93
+ return Response.sendErrorResponse(
94
+ req,
95
+ res,
96
+ new BadDataException("Invalid domain."),
97
+ );
98
+ }
99
+
100
+ const isValid: boolean = await DashboardDomainService.isCnameValid(
101
+ domain.fullDomain!,
102
+ );
103
+
104
+ if (!isValid) {
105
+ return Response.sendErrorResponse(
106
+ req,
107
+ res,
108
+ new BadDataException(
109
+ "CNAME is not verified. Please make sure you have the correct record and please verify CNAME again. If you are sure that the record is correct, please wait for some time for the DNS to propagate.",
110
+ ),
111
+ );
112
+ }
113
+
114
+ return Response.sendEmptySuccessResponse(req, res);
115
+ } catch (e) {
116
+ next(e);
117
+ }
118
+ },
119
+ );
120
+
121
+ // Provision SSL API
122
+ this.router.get(
123
+ `${new this.entityType().getCrudApiPath()?.toString()}/order-ssl/:id`,
124
+ UserMiddleware.getUserMiddleware,
125
+ async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
126
+ try {
127
+ if (!DashboardCNameRecord) {
128
+ return Response.sendErrorResponse(
129
+ req,
130
+ res,
131
+ new BadDataException(
132
+ `Custom Domains not enabled for this
133
+ OneUptime installation. Please contact
134
+ your server admin to enable this
135
+ feature.`,
136
+ ),
137
+ );
138
+ }
139
+
140
+ const databaseProps: DatabaseCommonInteractionProps =
141
+ await CommonAPI.getDatabaseCommonInteractionProps(req);
142
+
143
+ const id: ObjectID = new ObjectID(req.params["id"] as string);
144
+
145
+ const domainCount: PositiveNumber =
146
+ await DashboardDomainService.countBy({
147
+ query: {
148
+ _id: id.toString(),
149
+ },
150
+ props: databaseProps,
151
+ });
152
+
153
+ if (domainCount.toNumber() === 0) {
154
+ return Response.sendErrorResponse(
155
+ req,
156
+ res,
157
+ new BadDataException(
158
+ "The domain does not exist or user does not have access to it.",
159
+ ),
160
+ );
161
+ }
162
+
163
+ const domain: DashboardDomain | null =
164
+ await DashboardDomainService.findOneBy({
165
+ query: {
166
+ _id: id.toString(),
167
+ },
168
+ select: {
169
+ _id: true,
170
+ fullDomain: true,
171
+ cnameVerificationToken: true,
172
+ isCnameVerified: true,
173
+ isSslProvisioned: true,
174
+ },
175
+ props: {
176
+ isRoot: true,
177
+ },
178
+ });
179
+
180
+ if (!domain) {
181
+ return Response.sendErrorResponse(
182
+ req,
183
+ res,
184
+ new BadDataException("Invalid token."),
185
+ );
186
+ }
187
+
188
+ if (!domain.cnameVerificationToken) {
189
+ return Response.sendErrorResponse(
190
+ req,
191
+ res,
192
+ new BadDataException("Invalid token."),
193
+ );
194
+ }
195
+
196
+ if (!domain.isCnameVerified) {
197
+ return Response.sendErrorResponse(
198
+ req,
199
+ res,
200
+ new BadDataException(
201
+ "CNAME is not verified. Please verify CNAME first before you provision SSL.",
202
+ ),
203
+ );
204
+ }
205
+
206
+ if (domain.isSslProvisioned) {
207
+ return Response.sendErrorResponse(
208
+ req,
209
+ res,
210
+ new BadDataException("SSL is already provisioned."),
211
+ );
212
+ }
213
+
214
+ if (!domain.fullDomain) {
215
+ return Response.sendErrorResponse(
216
+ req,
217
+ res,
218
+ new BadDataException("Invalid domain."),
219
+ );
220
+ }
221
+
222
+ logger.debug("Ordering SSL");
223
+
224
+ await DashboardDomainService.orderCert(domain);
225
+
226
+ logger.debug("SSL Provisioned for domain - " + domain.fullDomain);
227
+
228
+ return Response.sendEmptySuccessResponse(req, res);
229
+ } catch (e) {
230
+ next(e);
231
+ }
232
+ },
233
+ );
234
+ }
235
+ }
@@ -1443,7 +1443,33 @@ export default class StatusPageAPI extends BaseAPI<
1443
1443
  req: req,
1444
1444
  });
1445
1445
 
1446
- const startDate: Date = OneUptimeDate.getSomeDaysAgo(90);
1446
+ // First fetch the status page to get the configured uptime history days
1447
+ const statusPageForDays: StatusPage | null =
1448
+ await StatusPageService.findOneBy({
1449
+ query: {
1450
+ _id: statusPageId.toString(),
1451
+ },
1452
+ select: {
1453
+ showUptimeHistoryInDays: true,
1454
+ },
1455
+ props: {
1456
+ isRoot: true,
1457
+ },
1458
+ });
1459
+
1460
+ let uptimeHistoryDays: number =
1461
+ statusPageForDays?.showUptimeHistoryInDays || 90;
1462
+
1463
+ if (uptimeHistoryDays > 90) {
1464
+ uptimeHistoryDays = 90;
1465
+ }
1466
+
1467
+ if (uptimeHistoryDays < 1) {
1468
+ uptimeHistoryDays = 1;
1469
+ }
1470
+
1471
+ const startDate: Date =
1472
+ OneUptimeDate.getSomeDaysAgo(uptimeHistoryDays);
1447
1473
  const endDate: Date = OneUptimeDate.getCurrentDate();
1448
1474
 
1449
1475
  const {
@@ -2208,7 +2234,14 @@ export default class StatusPageAPI extends BaseAPI<
2208
2234
  incidentStateTimelines,
2209
2235
  IncidentStateTimeline,
2210
2236
  ),
2211
- statusPage: BaseModel.toJSONObject(statusPage, StatusPage),
2237
+ statusPage: (() => {
2238
+ const statusPageJson: JSONObject = BaseModel.toJSONObject(
2239
+ statusPage,
2240
+ StatusPage,
2241
+ );
2242
+ delete statusPageJson["projectId"];
2243
+ return statusPageJson;
2244
+ })(),
2212
2245
  scheduledMaintenanceStateTimelines: BaseModel.toJSONArray(
2213
2246
  scheduledMaintenanceStateTimelines,
2214
2247
  ScheduledMaintenanceStateTimeline,
@@ -4448,6 +4481,7 @@ export default class StatusPageAPI extends BaseAPI<
4448
4481
  showIncidentsOnStatusPage: true,
4449
4482
  showEpisodesOnStatusPage: true,
4450
4483
  showScheduledMaintenanceEventsOnStatusPage: true,
4484
+ showUptimeHistoryInDays: true,
4451
4485
  },
4452
4486
  props: {
4453
4487
  isRoot: true,