@oneuptime/common 11.7.0 → 11.7.2
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.
- package/Models/DatabaseModels/DashboardDomain.ts +1 -0
- package/Models/DatabaseModels/Incident.ts +2 -0
- package/Models/DatabaseModels/IncidentEpisode.ts +1 -0
- package/Models/DatabaseModels/IncidentEpisodePublicNote.ts +1 -0
- package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +1 -0
- package/Models/DatabaseModels/IncidentPublicNote.ts +1 -0
- package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -0
- package/Models/DatabaseModels/Monitor.ts +1 -0
- package/Models/DatabaseModels/MonitorStatusTimeline.ts +1 -0
- package/Models/DatabaseModels/NetworkSite.ts +1 -0
- package/Models/DatabaseModels/NetworkSiteStatusTimeline.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.ts +2 -0
- package/Models/DatabaseModels/Probe.ts +13 -13
- package/Models/DatabaseModels/ScheduledMaintenance.ts +1 -0
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.ts +1 -0
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.ts +1 -0
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.ts +1 -0
- package/Models/DatabaseModels/StatusPage.ts +1 -0
- package/Models/DatabaseModels/StatusPageAnnouncement.ts +1 -0
- package/Models/DatabaseModels/StatusPageDomain.ts +1 -0
- package/Models/DatabaseModels/WorkspaceNotificationSummary.ts +1 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +11 -0
- package/Server/API/BaseAPI.ts +17 -1
- package/Server/API/CommonAPI.ts +32 -0
- package/Server/API/MicrosoftTeamsAPI.ts +99 -2
- package/Server/API/ProbeAPI.ts +2 -0
- package/Server/API/SlackAPI.ts +62 -0
- package/Server/API/StatusPageAPI.ts +157 -192
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785140242697-AddHotQueryIndexes.ts +89 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785148065137-AddHotQueryIndexesSecondPass.ts +61 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1785240000000-RepairCrossProjectMonitorStatusReferences.ts +280 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/DatabaseService.ts +11 -3
- package/Server/Services/MonitorGroupService.ts +145 -0
- package/Server/Services/MonitorService.ts +231 -30
- package/Server/Services/ProbeService.ts +319 -16
- package/Server/Services/StatusPageService.ts +72 -42
- package/Server/Services/WorkspaceNotificationRuleService.ts +232 -2
- package/Server/Utils/Database/PostgresErrorTranslator.ts +131 -0
- package/Server/Utils/Monitor/MonitorResource.ts +88 -35
- package/Server/Utils/Monitor/MonitorStatusTimeline.ts +21 -1
- package/Server/Utils/Monitor/MonitorStepsProjectValidator.ts +158 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +706 -6
- package/Tests/Models/DatabaseModels/ProbeColumnAccessControl.test.ts +103 -0
- package/Tests/Server/API/BaseAPIUpdateNoOp.test.ts +135 -0
- package/Tests/Server/API/CommonAPIAuthGuard.test.ts +317 -0
- package/Tests/Server/API/MicrosoftTeamsManifest.test.ts +228 -0
- package/Tests/Server/API/ProbeAPI.test.ts +6 -0
- package/Tests/Server/API/ZZVerifyChatsAuth.test.ts +167 -0
- package/Tests/Server/Services/AddHotQueryIndexesMigration.test.ts +255 -0
- package/Tests/Server/Services/AddHotQueryIndexesSecondPassMigration.test.ts +258 -0
- package/Tests/Server/Services/DatabaseServiceSanitizeUpdateData.test.ts +1 -1
- package/Tests/Server/Services/DiscoveryScanClaimHookFreeSafety.test.ts +121 -0
- package/Tests/Server/Services/HeartbeatWriteFastPathSafety.test.ts +200 -0
- package/Tests/Server/Services/HookFreeWriteSafetySecondPass.test.ts +181 -0
- package/Tests/Server/Services/MonitorGroupServiceBatchedStatuses.test.ts +513 -0
- package/Tests/Server/Services/MonitorResourceProbeAgreementReuse.test.ts +492 -0
- package/Tests/Server/Services/MonitorServiceProbeSelection.test.ts +401 -0
- package/Tests/Server/Services/MonitorStatusTimelineFastPath.test.ts +453 -0
- package/Tests/Server/Services/ProbeAuthKeyCacheAndHeartbeat.test.ts +679 -0
- package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +3 -3
- package/Tests/Server/Services/StatusPageDomainResolutionCache.test.ts +245 -0
- package/Tests/Server/Services/StatusPageOverviewTimelineWindow.test.ts +283 -0
- package/Tests/Server/Services/StatusPageServiceMcp.test.ts +17 -1
- package/Tests/Server/Services/StatusPageServiceMonitorGroupBatching.test.ts +331 -0
- package/Tests/Server/Services/UserOnCallLogClaimNotificationRule.test.ts +12 -12
- package/Tests/Server/Services/WorkspaceNotificationRuleChats.test.ts +1390 -0
- package/Tests/Server/Utils/AI/Insights/InsightFixRouting.test.ts +4 -4
- package/Tests/Server/Utils/AI/Insights/InsightScanner.test.ts +2 -2
- package/Tests/Server/Utils/AI/Insights/InsightStore.test.ts +1 -3
- package/Tests/Server/Utils/AI/Insights/InsightStoreHardening.test.ts +1 -3
- package/Tests/Server/Utils/AI/Insights/InsightTriage.test.ts +1 -1
- package/Tests/Server/Utils/AI/Insights/InsightTriageRunner.test.ts +5 -5
- package/Tests/Server/Utils/Alert/AlertPrivacyFilter.test.ts +187 -0
- package/Tests/Server/Utils/AlertEpisode/AlertEpisodePrivacyFilter.test.ts +170 -0
- package/Tests/Server/Utils/Database/PostgresErrorTranslator.test.ts +125 -0
- package/Tests/Server/Utils/Incident/IncidentPrivacyFilter.test.ts +264 -0
- package/Tests/Server/Utils/IncidentEpisode/IncidentEpisodePrivacyFilter.test.ts +175 -0
- package/Tests/Server/Utils/Monitor/MonitorStepsProjectValidator.test.ts +181 -0
- package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +1 -1
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +2 -2
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsChannelsList.test.ts +341 -0
- package/Tests/Server/Utils/Workspace/MicrosoftTeamsChats.test.ts +2175 -0
- package/Tests/Server/Utils/Workspace/SlackChannelsList.test.ts +585 -0
- package/Tests/Types/Billing/MeteredPlan.test.ts +46 -0
- package/Tests/Types/DateUserTimezone.test.ts +205 -0
- package/Tests/Types/DateUserTimezoneOverridesBrowser.test.ts +73 -0
- package/Tests/Types/Workspace/NotificationRules/NotificationRuleCondition.test.ts +219 -1
- package/Tests/UI/Components/BulkUpdateForm.test.tsx +174 -0
- package/Tests/UI/Components/CardModelDetailEdit.test.tsx +315 -0
- package/Tests/UI/Components/ModelDetailSelect.test.tsx +229 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableBulkSelectAll.test.tsx +1258 -0
- package/Tests/UI/Components/ModelTableExportFromColumns.test.ts +153 -0
- package/Tests/UI/Components/MonacoLoader.test.ts +67 -0
- package/Tests/UI/Components/MonacoRuntime.test.ts +121 -0
- package/Tests/UI/Components/TableBulkCsvExport.test.tsx +212 -3
- package/Tests/UI/Components/TimePicker/TimePicker.test.tsx +11 -0
- package/Tests/UI/Utils/Project.test.ts +809 -0
- package/Tests/UI/Utils/TableColumnsToCsv.test.ts +360 -0
- package/Tests/Utils/Alerts/AlertMetricType.test.ts +143 -0
- package/Tests/Utils/Dashboard/VariableUrlState.test.ts +219 -0
- package/Tests/Utils/Incident/IncidentMetricType.test.ts +174 -0
- package/Tests/Utils/Monitor/MonitorProbeSelectionUtil.test.ts +145 -0
- package/Tests/Utils/StatusPage/ResourceUptime.test.ts +263 -0
- package/Types/Date.ts +119 -50
- package/Types/Workspace/NotificationRules/BaseNotificationRule.ts +4 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +25 -10
- package/Types/Workspace/WorkspaceMessagePayload.ts +1 -0
- package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +63 -8
- package/UI/Components/CodeEditor/CodeEditor.tsx +3 -0
- package/UI/Components/CodeEditor/MonacoLoader.ts +36 -0
- package/UI/Components/Forms/Fields/FormField.tsx +13 -3
- package/UI/Components/Forms/ModelForm.tsx +41 -18
- package/UI/Components/Input/Input.tsx +6 -1
- package/UI/Components/ModelDetail/CardModelDetail.tsx +23 -1
- package/UI/Components/ModelDetail/ModelDetail.tsx +46 -1
- package/UI/Components/ModelTable/BaseModelTable.tsx +300 -30
- package/UI/Components/ModelTable/Column.ts +12 -0
- package/UI/Components/ModelTable/ExportFromColumns.ts +57 -0
- package/UI/Components/Navbar/NavBar.tsx +66 -1
- package/UI/Components/Table/Table.tsx +52 -13
- package/UI/Components/Table/Types/Column.ts +18 -0
- package/UI/Components/TimePicker/TimePicker.tsx +8 -4
- package/UI/Utils/Project.ts +214 -18
- package/UI/Utils/TableColumnsToCsv.ts +86 -6
- package/UI/Utils/User.ts +19 -0
- package/UI/esbuild-config.js +34 -0
- package/Utils/Monitor/MonitorProbeSelectionUtil.ts +72 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js +1 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Incident.js +2 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodePublicNote.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentPublicNote.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentPublicNote.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +1 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorStatusTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkSite.js +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +1 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js +2 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Probe.js +13 -13
- package/build/dist/Models/DatabaseModels/Probe.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenancePublicNote.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +1 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +1 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageAnnouncement.js +1 -0
- package/build/dist/Models/DatabaseModels/StatusPageAnnouncement.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +1 -0
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationSummary.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +12 -1
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/CommonAPI.js +21 -0
- package/build/dist/Server/API/CommonAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +72 -2
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -1
- package/build/dist/Server/API/ProbeAPI.js +2 -0
- package/build/dist/Server/API/ProbeAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +44 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +98 -152
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785140242697-AddHotQueryIndexes.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785140242697-AddHotQueryIndexes.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785148065137-AddHotQueryIndexesSecondPass.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785148065137-AddHotQueryIndexesSecondPass.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785240000000-RepairCrossProjectMonitorStatusReferences.js +254 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785240000000-RepairCrossProjectMonitorStatusReferences.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +10 -2
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/MonitorGroupService.js +118 -0
- package/build/dist/Server/Services/MonitorGroupService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +198 -24
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +238 -9
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +46 -39
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +178 -3
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Utils/Database/PostgresErrorTranslator.js +80 -0
- package/build/dist/Server/Utils/Database/PostgresErrorTranslator.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +67 -29
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js +31 -14
- package/build/dist/Server/Utils/Monitor/MonitorStatusTimeline.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepsProjectValidator.js +117 -0
- package/build/dist/Server/Utils/Monitor/MonitorStepsProjectValidator.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +549 -7
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Types/Date.js +106 -35
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +17 -7
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js +37 -11
- package/build/dist/UI/Components/BulkUpdate/BulkUpdateForm.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js +2 -0
- package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
- package/build/dist/UI/Components/CodeEditor/MonacoLoader.js +34 -0
- package/build/dist/UI/Components/CodeEditor/MonacoLoader.js.map +1 -0
- package/build/dist/UI/Components/Forms/Fields/FormField.js +11 -3
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/ModelForm.js +37 -17
- package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
- package/build/dist/UI/Components/Input/Input.js +6 -1
- package/build/dist/UI/Components/Input/Input.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js +22 -1
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/ModelDetail.js +31 -1
- package/build/dist/UI/Components/ModelDetail/ModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +234 -21
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/ExportFromColumns.js +30 -0
- package/build/dist/UI/Components/ModelTable/ExportFromColumns.js.map +1 -0
- package/build/dist/UI/Components/Navbar/NavBar.js +39 -1
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Table/Table.js +31 -11
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Components/TimePicker/TimePicker.js +4 -4
- package/build/dist/UI/Components/TimePicker/TimePicker.js.map +1 -1
- package/build/dist/UI/Utils/Project.js +161 -15
- package/build/dist/UI/Utils/Project.js.map +1 -1
- package/build/dist/UI/Utils/TableColumnsToCsv.js +67 -6
- package/build/dist/UI/Utils/TableColumnsToCsv.js.map +1 -1
- package/build/dist/UI/Utils/User.js +19 -0
- package/build/dist/UI/Utils/User.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorProbeSelectionUtil.js +52 -0
- package/build/dist/Utils/Monitor/MonitorProbeSelectionUtil.js.map +1 -0
- package/package.json +4 -3
- package/Server/Infrastructure/Postgres/SchemaMigrations/1773414578773-MigrationName.ts +0 -79
- package/Server/Infrastructure/Postgres/SchemaMigrations/1773500000000-MigrationName.ts +0 -41
- package/Server/Infrastructure/Postgres/SchemaMigrations/1776886248361-MigrationName.ts +0 -17
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773414578773-MigrationName.js +0 -34
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773414578773-MigrationName.js.map +0 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773500000000-MigrationName.js +0 -22
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773500000000-MigrationName.js.map +0 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776886248361-MigrationName.js +0 -12
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776886248361-MigrationName.js.map +0 -1
|
@@ -379,6 +379,7 @@ export default class DashboardDomain extends BaseModel {
|
|
|
379
379
|
"Full domain of your dashboard (like dashboard.acmeinc.com). This is autogenerated and is derived from subdomain and domain.",
|
|
380
380
|
example: "dashboard.acmeinc.com",
|
|
381
381
|
})
|
|
382
|
+
@Index()
|
|
382
383
|
@Column({
|
|
383
384
|
nullable: false,
|
|
384
385
|
type: ColumnType.ShortText,
|
|
@@ -1678,6 +1678,7 @@ export default class Incident extends BaseModel {
|
|
|
1678
1678
|
"Status of notification sent to subscribers about this incident",
|
|
1679
1679
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
1680
1680
|
})
|
|
1681
|
+
@Index()
|
|
1681
1682
|
@Column({
|
|
1682
1683
|
type: ColumnType.ShortText,
|
|
1683
1684
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -1764,6 +1765,7 @@ export default class Incident extends BaseModel {
|
|
|
1764
1765
|
"Status of notification sent to subscribers about this incident postmortem",
|
|
1765
1766
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
1766
1767
|
})
|
|
1768
|
+
@Index()
|
|
1767
1769
|
@Column({
|
|
1768
1770
|
type: ColumnType.ShortText,
|
|
1769
1771
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -1657,6 +1657,7 @@ export default class IncidentEpisode extends BaseModel {
|
|
|
1657
1657
|
"Status of notification sent to subscribers when this episode was created",
|
|
1658
1658
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
1659
1659
|
})
|
|
1660
|
+
@Index()
|
|
1660
1661
|
@Column({
|
|
1661
1662
|
type: ColumnType.ShortText,
|
|
1662
1663
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -504,6 +504,7 @@ export default class IncidentEpisodePublicNote extends BaseModel {
|
|
|
504
504
|
description: "Status of notification sent to subscribers about this note",
|
|
505
505
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
506
506
|
})
|
|
507
|
+
@Index()
|
|
507
508
|
@Column({
|
|
508
509
|
type: ColumnType.ShortText,
|
|
509
510
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -671,6 +671,7 @@ export default class IncidentEpisodeStateTimeline extends BaseModel {
|
|
|
671
671
|
"Status of notification sent to subscribers about this state change",
|
|
672
672
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
673
673
|
})
|
|
674
|
+
@Index()
|
|
674
675
|
@Column({
|
|
675
676
|
type: ColumnType.ShortText,
|
|
676
677
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -507,6 +507,7 @@ export default class IncidentPublicNote extends BaseModel {
|
|
|
507
507
|
description: "Status of notification sent to subscribers about this note",
|
|
508
508
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
509
509
|
})
|
|
510
|
+
@Index()
|
|
510
511
|
@Column({
|
|
511
512
|
type: ColumnType.ShortText,
|
|
512
513
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -506,6 +506,7 @@ export default class IncidentStateTimeline extends BaseModel {
|
|
|
506
506
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
507
507
|
example: "Sent",
|
|
508
508
|
})
|
|
509
|
+
@Index()
|
|
509
510
|
@Column({
|
|
510
511
|
type: ColumnType.ShortText,
|
|
511
512
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -690,6 +690,7 @@ export default class OnCallDutyPolicySchedule extends BaseModel {
|
|
|
690
690
|
"When does the roster handoff occur for this schedule for the current user?",
|
|
691
691
|
example: "2024-01-15T18:00:00.000Z",
|
|
692
692
|
})
|
|
693
|
+
@Index()
|
|
693
694
|
@Column({
|
|
694
695
|
type: ColumnType.Date,
|
|
695
696
|
nullable: true,
|
|
@@ -744,6 +745,7 @@ export default class OnCallDutyPolicySchedule extends BaseModel {
|
|
|
744
745
|
"When does the next event start for this schedule for the next user?",
|
|
745
746
|
example: "2024-01-22T09:00:00.000Z",
|
|
746
747
|
})
|
|
748
|
+
@Index()
|
|
747
749
|
@Column({
|
|
748
750
|
type: ColumnType.Date,
|
|
749
751
|
nullable: true,
|
|
@@ -285,7 +285,7 @@ export default class Probe extends BaseModel {
|
|
|
285
285
|
Permission.ProjectMember,
|
|
286
286
|
Permission.SettingsAdmin,
|
|
287
287
|
Permission.SettingsMember,
|
|
288
|
-
Permission.
|
|
288
|
+
Permission.CreateProjectProbe,
|
|
289
289
|
],
|
|
290
290
|
read: [
|
|
291
291
|
Permission.ProjectOwner,
|
|
@@ -295,7 +295,7 @@ export default class Probe extends BaseModel {
|
|
|
295
295
|
Permission.SettingsAdmin,
|
|
296
296
|
Permission.SettingsMember,
|
|
297
297
|
Permission.SettingsViewer,
|
|
298
|
-
Permission.
|
|
298
|
+
Permission.ReadProjectProbe,
|
|
299
299
|
],
|
|
300
300
|
update: [
|
|
301
301
|
Permission.ProjectOwner,
|
|
@@ -303,7 +303,7 @@ export default class Probe extends BaseModel {
|
|
|
303
303
|
Permission.ProjectMember,
|
|
304
304
|
Permission.SettingsAdmin,
|
|
305
305
|
Permission.SettingsMember,
|
|
306
|
-
Permission.
|
|
306
|
+
Permission.EditProjectProbe,
|
|
307
307
|
],
|
|
308
308
|
})
|
|
309
309
|
@TableColumn({
|
|
@@ -334,7 +334,7 @@ export default class Probe extends BaseModel {
|
|
|
334
334
|
Permission.ProjectMember,
|
|
335
335
|
Permission.SettingsAdmin,
|
|
336
336
|
Permission.SettingsMember,
|
|
337
|
-
Permission.
|
|
337
|
+
Permission.CreateProjectProbe,
|
|
338
338
|
],
|
|
339
339
|
read: [
|
|
340
340
|
Permission.ProjectOwner,
|
|
@@ -344,7 +344,7 @@ export default class Probe extends BaseModel {
|
|
|
344
344
|
Permission.SettingsAdmin,
|
|
345
345
|
Permission.SettingsMember,
|
|
346
346
|
Permission.SettingsViewer,
|
|
347
|
-
Permission.
|
|
347
|
+
Permission.ReadProjectProbe,
|
|
348
348
|
],
|
|
349
349
|
update: [
|
|
350
350
|
Permission.ProjectOwner,
|
|
@@ -352,7 +352,7 @@ export default class Probe extends BaseModel {
|
|
|
352
352
|
Permission.ProjectMember,
|
|
353
353
|
Permission.SettingsAdmin,
|
|
354
354
|
Permission.SettingsMember,
|
|
355
|
-
Permission.
|
|
355
|
+
Permission.EditProjectProbe,
|
|
356
356
|
],
|
|
357
357
|
})
|
|
358
358
|
@TableColumn({
|
|
@@ -546,7 +546,7 @@ export default class Probe extends BaseModel {
|
|
|
546
546
|
Permission.ProjectMember,
|
|
547
547
|
Permission.SettingsAdmin,
|
|
548
548
|
Permission.SettingsMember,
|
|
549
|
-
Permission.
|
|
549
|
+
Permission.CreateProjectProbe,
|
|
550
550
|
],
|
|
551
551
|
read: [
|
|
552
552
|
Permission.ProjectOwner,
|
|
@@ -556,7 +556,7 @@ export default class Probe extends BaseModel {
|
|
|
556
556
|
Permission.SettingsAdmin,
|
|
557
557
|
Permission.SettingsMember,
|
|
558
558
|
Permission.SettingsViewer,
|
|
559
|
-
Permission.
|
|
559
|
+
Permission.ReadProjectProbe,
|
|
560
560
|
],
|
|
561
561
|
update: [
|
|
562
562
|
Permission.ProjectOwner,
|
|
@@ -564,7 +564,7 @@ export default class Probe extends BaseModel {
|
|
|
564
564
|
Permission.ProjectMember,
|
|
565
565
|
Permission.SettingsAdmin,
|
|
566
566
|
Permission.SettingsMember,
|
|
567
|
-
Permission.
|
|
567
|
+
Permission.EditProjectProbe,
|
|
568
568
|
],
|
|
569
569
|
})
|
|
570
570
|
@TableColumn({
|
|
@@ -592,7 +592,7 @@ export default class Probe extends BaseModel {
|
|
|
592
592
|
Permission.SettingsAdmin,
|
|
593
593
|
Permission.SettingsMember,
|
|
594
594
|
Permission.SettingsViewer,
|
|
595
|
-
Permission.
|
|
595
|
+
Permission.ReadProjectProbe,
|
|
596
596
|
],
|
|
597
597
|
update: [],
|
|
598
598
|
})
|
|
@@ -618,7 +618,7 @@ export default class Probe extends BaseModel {
|
|
|
618
618
|
Permission.ProjectMember,
|
|
619
619
|
Permission.SettingsAdmin,
|
|
620
620
|
Permission.SettingsMember,
|
|
621
|
-
Permission.
|
|
621
|
+
Permission.CreateProjectProbe,
|
|
622
622
|
],
|
|
623
623
|
read: [
|
|
624
624
|
Permission.ProjectOwner,
|
|
@@ -628,7 +628,7 @@ export default class Probe extends BaseModel {
|
|
|
628
628
|
Permission.SettingsAdmin,
|
|
629
629
|
Permission.SettingsMember,
|
|
630
630
|
Permission.SettingsViewer,
|
|
631
|
-
Permission.
|
|
631
|
+
Permission.ReadProjectProbe,
|
|
632
632
|
],
|
|
633
633
|
update: [
|
|
634
634
|
Permission.ProjectOwner,
|
|
@@ -636,7 +636,7 @@ export default class Probe extends BaseModel {
|
|
|
636
636
|
Permission.ProjectMember,
|
|
637
637
|
Permission.SettingsAdmin,
|
|
638
638
|
Permission.SettingsMember,
|
|
639
|
-
Permission.
|
|
639
|
+
Permission.EditProjectProbe,
|
|
640
640
|
],
|
|
641
641
|
})
|
|
642
642
|
@TableColumn({
|
|
@@ -1389,6 +1389,7 @@ export default class ScheduledMaintenance extends BaseModel {
|
|
|
1389
1389
|
"Status of notification sent to subscribers when event was scheduled",
|
|
1390
1390
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
1391
1391
|
})
|
|
1392
|
+
@Index()
|
|
1392
1393
|
@Column({
|
|
1393
1394
|
type: ColumnType.ShortText,
|
|
1394
1395
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -507,6 +507,7 @@ export default class ScheduledMaintenancePublicNote extends BaseModel {
|
|
|
507
507
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
508
508
|
example: "Sent",
|
|
509
509
|
})
|
|
510
|
+
@Index()
|
|
510
511
|
@Column({
|
|
511
512
|
type: ColumnType.ShortText,
|
|
512
513
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -503,6 +503,7 @@ export default class ScheduledMaintenanceStateTimeline extends BaseModel {
|
|
|
503
503
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
504
504
|
example: "Sent",
|
|
505
505
|
})
|
|
506
|
+
@Index()
|
|
506
507
|
@Column({
|
|
507
508
|
type: ColumnType.ShortText,
|
|
508
509
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -1285,6 +1285,7 @@ export default class ScheduledMaintenanceTemplate extends BaseModel {
|
|
|
1285
1285
|
description: "When is the next event scheduled?",
|
|
1286
1286
|
example: "2024-03-29T02:00:00.000Z",
|
|
1287
1287
|
})
|
|
1288
|
+
@Index()
|
|
1288
1289
|
@Column({
|
|
1289
1290
|
type: ColumnType.Date,
|
|
1290
1291
|
nullable: true,
|
|
@@ -676,6 +676,7 @@ export default class StatusPageAnnouncement extends BaseModel {
|
|
|
676
676
|
type: TableColumnType.ShortText,
|
|
677
677
|
defaultValue: StatusPageSubscriberNotificationStatus.Pending,
|
|
678
678
|
})
|
|
679
|
+
@Index()
|
|
679
680
|
@Column({
|
|
680
681
|
type: ColumnType.ShortText,
|
|
681
682
|
default: StatusPageSubscriberNotificationStatus.Pending,
|
|
@@ -380,6 +380,7 @@ export default class StatusPageDomain extends BaseModel {
|
|
|
380
380
|
"Full domain of your status page (like status.acmeinc.com). This is autogenerated and is derived from subdomain and domain.",
|
|
381
381
|
example: "status.acmeinc.com",
|
|
382
382
|
})
|
|
383
|
+
@Index()
|
|
383
384
|
@Column({
|
|
384
385
|
nullable: false,
|
|
385
386
|
type: ColumnType.ShortText,
|
|
@@ -26,6 +26,16 @@ export interface MicrosoftTeamsTeam {
|
|
|
26
26
|
name: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export type MicrosoftTeamsChatType = "personal" | "groupChat";
|
|
30
|
+
|
|
31
|
+
export interface MicrosoftTeamsChat {
|
|
32
|
+
id: string; // Teams conversation id (e.g. 19:...@thread.v2)
|
|
33
|
+
name: string;
|
|
34
|
+
chatType: MicrosoftTeamsChatType;
|
|
35
|
+
serviceUrl?: string | undefined; // Bot Framework service URL captured when the bot was added.
|
|
36
|
+
addedAt?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
export interface SlackMiscData extends MiscData {
|
|
30
40
|
teamId: string;
|
|
31
41
|
teamName: string;
|
|
@@ -51,6 +61,7 @@ export interface MicrosoftTeamsMiscData extends MiscData {
|
|
|
51
61
|
adminConsentGrantedBy?: string;
|
|
52
62
|
availableTeams?: Record<string, MicrosoftTeamsTeam>;
|
|
53
63
|
appAccessTokenExpiresAt?: string;
|
|
64
|
+
availableChats?: Record<string, MicrosoftTeamsChat>; // keyed by chat id. Chats the OneUptime app has been added to.
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
export type WorkspaceMiscData = SlackMiscData | MicrosoftTeamsMiscData;
|
package/Server/API/BaseAPI.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from "../../Types/Database/LimitMax";
|
|
24
24
|
import PartialEntity from "../../Types/Database/PartialEntity";
|
|
25
25
|
import BadRequestException from "../../Types/Exception/BadRequestException";
|
|
26
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
26
27
|
import { JSONObject } from "../../Types/JSON";
|
|
27
28
|
import JSONFunctions from "../../Types/JSONFunctions";
|
|
28
29
|
import ObjectID from "../../Types/ObjectID";
|
|
@@ -406,12 +407,27 @@ export default class BaseAPI<
|
|
|
406
407
|
delete (item as any)["createdAt"];
|
|
407
408
|
delete (item as any)["updatedAt"];
|
|
408
409
|
|
|
409
|
-
await this.service.updateOneById({
|
|
410
|
+
const numberOfDocsAffected: number = await this.service.updateOneById({
|
|
410
411
|
id: new ObjectID(objectIdString),
|
|
411
412
|
data: item,
|
|
412
413
|
props: await CommonAPI.getDatabaseCommonInteractionProps(req),
|
|
413
414
|
});
|
|
414
415
|
|
|
416
|
+
/*
|
|
417
|
+
* The permission layer narrows the update query after we build it (tenant
|
|
418
|
+
* scope, access-control labels, owned scope), so it is possible to match
|
|
419
|
+
* no rows at all. Reporting 200 for that told the client the edit was
|
|
420
|
+
* saved when nothing was written - the change then "disappeared" on the
|
|
421
|
+
* next page load with no error anywhere.
|
|
422
|
+
*/
|
|
423
|
+
if (numberOfDocsAffected === 0) {
|
|
424
|
+
throw new NotAuthorizedException(
|
|
425
|
+
`Unable to update this ${(
|
|
426
|
+
new this.entityType().singularName || "item"
|
|
427
|
+
).toLowerCase()}. It either does not exist, has been deleted, or you do not have permission to update it.`,
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
415
431
|
return Response.sendEmptySuccessResponse(req, res);
|
|
416
432
|
}
|
|
417
433
|
|
package/Server/API/CommonAPI.ts
CHANGED
|
@@ -6,8 +6,40 @@ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
|
|
|
6
6
|
import UserType from "../../Types/UserType";
|
|
7
7
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
8
8
|
import SpanUtil from "../Utils/Telemetry/SpanUtil";
|
|
9
|
+
import ObjectID from "../../Types/ObjectID";
|
|
10
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
11
|
+
import NotAuthorizedException from "../../Types/Exception/NotAuthorizedException";
|
|
9
12
|
|
|
10
13
|
export default class CommonAPI {
|
|
14
|
+
/*
|
|
15
|
+
* getUserMiddleware lets unauthenticated requests through as "public" and
|
|
16
|
+
* takes the tenant id from a caller-supplied header — custom endpoints
|
|
17
|
+
* that disclose project data must require an authenticated member of the
|
|
18
|
+
* project themselves. Returns the project id when authorized, throws
|
|
19
|
+
* otherwise.
|
|
20
|
+
*/
|
|
21
|
+
public static assertAuthenticatedProjectMember(
|
|
22
|
+
databaseProps: DatabaseCommonInteractionProps,
|
|
23
|
+
): ObjectID {
|
|
24
|
+
const projectId: ObjectID | undefined = databaseProps.tenantId;
|
|
25
|
+
|
|
26
|
+
if (!projectId) {
|
|
27
|
+
throw new BadDataException("Project ID is required");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
!databaseProps.userId ||
|
|
32
|
+
!databaseProps.userTenantAccessPermission ||
|
|
33
|
+
!databaseProps.userTenantAccessPermission[projectId.toString()]
|
|
34
|
+
) {
|
|
35
|
+
throw new NotAuthorizedException(
|
|
36
|
+
"You are not authorized to access this project's data.",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return projectId;
|
|
41
|
+
}
|
|
42
|
+
|
|
11
43
|
@CaptureSpan()
|
|
12
44
|
public static async getDatabaseCommonInteractionProps(
|
|
13
45
|
req: ExpressRequest,
|
|
@@ -24,6 +24,7 @@ import HTTPResponse from "../../Types/API/HTTPResponse";
|
|
|
24
24
|
import API from "../../Utils/API";
|
|
25
25
|
import WorkspaceProjectAuthTokenService from "../Services/WorkspaceProjectAuthTokenService";
|
|
26
26
|
import WorkspaceProjectAuthToken, {
|
|
27
|
+
MicrosoftTeamsChat,
|
|
27
28
|
MicrosoftTeamsMiscData,
|
|
28
29
|
MicrosoftTeamsTeam,
|
|
29
30
|
} from "../../Models/DatabaseModels/WorkspaceProjectAuthToken";
|
|
@@ -46,6 +47,8 @@ import path from "path";
|
|
|
46
47
|
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
47
48
|
import CommonAPI from "./CommonAPI";
|
|
48
49
|
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
50
|
+
import Dictionary from "../../Types/Dictionary";
|
|
51
|
+
import { WorkspaceChannel } from "../Utils/Workspace/WorkspaceBase";
|
|
49
52
|
|
|
50
53
|
export default class MicrosoftTeamsAPI {
|
|
51
54
|
private static getTeamsAppManifest(): JSONObject {
|
|
@@ -166,6 +169,14 @@ export default class MicrosoftTeamsAPI {
|
|
|
166
169
|
type: "Application",
|
|
167
170
|
name: "Channel.Create.Group",
|
|
168
171
|
},
|
|
172
|
+
{
|
|
173
|
+
type: "Application",
|
|
174
|
+
name: "ChatMessage.Read.Chat",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: "Application",
|
|
178
|
+
name: "ChatMember.Read.Chat",
|
|
179
|
+
},
|
|
169
180
|
],
|
|
170
181
|
},
|
|
171
182
|
},
|
|
@@ -1035,7 +1046,8 @@ export default class MicrosoftTeamsAPI {
|
|
|
1035
1046
|
const databaseProps: DatabaseCommonInteractionProps =
|
|
1036
1047
|
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
1037
1048
|
|
|
1038
|
-
const projectId: ObjectID =
|
|
1049
|
+
const projectId: ObjectID =
|
|
1050
|
+
CommonAPI.assertAuthenticatedProjectMember(databaseProps);
|
|
1039
1051
|
|
|
1040
1052
|
// Use the refreshTeams method to get fresh teams data
|
|
1041
1053
|
const availableTeams: Record<string, MicrosoftTeamsTeam> =
|
|
@@ -1069,7 +1081,8 @@ export default class MicrosoftTeamsAPI {
|
|
|
1069
1081
|
const databaseProps: DatabaseCommonInteractionProps =
|
|
1070
1082
|
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
1071
1083
|
|
|
1072
|
-
const projectId: ObjectID =
|
|
1084
|
+
const projectId: ObjectID =
|
|
1085
|
+
CommonAPI.assertAuthenticatedProjectMember(databaseProps);
|
|
1073
1086
|
|
|
1074
1087
|
// Call MicrosoftTeamsUtil to refresh teams
|
|
1075
1088
|
const availableTeams: Record<string, MicrosoftTeamsTeam> =
|
|
@@ -1094,6 +1107,90 @@ export default class MicrosoftTeamsAPI {
|
|
|
1094
1107
|
},
|
|
1095
1108
|
);
|
|
1096
1109
|
|
|
1110
|
+
// List channels of a team (app-only Graph; Channel.ReadBasic.All).
|
|
1111
|
+
router.get(
|
|
1112
|
+
"/microsoft-teams/channels",
|
|
1113
|
+
UserMiddleware.getUserMiddleware,
|
|
1114
|
+
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
1115
|
+
try {
|
|
1116
|
+
const databaseProps: DatabaseCommonInteractionProps =
|
|
1117
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
1118
|
+
|
|
1119
|
+
const projectId: ObjectID =
|
|
1120
|
+
CommonAPI.assertAuthenticatedProjectMember(databaseProps);
|
|
1121
|
+
|
|
1122
|
+
const teamId: string = (req.query["teamId"] as string) || "";
|
|
1123
|
+
|
|
1124
|
+
if (!teamId) {
|
|
1125
|
+
throw new BadDataException("teamId is required");
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
const channels: Dictionary<WorkspaceChannel> =
|
|
1129
|
+
await MicrosoftTeamsUtil.getAllWorkspaceChannels({
|
|
1130
|
+
authToken: "", // Graph calls use the app token from miscData.
|
|
1131
|
+
projectId: projectId,
|
|
1132
|
+
teamId: teamId,
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
1136
|
+
channels: Object.values(channels)
|
|
1137
|
+
.sort((a: WorkspaceChannel, b: WorkspaceChannel) => {
|
|
1138
|
+
return (a.name || "").localeCompare(b.name || "");
|
|
1139
|
+
})
|
|
1140
|
+
.map((channel: WorkspaceChannel) => {
|
|
1141
|
+
return {
|
|
1142
|
+
id: channel.id,
|
|
1143
|
+
name: channel.name,
|
|
1144
|
+
};
|
|
1145
|
+
}),
|
|
1146
|
+
});
|
|
1147
|
+
} catch (err) {
|
|
1148
|
+
return Response.sendErrorResponse(req, res, err as Exception);
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
);
|
|
1152
|
+
|
|
1153
|
+
/*
|
|
1154
|
+
* Get chats (group / personal chats) the OneUptime app has been added to.
|
|
1155
|
+
* Chats cannot be listed via app-only Graph permissions, so this returns
|
|
1156
|
+
* the chats captured from bot installation events.
|
|
1157
|
+
*/
|
|
1158
|
+
router.get(
|
|
1159
|
+
"/microsoft-teams/chats",
|
|
1160
|
+
UserMiddleware.getUserMiddleware,
|
|
1161
|
+
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
1162
|
+
try {
|
|
1163
|
+
const databaseProps: DatabaseCommonInteractionProps =
|
|
1164
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
1165
|
+
|
|
1166
|
+
const projectId: ObjectID =
|
|
1167
|
+
CommonAPI.assertAuthenticatedProjectMember(databaseProps);
|
|
1168
|
+
|
|
1169
|
+
const availableChats: Record<string, MicrosoftTeamsChat> =
|
|
1170
|
+
await MicrosoftTeamsUtil.getChatsForProject({
|
|
1171
|
+
projectId: projectId,
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
1175
|
+
chats: Object.values(availableChats)
|
|
1176
|
+
.sort((a: MicrosoftTeamsChat, b: MicrosoftTeamsChat) => {
|
|
1177
|
+
return a.name.localeCompare(b.name);
|
|
1178
|
+
})
|
|
1179
|
+
.map((chat: MicrosoftTeamsChat) => {
|
|
1180
|
+
return {
|
|
1181
|
+
id: chat.id,
|
|
1182
|
+
name: chat.name,
|
|
1183
|
+
chatType: chat.chatType,
|
|
1184
|
+
addedAt: chat.addedAt || null,
|
|
1185
|
+
};
|
|
1186
|
+
}),
|
|
1187
|
+
});
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
return Response.sendErrorResponse(req, res, err as Exception);
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1192
|
+
);
|
|
1193
|
+
|
|
1097
1194
|
return router;
|
|
1098
1195
|
}
|
|
1099
1196
|
|
package/Server/API/ProbeAPI.ts
CHANGED
|
@@ -32,6 +32,8 @@ export default class ProbeAPI extends BaseAPI<Probe, ProbeServiceType> {
|
|
|
32
32
|
lastAlive: true,
|
|
33
33
|
iconFileId: true,
|
|
34
34
|
connectionStatus: true,
|
|
35
|
+
// The monitor create form pre-selects the auto-enabled probes.
|
|
36
|
+
shouldAutoEnableProbeOnNewMonitors: true,
|
|
35
37
|
},
|
|
36
38
|
props: {
|
|
37
39
|
isRoot: true,
|
package/Server/API/SlackAPI.ts
CHANGED
|
@@ -44,6 +44,9 @@ import UserMiddleware from "../Middleware/UserAuthorization";
|
|
|
44
44
|
import CommonAPI from "./CommonAPI";
|
|
45
45
|
import SlackUtil from "../Utils/Workspace/Slack/Slack";
|
|
46
46
|
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
47
|
+
import Dictionary from "../../Types/Dictionary";
|
|
48
|
+
import Exception from "../../Types/Exception/Exception";
|
|
49
|
+
import { WorkspaceChannel } from "../Utils/Workspace/WorkspaceBase";
|
|
47
50
|
import {
|
|
48
51
|
PrivateNoteEmojis,
|
|
49
52
|
PublicNoteEmojis,
|
|
@@ -747,6 +750,54 @@ export default class SlackAPI {
|
|
|
747
750
|
},
|
|
748
751
|
);
|
|
749
752
|
|
|
753
|
+
// List all Slack channels for the current project (live fetch, refreshes the cache).
|
|
754
|
+
router.get(
|
|
755
|
+
"/slack/channels",
|
|
756
|
+
UserMiddleware.getUserMiddleware,
|
|
757
|
+
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
758
|
+
try {
|
|
759
|
+
const props: DatabaseCommonInteractionProps =
|
|
760
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
761
|
+
|
|
762
|
+
const projectId: ObjectID =
|
|
763
|
+
CommonAPI.assertAuthenticatedProjectMember(props);
|
|
764
|
+
|
|
765
|
+
const projectAuth: WorkspaceProjectAuthToken | null =
|
|
766
|
+
await WorkspaceProjectAuthTokenService.getProjectAuth({
|
|
767
|
+
projectId: projectId,
|
|
768
|
+
workspaceType: WorkspaceType.Slack,
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
if (!projectAuth || !projectAuth.authToken) {
|
|
772
|
+
throw new BadRequestException(
|
|
773
|
+
"Slack is not connected for this project. Please connect Slack first.",
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
const channels: Dictionary<WorkspaceChannel> =
|
|
778
|
+
await SlackUtil.getAllWorkspaceChannels({
|
|
779
|
+
authToken: projectAuth.authToken,
|
|
780
|
+
projectId: projectId,
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
784
|
+
channels: Object.values(channels)
|
|
785
|
+
.sort((a: WorkspaceChannel, b: WorkspaceChannel) => {
|
|
786
|
+
return (a.name || "").localeCompare(b.name || "");
|
|
787
|
+
})
|
|
788
|
+
.map((channel: WorkspaceChannel) => {
|
|
789
|
+
return {
|
|
790
|
+
id: channel.id,
|
|
791
|
+
name: channel.name,
|
|
792
|
+
};
|
|
793
|
+
}),
|
|
794
|
+
});
|
|
795
|
+
} catch (err) {
|
|
796
|
+
return Response.sendErrorResponse(req, res, err as Exception);
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
);
|
|
800
|
+
|
|
750
801
|
// Fetch and cache all Slack channels for current tenant's project
|
|
751
802
|
router.get(
|
|
752
803
|
"/slack/get-all-channels",
|
|
@@ -755,6 +806,17 @@ export default class SlackAPI {
|
|
|
755
806
|
const props: DatabaseCommonInteractionProps =
|
|
756
807
|
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
757
808
|
|
|
809
|
+
/*
|
|
810
|
+
* getUserMiddleware lets unauthenticated requests through as
|
|
811
|
+
* "public" — require an authenticated project member before
|
|
812
|
+
* disclosing channel names.
|
|
813
|
+
*/
|
|
814
|
+
try {
|
|
815
|
+
CommonAPI.assertAuthenticatedProjectMember(props);
|
|
816
|
+
} catch (err) {
|
|
817
|
+
return Response.sendErrorResponse(req, res, err as Exception);
|
|
818
|
+
}
|
|
819
|
+
|
|
758
820
|
if (!props.tenantId) {
|
|
759
821
|
return Response.sendErrorResponse(
|
|
760
822
|
req,
|