@oneuptime/common 8.0.5239 → 8.0.5285
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/Index.ts +4 -2
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.ts +5 -3
- package/Models/DatabaseModels/Project.ts +4 -2
- package/Models/DatabaseModels/ProjectSmtpConfig.ts +4 -2
- package/Models/DatabaseModels/StatusPageDomain.ts +6 -4
- package/Models/DatabaseModels/User.ts +0 -46
- package/Models/DatabaseModels/{UserTwoFactorAuth.ts → UserTotpAuth.ts} +16 -16
- package/Models/DatabaseModels/UserWebAuthn.ts +244 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +21 -0
- package/Server/API/BaseAPI.ts +4 -2
- package/Server/API/GlobalConfigAPI.ts +16 -12
- package/Server/API/MicrosoftTeamsAPI.ts +1240 -0
- package/Server/API/ProjectAPI.ts +4 -2
- package/Server/API/ResellerPlanAPI.ts +4 -2
- package/Server/API/SlackAPI.ts +54 -48
- package/Server/API/StatusPageAPI.ts +5 -3
- package/Server/API/UserOnCallLogTimelineAPI.ts +5 -3
- package/Server/API/{UserTwoFactorAuthAPI.ts → UserTotpAuthAPI.ts} +20 -20
- package/Server/API/UserWebAuthnAPI.ts +103 -0
- package/Server/EnvironmentConfig.ts +6 -0
- package/Server/Images/MicrosoftTeams/color.png +0 -0
- package/Server/Images/MicrosoftTeams/outline.png +0 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1753131488925-AddEnableCustomSubscriberEmailNotificationFooterText.ts +4 -2
- package/Server/Infrastructure/Postgres/SchemaMigrations/1759175457008-MigrationName.ts +27 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1759232954703-MigrationName.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1759234532998-MigrationName.ts +15 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Infrastructure/Queue.ts +4 -2
- package/Server/Infrastructure/SocketIO.ts +4 -2
- package/Server/Middleware/ProjectAuthorization.ts +5 -3
- package/Server/Middleware/SlackAuthorization.ts +2 -2
- package/Server/Middleware/TelemetryIngest.ts +12 -6
- package/Server/Services/AlertStateTimelineService.ts +34 -18
- package/Server/Services/BillingInvoiceService.ts +8 -4
- package/Server/Services/BillingService.ts +13 -9
- package/Server/Services/DatabaseService.ts +42 -30
- package/Server/Services/IncidentService.ts +5 -3
- package/Server/Services/IncidentStateTimelineService.ts +34 -18
- package/Server/Services/Index.ts +4 -2
- package/Server/Services/MonitorStatusTimelineService.ts +34 -18
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +4 -2
- package/Server/Services/ProjectService.ts +6 -4
- package/Server/Services/ScheduledMaintenanceStateTimelineService.ts +26 -14
- package/Server/Services/StatusPageService.ts +4 -2
- package/Server/Services/UserService.ts +21 -5
- package/Server/Services/{UserTwoFactorAuthService.ts → UserTotpAuthService.ts} +26 -7
- package/Server/Services/UserWebAuthnService.ts +419 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +257 -77
- package/Server/Services/WorkspaceProjectAuthTokenService.ts +2 -2
- package/Server/Types/AnalyticsDatabase/ModelPermission.ts +9 -5
- package/Server/Types/Database/Permissions/BasePermission.ts +4 -2
- package/Server/Types/Database/Permissions/TenantPermission.ts +5 -3
- package/Server/Types/Database/QueryHelper.ts +4 -2
- package/Server/Types/Markdown.ts +6 -4
- package/Server/Types/Workflow/ComponentCode.ts +4 -2
- package/Server/Types/Workflow/Components/Conditions/IfElse.ts +5 -3
- package/Server/Types/Workflow/Components/JavaScript.ts +5 -3
- package/Server/Types/Workflow/TriggerCode.ts +4 -2
- package/Server/Utils/AnalyticsDatabase/Statement.ts +4 -2
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +21 -11
- package/Server/Utils/Browser.ts +6 -4
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +4 -2
- package/Server/Utils/LocalFile.ts +14 -0
- package/Server/Utils/Monitor/MonitorResource.ts +17 -9
- package/Server/Utils/Realtime.ts +4 -2
- package/Server/Utils/StartServer.ts +1 -1
- package/Server/Utils/Telemetry.ts +15 -9
- package/Server/Utils/{TwoFactorAuth.ts → TotpAuth.ts} +2 -2
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.ts +75 -16
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.ts +649 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.ts +237 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +1321 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.ts +155 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.ts +119 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.ts +959 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.ts +16 -14
- package/Server/Utils/Workspace/MicrosoftTeams/Messages/Incident.ts +17 -14
- package/Server/Utils/Workspace/MicrosoftTeams/Messages/ScheduledMaintenance.ts +18 -13
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +2547 -14
- package/Server/Utils/Workspace/Slack/Actions/Alert.ts +4 -2
- package/Server/Utils/Workspace/Slack/Actions/Auth.ts +4 -2
- package/Server/Utils/Workspace/Slack/Actions/Incident.ts +14 -10
- package/Server/Utils/Workspace/Slack/Actions/Monitor.ts +4 -2
- package/Server/Utils/Workspace/Slack/Actions/OnCallDutyPolicy.ts +4 -2
- package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +14 -10
- package/Server/Utils/Workspace/Slack/Messages/Alert.ts +9 -7
- package/Server/Utils/Workspace/Slack/Messages/Incident.ts +9 -7
- package/Server/Utils/Workspace/Slack/Messages/Monitor.ts +9 -7
- package/Server/Utils/Workspace/Slack/Messages/ScheduledMaintenance.ts +9 -7
- package/Server/Utils/Workspace/Slack/Slack.ts +6 -0
- package/Server/Utils/Workspace/Workspace.ts +13 -10
- package/Server/Utils/Workspace/WorkspaceBase.ts +9 -0
- package/Tests/Server/API/BaseAPI.test.ts +64 -52
- package/Tests/Server/Services/BillingService.test.ts +4 -4
- package/Tests/Server/Services/TeamMemberService.test.ts +20 -12
- package/Tests/Server/TestingUtils/Services/BillingServiceHelper.ts +2 -2
- package/Tests/Types/OnCallDutyPolicy/LayerUtil.test.ts +8 -4
- package/Tests/UI/Components/DictionaryOfStrings.test.tsx +4 -2
- package/Tests/UI/Components/FilePicker.test.tsx +2 -2
- package/Tests/Utils/API.test.ts +9 -8
- package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.ts +5 -3
- package/Types/Html.ts +5 -3
- package/Types/JSONFunctions.ts +5 -5
- package/Types/Metrics/MetricsQuery.ts +6 -4
- package/Types/Monitor/MonitorType.ts +8 -6
- package/Types/OnCallDutyPolicy/Layer.ts +29 -17
- package/Types/Phone.ts +5 -3
- package/Types/Workspace/NotificationRules/BaseNotificationRule.ts +1 -0
- package/Types/Workspace/NotificationRules/CreateChannelNotificationRule.ts +5 -2
- package/Types/Workspace/WorkspaceMessagePayload.ts +1 -0
- package/Types/Workspace/WorkspaceType.ts +13 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +8 -6
- package/UI/Components/Detail/Detail.tsx +4 -1
- package/UI/Components/FilePicker/FilePicker.tsx +1 -1
- package/UI/Components/Forms/Types/Field.ts +4 -2
- package/UI/Components/Image/Image.tsx +1 -1
- package/UI/Components/JSONTable/JSONTable.tsx +4 -2
- package/UI/Components/ModelTable/BaseModelTable.tsx +5 -3
- package/UI/Components/SideMenu/SideMenu.tsx +4 -2
- package/UI/Components/SideMenu/SideMenuItem.tsx +69 -45
- package/UI/Config.ts +3 -0
- package/UI/Utils/API/API.ts +5 -3
- package/UI/Utils/Countries.ts +5 -3
- package/UI/Utils/Login.ts +6 -1
- package/Utils/Base64.ts +13 -0
- package/Utils/Schema/ModelSchema.ts +4 -2
- package/build/dist/Models/DatabaseModels/Index.js +4 -2
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +5 -3
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +4 -2
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ProjectSmtpConfig.js +4 -2
- package/build/dist/Models/DatabaseModels/ProjectSmtpConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js +6 -4
- package/build/dist/Models/DatabaseModels/StatusPageDomain.js.map +1 -1
- package/build/dist/Models/DatabaseModels/User.js +0 -49
- package/build/dist/Models/DatabaseModels/User.js.map +1 -1
- package/build/dist/Models/DatabaseModels/{UserTwoFactorAuth.js → UserTotpAuth.js} +27 -27
- package/build/dist/Models/DatabaseModels/UserTotpAuth.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserWebAuthn.js +270 -0
- package/build/dist/Models/DatabaseModels/UserWebAuthn.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
- package/build/dist/Server/API/BaseAPI.js +4 -2
- package/build/dist/Server/API/BaseAPI.js.map +1 -1
- package/build/dist/Server/API/GlobalConfigAPI.js +16 -12
- package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
- package/build/dist/Server/API/MicrosoftTeamsAPI.js +771 -0
- package/build/dist/Server/API/MicrosoftTeamsAPI.js.map +1 -0
- package/build/dist/Server/API/ProjectAPI.js +4 -2
- package/build/dist/Server/API/ProjectAPI.js.map +1 -1
- package/build/dist/Server/API/ResellerPlanAPI.js +4 -2
- package/build/dist/Server/API/ResellerPlanAPI.js.map +1 -1
- package/build/dist/Server/API/SlackAPI.js +53 -47
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +5 -3
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +5 -3
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
- package/build/dist/Server/API/{UserTwoFactorAuthAPI.js → UserTotpAuthAPI.js} +16 -16
- package/build/dist/Server/API/UserTotpAuthAPI.js.map +1 -0
- package/build/dist/Server/API/UserWebAuthnAPI.js +65 -0
- package/build/dist/Server/API/UserWebAuthnAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +3 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1753131488925-AddEnableCustomSubscriberEmailNotificationFooterText.js +4 -2
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1753131488925-AddEnableCustomSubscriberEmailNotificationFooterText.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759175457008-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759175457008-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759232954703-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759232954703-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759234532998-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1759234532998-MigrationName.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/Infrastructure/Queue.js +4 -2
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Infrastructure/SocketIO.js +4 -2
- package/build/dist/Server/Infrastructure/SocketIO.js.map +1 -1
- package/build/dist/Server/Middleware/ProjectAuthorization.js +5 -3
- package/build/dist/Server/Middleware/ProjectAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +12 -6
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AlertStateTimelineService.js +34 -18
- package/build/dist/Server/Services/AlertStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/BillingInvoiceService.js +8 -4
- package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +13 -9
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +40 -28
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +5 -3
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +34 -18
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +4 -2
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MonitorStatusTimelineService.js +34 -18
- package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +4 -2
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +6 -4
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js +26 -14
- package/build/dist/Server/Services/ScheduledMaintenanceStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +4 -2
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +16 -3
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/{UserTwoFactorAuthService.js → UserTotpAuthService.js} +22 -8
- package/build/dist/Server/Services/UserTotpAuthService.js.map +1 -0
- package/build/dist/Server/Services/UserWebAuthnService.js +365 -0
- package/build/dist/Server/Services/UserWebAuthnService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +142 -51
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +9 -5
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js +4 -2
- package/build/dist/Server/Types/Database/Permissions/BasePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js +5 -3
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js +4 -2
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +6 -4
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Types/Workflow/ComponentCode.js +4 -2
- package/build/dist/Server/Types/Workflow/ComponentCode.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js +5 -3
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js +5 -3
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js.map +1 -1
- package/build/dist/Server/Types/Workflow/TriggerCode.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +4 -2
- package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +21 -11
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Browser.js +6 -4
- package/build/dist/Server/Utils/Browser.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +4 -2
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/LocalFile.js +16 -0
- package/build/dist/Server/Utils/LocalFile.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +17 -9
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Realtime.js +4 -2
- package/build/dist/Server/Utils/Realtime.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry.js +6 -4
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/{TwoFactorAuth.js → TotpAuth.js} +8 -8
- package/build/dist/Server/Utils/TotpAuth.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js +86 -36
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js +531 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Alert.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js +206 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Auth.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +1102 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js +136 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Monitor.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js +107 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/OnCallDutyPolicy.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js +795 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ScheduledMaintenance.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.js +16 -14
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/Incident.js +16 -14
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/ScheduledMaintenance.js +15 -13
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Messages/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +1982 -13
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +4 -2
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js +4 -2
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Auth.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +14 -10
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Monitor.js +4 -2
- package/build/dist/Server/Utils/Workspace/Slack/Actions/Monitor.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/OnCallDutyPolicy.js +4 -2
- package/build/dist/Server/Utils/Workspace/Slack/Actions/OnCallDutyPolicy.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +14 -10
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Alert.js +9 -7
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Alert.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Incident.js +9 -7
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Incident.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Monitor.js +9 -7
- package/build/dist/Server/Utils/Workspace/Slack/Messages/Monitor.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Messages/ScheduledMaintenance.js +9 -7
- package/build/dist/Server/Utils/Workspace/Slack/Messages/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +5 -0
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Workspace.js +12 -10
- package/build/dist/Server/Utils/Workspace/Workspace.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/WorkspaceBase.js.map +1 -1
- package/build/dist/Tests/Server/API/BaseAPI.test.js +59 -47
- package/build/dist/Tests/Server/API/BaseAPI.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/BillingService.test.js +4 -4
- package/build/dist/Tests/Server/Services/BillingService.test.js.map +1 -1
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js +20 -12
- package/build/dist/Tests/Server/Services/TeamMemberService.test.js.map +1 -1
- package/build/dist/Tests/Server/TestingUtils/Services/BillingServiceHelper.js +2 -2
- package/build/dist/Tests/Server/TestingUtils/Services/BillingServiceHelper.js.map +1 -1
- package/build/dist/Tests/Types/OnCallDutyPolicy/LayerUtil.test.js +8 -4
- package/build/dist/Tests/Types/OnCallDutyPolicy/LayerUtil.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/DictionaryOfStrings.test.js +4 -2
- package/build/dist/Tests/UI/Components/DictionaryOfStrings.test.js.map +1 -1
- package/build/dist/Tests/UI/Components/FilePicker.test.js +2 -2
- package/build/dist/Tests/UI/Components/FilePicker.test.js.map +1 -1
- package/build/dist/Tests/Utils/API.test.js +8 -7
- package/build/dist/Tests/Utils/API.test.js.map +1 -1
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +5 -3
- package/build/dist/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js.map +1 -1
- package/build/dist/Types/Html.js +5 -3
- package/build/dist/Types/Html.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js +5 -5
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +8 -6
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/Layer.js +29 -17
- package/build/dist/Types/OnCallDutyPolicy/Layer.js.map +1 -1
- package/build/dist/Types/Phone.js +5 -3
- package/build/dist/Types/Phone.js.map +1 -1
- package/build/dist/Types/Workspace/WorkspaceType.js +9 -0
- package/build/dist/Types/Workspace/WorkspaceType.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +8 -6
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Detail/Detail.js +4 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/FilePicker/FilePicker.js +1 -1
- package/build/dist/UI/Components/FilePicker/FilePicker.js.map +1 -1
- package/build/dist/UI/Components/Image/Image.js +1 -1
- package/build/dist/UI/Components/Image/Image.js.map +1 -1
- package/build/dist/UI/Components/JSONTable/JSONTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js +4 -2
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js +62 -38
- package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
- package/build/dist/UI/Config.js +1 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/UI/Utils/API/API.js +5 -3
- package/build/dist/UI/Utils/API/API.js.map +1 -1
- package/build/dist/UI/Utils/Countries.js.map +1 -1
- package/build/dist/UI/Utils/Login.js +6 -1
- package/build/dist/UI/Utils/Login.js.map +1 -1
- package/build/dist/Utils/Base64.js +12 -0
- package/build/dist/Utils/Base64.js.map +1 -0
- package/build/dist/Utils/Schema/ModelSchema.js +4 -2
- package/build/dist/Utils/Schema/ModelSchema.js.map +1 -1
- package/package.json +5 -1
- package/build/dist/Models/DatabaseModels/UserTwoFactorAuth.js.map +0 -1
- package/build/dist/Server/API/UserTwoFactorAuthAPI.js.map +0 -1
- package/build/dist/Server/Services/UserTwoFactorAuthService.js.map +0 -1
- package/build/dist/Server/Utils/TwoFactorAuth.js.map +0 -1
|
@@ -757,8 +757,10 @@ export default class SlackAlertActions {
|
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
if (actionType === SlackActionType.ViewAlert) {
|
|
760
|
-
|
|
761
|
-
|
|
760
|
+
/*
|
|
761
|
+
* do nothing. This is just a view alert action.
|
|
762
|
+
* clear response.
|
|
763
|
+
*/
|
|
762
764
|
return Response.sendJsonObjectResponse(data.req, data.res, {
|
|
763
765
|
response_action: "clear",
|
|
764
766
|
});
|
|
@@ -42,8 +42,10 @@ export interface SlackRequest {
|
|
|
42
42
|
|
|
43
43
|
const slackActionTypesThatDoNotRequireUserSlackAccountToBeConnectedToOneUptime: Array<SlackActionType> =
|
|
44
44
|
[
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
/*
|
|
46
|
+
* anyone in the company can create incident.
|
|
47
|
+
* regardless of whether they are connected to OneUptime or not.
|
|
48
|
+
*/
|
|
47
49
|
SlackActionType.NewIncident,
|
|
48
50
|
SlackActionType.SubmitNewIncident,
|
|
49
51
|
SlackActionType.ViewIncident,
|
|
@@ -258,14 +258,16 @@ export default class SlackIncidentActions {
|
|
|
258
258
|
// send response to clear the action.
|
|
259
259
|
Response.sendTextResponse(data.req, data.res, "");
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
261
|
+
/*
|
|
262
|
+
* show new incident modal.
|
|
263
|
+
* new incident modal is :
|
|
264
|
+
* Incident Title (this can be prefilled with actionValue)
|
|
265
|
+
* Incident Description
|
|
266
|
+
* Incident Severity (dropdown) (single select)
|
|
267
|
+
* Monitors (dropdown) (miltiselect)
|
|
268
|
+
* Change Monitor Status to (dropdown) (single select)
|
|
269
|
+
* Labels (dropdown) (multiselect)
|
|
270
|
+
*/
|
|
269
271
|
|
|
270
272
|
const incidentTitle: WorkspaceTextBoxBlock = {
|
|
271
273
|
_type: "WorkspaceTextBoxBlock",
|
|
@@ -1267,8 +1269,10 @@ export default class SlackIncidentActions {
|
|
|
1267
1269
|
}
|
|
1268
1270
|
|
|
1269
1271
|
if (actionType === SlackActionType.ViewIncident) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
+
/*
|
|
1273
|
+
* do nothing. This is just a view incident action.
|
|
1274
|
+
* clear response.
|
|
1275
|
+
*/
|
|
1272
1276
|
return Response.sendJsonObjectResponse(data.req, data.res, {
|
|
1273
1277
|
response_action: "clear",
|
|
1274
1278
|
});
|
|
@@ -31,8 +31,10 @@ export default class SlackMonitorActions {
|
|
|
31
31
|
const actionType: SlackActionType | undefined = data.action.actionType;
|
|
32
32
|
|
|
33
33
|
if (actionType === SlackActionType.ViewMonitor) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/*
|
|
35
|
+
* do nothing. This is just a view Monitor action.
|
|
36
|
+
* clear response.
|
|
37
|
+
*/
|
|
36
38
|
return Response.sendJsonObjectResponse(data.req, data.res, {
|
|
37
39
|
response_action: "clear",
|
|
38
40
|
});
|
|
@@ -31,8 +31,10 @@ export default class SlackOnCallDutyActions {
|
|
|
31
31
|
const actionType: SlackActionType | undefined = data.action.actionType;
|
|
32
32
|
|
|
33
33
|
if (actionType === SlackActionType.ViewOnCallPolicy) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/*
|
|
35
|
+
* do nothing. This is just a view alert action.
|
|
36
|
+
* clear response.
|
|
37
|
+
*/
|
|
36
38
|
return Response.sendJsonObjectResponse(data.req, data.res, {
|
|
37
39
|
response_action: "clear",
|
|
38
40
|
});
|
|
@@ -313,14 +313,16 @@ export default class SlackScheduledMaintenanceActions {
|
|
|
313
313
|
// send response to clear the action.
|
|
314
314
|
Response.sendTextResponse(data.req, data.res, "");
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
316
|
+
/*
|
|
317
|
+
* show new scheduledMaintenance modal.
|
|
318
|
+
* new scheduledMaintenance modal is :
|
|
319
|
+
* ScheduledMaintenance Title (this can be prefilled with actionValue)
|
|
320
|
+
* ScheduledMaintenance Description
|
|
321
|
+
* Start Date and Time (date picker)
|
|
322
|
+
* End Date and Time (date picker)
|
|
323
|
+
* Monitors (dropdown) (miltiselect)
|
|
324
|
+
* Change Monitor Status to (dropdown) (single select)
|
|
325
|
+
*/
|
|
324
326
|
|
|
325
327
|
// Labels (dropdown) (multiselect)
|
|
326
328
|
|
|
@@ -1092,8 +1094,10 @@ export default class SlackScheduledMaintenanceActions {
|
|
|
1092
1094
|
}
|
|
1093
1095
|
|
|
1094
1096
|
if (actionType === SlackActionType.ViewScheduledMaintenance) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
+
/*
|
|
1098
|
+
* do nothing. This is just a view scheduledMaintenance action.
|
|
1099
|
+
* clear response.
|
|
1100
|
+
*/
|
|
1097
1101
|
return Response.sendJsonObjectResponse(data.req, data.res, {
|
|
1098
1102
|
response_action: "clear",
|
|
1099
1103
|
});
|
|
@@ -32,13 +32,15 @@ export default class SlackAlertMessages {
|
|
|
32
32
|
|
|
33
33
|
blockSlack.push(dividerBlock);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
/*
|
|
36
|
+
* now add buttons.
|
|
37
|
+
* View data.
|
|
38
|
+
* Execute On Call
|
|
39
|
+
* Acknowledge alert
|
|
40
|
+
* Resolve data.
|
|
41
|
+
* Change Alert State.
|
|
42
|
+
* Add Note.
|
|
43
|
+
*/
|
|
42
44
|
|
|
43
45
|
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
|
44
46
|
|
|
@@ -32,13 +32,15 @@ export default class SlackIncidentMessages {
|
|
|
32
32
|
|
|
33
33
|
blockSlack.push(dividerBlock);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
/*
|
|
36
|
+
* now add buttons.
|
|
37
|
+
* View data.
|
|
38
|
+
* Execute On Call
|
|
39
|
+
* Acknowledge incident
|
|
40
|
+
* Resolve data.
|
|
41
|
+
* Change Incident State.
|
|
42
|
+
* Add Note.
|
|
43
|
+
*/
|
|
42
44
|
|
|
43
45
|
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
|
44
46
|
|
|
@@ -31,13 +31,15 @@ export default class SlackMonitorMessages {
|
|
|
31
31
|
|
|
32
32
|
blockSlack.push(dividerBlock);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
/*
|
|
35
|
+
* now add buttons.
|
|
36
|
+
* View data.
|
|
37
|
+
* Execute On Call
|
|
38
|
+
* Acknowledge Monitor
|
|
39
|
+
* Resolve data.
|
|
40
|
+
* Change Monitor State.
|
|
41
|
+
* Add Note.
|
|
42
|
+
*/
|
|
41
43
|
|
|
42
44
|
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
|
43
45
|
|
|
@@ -32,13 +32,15 @@ export default class SlackScheduledMaintenanceMessages {
|
|
|
32
32
|
|
|
33
33
|
blockSlack.push(dividerBlock);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
/*
|
|
36
|
+
* now add buttons.
|
|
37
|
+
* View data.
|
|
38
|
+
* Execute On Call
|
|
39
|
+
* Acknowledge scheduledMaintenance
|
|
40
|
+
* Resolve data.
|
|
41
|
+
* Change ScheduledMaintenance State.
|
|
42
|
+
* Add Note.
|
|
43
|
+
*/
|
|
42
44
|
|
|
43
45
|
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
|
44
46
|
|
|
@@ -48,6 +48,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
48
48
|
public static override async getUsernameFromUserId(data: {
|
|
49
49
|
authToken: string;
|
|
50
50
|
userId: string;
|
|
51
|
+
projectId: ObjectID;
|
|
51
52
|
}): Promise<string | null> {
|
|
52
53
|
logger.debug("Getting username from user ID with data:");
|
|
53
54
|
logger.debug(data);
|
|
@@ -1055,6 +1056,7 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1055
1056
|
const workspaspaceMessageResponse: WorkspaceSendMessageResponse = {
|
|
1056
1057
|
threads: [],
|
|
1057
1058
|
workspaceType: WorkspaceType.Slack,
|
|
1059
|
+
errors: [],
|
|
1058
1060
|
};
|
|
1059
1061
|
|
|
1060
1062
|
for (const channel of workspaceChannelsToPostTo) {
|
|
@@ -1088,6 +1090,10 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1088
1090
|
} catch (e) {
|
|
1089
1091
|
logger.error(`Error sending message to channel ID ${channel.id}:`);
|
|
1090
1092
|
logger.error(e);
|
|
1093
|
+
workspaspaceMessageResponse.errors!.push({
|
|
1094
|
+
channel: channel,
|
|
1095
|
+
error: e instanceof Error ? e.message : String(e),
|
|
1096
|
+
});
|
|
1091
1097
|
}
|
|
1092
1098
|
}
|
|
1093
1099
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import WorkspaceType from "../../../Types/Workspace/WorkspaceType";
|
|
2
2
|
import WorkspaceBase, { WorkspaceSendMessageResponse } from "./WorkspaceBase";
|
|
3
3
|
import SlackWorkspace from "./Slack/Slack";
|
|
4
|
-
import
|
|
4
|
+
import MicrosoftTeamsUtil from "./MicrosoftTeams/MicrosoftTeams";
|
|
5
5
|
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
6
6
|
import ObjectID from "../../../Types/ObjectID";
|
|
7
7
|
import WorkspaceMessagePayload, {
|
|
@@ -57,6 +57,7 @@ export default class WorkspaceUtil {
|
|
|
57
57
|
userId: workspaceUserToken.workspaceUserId,
|
|
58
58
|
workspaceType: workspaceType,
|
|
59
59
|
authToken: projectAuthToken.authToken,
|
|
60
|
+
projectId: data.projectId,
|
|
60
61
|
});
|
|
61
62
|
|
|
62
63
|
if (!workspaceUsername) {
|
|
@@ -115,7 +116,7 @@ export default class WorkspaceUtil {
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
if (workspaceType === WorkspaceType.MicrosoftTeams) {
|
|
118
|
-
return
|
|
119
|
+
return MicrosoftTeamsUtil;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
throw new BadDataException(
|
|
@@ -128,12 +129,14 @@ export default class WorkspaceUtil {
|
|
|
128
129
|
userId: string;
|
|
129
130
|
workspaceType: WorkspaceType;
|
|
130
131
|
authToken: string;
|
|
132
|
+
projectId: ObjectID;
|
|
131
133
|
}): Promise<string | null> {
|
|
132
134
|
const userName: string | null = await WorkspaceUtil.getWorkspaceTypeUtil(
|
|
133
135
|
data.workspaceType,
|
|
134
136
|
).getUsernameFromUserId({
|
|
135
137
|
userId: data.userId,
|
|
136
138
|
authToken: data.authToken,
|
|
139
|
+
projectId: data.projectId,
|
|
137
140
|
});
|
|
138
141
|
|
|
139
142
|
return userName;
|
|
@@ -172,14 +175,14 @@ export default class WorkspaceUtil {
|
|
|
172
175
|
|
|
173
176
|
if (workspaceType === WorkspaceType.Slack) {
|
|
174
177
|
botUserId = (projectAuthToken.miscData as SlackMiscData).botUserId;
|
|
175
|
-
}
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
if (!botUserId) {
|
|
180
|
+
responses.push({
|
|
181
|
+
workspaceType: workspaceType,
|
|
182
|
+
threads: [],
|
|
183
|
+
});
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
if (!projectAuthToken.authToken) {
|
|
@@ -192,7 +195,7 @@ export default class WorkspaceUtil {
|
|
|
192
195
|
|
|
193
196
|
const result: WorkspaceSendMessageResponse =
|
|
194
197
|
await WorkspaceUtil.getWorkspaceTypeUtil(workspaceType).sendMessage({
|
|
195
|
-
userId: botUserId,
|
|
198
|
+
userId: botUserId || "",
|
|
196
199
|
authToken: projectAuthToken.authToken,
|
|
197
200
|
projectId: data.projectId,
|
|
198
201
|
workspaceMessagePayload: messagePayloadByWorkspace,
|
|
@@ -32,12 +32,17 @@ export interface WorkspaceThread {
|
|
|
32
32
|
export interface WorkspaceSendMessageResponse {
|
|
33
33
|
threads: Array<WorkspaceThread>;
|
|
34
34
|
workspaceType: WorkspaceType;
|
|
35
|
+
errors?: Array<{
|
|
36
|
+
channel: WorkspaceChannel;
|
|
37
|
+
error: string;
|
|
38
|
+
}>;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export interface WorkspaceChannel {
|
|
38
42
|
id: string;
|
|
39
43
|
name: string;
|
|
40
44
|
workspaceType: WorkspaceType;
|
|
45
|
+
teamId?: string; // Required for Microsoft Teams
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
export default class WorkspaceBase {
|
|
@@ -55,6 +60,7 @@ export default class WorkspaceBase {
|
|
|
55
60
|
authToken: string;
|
|
56
61
|
channelName: string;
|
|
57
62
|
projectId: ObjectID;
|
|
63
|
+
teamId?: string;
|
|
58
64
|
}): Promise<boolean> {
|
|
59
65
|
throw new NotImplementedException();
|
|
60
66
|
}
|
|
@@ -74,6 +80,7 @@ export default class WorkspaceBase {
|
|
|
74
80
|
public static async getUsernameFromUserId(_data: {
|
|
75
81
|
authToken: string;
|
|
76
82
|
userId: string;
|
|
83
|
+
projectId: ObjectID;
|
|
77
84
|
}): Promise<string | null> {
|
|
78
85
|
throw new NotImplementedException();
|
|
79
86
|
}
|
|
@@ -192,6 +199,7 @@ export default class WorkspaceBase {
|
|
|
192
199
|
public static async getWorkspaceChannelFromChannelId(_data: {
|
|
193
200
|
authToken: string;
|
|
194
201
|
channelId: string;
|
|
202
|
+
teamId?: string;
|
|
195
203
|
}): Promise<WorkspaceChannel> {
|
|
196
204
|
throw new NotImplementedException();
|
|
197
205
|
}
|
|
@@ -202,6 +210,7 @@ export default class WorkspaceBase {
|
|
|
202
210
|
authToken: string; // which auth token should we use to send.
|
|
203
211
|
userId: string;
|
|
204
212
|
projectId: ObjectID;
|
|
213
|
+
teamId?: string;
|
|
205
214
|
}): Promise<WorkspaceSendMessageResponse> {
|
|
206
215
|
throw new NotImplementedException();
|
|
207
216
|
}
|
|
@@ -740,58 +740,70 @@ describe("BaseAPI", () => {
|
|
|
740
740
|
});
|
|
741
741
|
});
|
|
742
742
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
743
|
+
/*
|
|
744
|
+
* describe('createItem', () => {
|
|
745
|
+
* let createRequest: OneUptimeRequest;
|
|
746
|
+
* let createResponse: ExpressResponse;
|
|
747
|
+
* let savedItem: BaseModel;
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
/*
|
|
751
|
+
* beforeEach(() => {
|
|
752
|
+
* createRequest = {
|
|
753
|
+
* body: {
|
|
754
|
+
* data: { version: '1' },
|
|
755
|
+
* miscDataProps: { additional: 'info' },
|
|
756
|
+
* },
|
|
757
|
+
* headers: {},
|
|
758
|
+
* } as unknown as OneUptimeRequest;
|
|
759
|
+
*/
|
|
760
|
+
|
|
761
|
+
/*
|
|
762
|
+
* createResponse = {
|
|
763
|
+
* status: jest.fn().mockReturnThis(),
|
|
764
|
+
* json: jest.fn().mockReturnThis(),
|
|
765
|
+
* send: jest.fn().mockReturnThis(),
|
|
766
|
+
* } as unknown as ExpressResponse;
|
|
767
|
+
*/
|
|
768
|
+
|
|
769
|
+
/*
|
|
770
|
+
* savedItem = new BaseModel();
|
|
771
|
+
* });
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
/*
|
|
775
|
+
* it('should call onBeforeCreate lifecycle method', async () => {
|
|
776
|
+
* const onBeforeCreateSpy: jest.SpyInstance = jest.spyOn(
|
|
777
|
+
* baseApiInstance as any,
|
|
778
|
+
* 'onBeforeCreate'
|
|
779
|
+
* );
|
|
780
|
+
* await baseApiInstance.createItem(createRequest, createResponse);
|
|
781
|
+
* expect(onBeforeCreateSpy).toHaveBeenCalledWith(
|
|
782
|
+
* createRequest,
|
|
783
|
+
* createResponse
|
|
784
|
+
* );
|
|
785
|
+
* });
|
|
786
|
+
*/
|
|
787
|
+
|
|
788
|
+
/*
|
|
789
|
+
* it('should return EntityResponse with the saved item', async () => {
|
|
790
|
+
* jest.spyOn(baseApiInstance.service, 'create').mockResolvedValue(
|
|
791
|
+
* savedItem
|
|
792
|
+
* );
|
|
793
|
+
* await baseApiInstance.createItem(createRequest, createResponse);
|
|
794
|
+
* const sendEntityResponseSpy: jest.SpyInstance = jest.spyOn(
|
|
795
|
+
* Response as any,
|
|
796
|
+
* 'sendEntityResponse'
|
|
797
|
+
* );
|
|
798
|
+
* expect(sendEntityResponseSpy).toHaveBeenCalledWith(
|
|
799
|
+
* createRequest,
|
|
800
|
+
* createResponse,
|
|
801
|
+
* savedItem,
|
|
802
|
+
* BaseModel
|
|
803
|
+
* );
|
|
804
|
+
* });
|
|
805
|
+
* });
|
|
806
|
+
*/
|
|
795
807
|
|
|
796
808
|
describe("getRouter", () => {
|
|
797
809
|
it("should return an ExpressRouter instance", () => {
|
|
@@ -856,9 +856,9 @@ describe("BillingService", () => {
|
|
|
856
856
|
|
|
857
857
|
it("should successfully retrieve subscription items for a given subscription", async () => {
|
|
858
858
|
mockSubscription.items.data = [
|
|
859
|
-
// @ts-
|
|
859
|
+
// @ts-expect-error - Simplified mock object for testing without all required Stripe SubscriptionItem properties
|
|
860
860
|
{ id: "item_1", price: { id: "price_123" } },
|
|
861
|
-
// @ts-
|
|
861
|
+
// @ts-expect-error - Simplified mock object for testing without all required Stripe SubscriptionItem properties
|
|
862
862
|
{ id: "item_2", price: { id: "price_456" } },
|
|
863
863
|
];
|
|
864
864
|
mockStripe.subscriptions.retrieve =
|
|
@@ -1025,14 +1025,14 @@ describe("BillingService", () => {
|
|
|
1025
1025
|
{
|
|
1026
1026
|
id: "pm_123",
|
|
1027
1027
|
type: "card",
|
|
1028
|
-
// @ts-
|
|
1028
|
+
// @ts-expect-error - Simplified mock card object for testing without all required Stripe card properties
|
|
1029
1029
|
card: { last4: "4242", brand: "mastercard" },
|
|
1030
1030
|
isDefault: true,
|
|
1031
1031
|
},
|
|
1032
1032
|
{
|
|
1033
1033
|
id: "pm_456",
|
|
1034
1034
|
type: "card",
|
|
1035
|
-
// @ts-
|
|
1035
|
+
// @ts-expect-error - Simplified mock card object for testing without all required Stripe card properties
|
|
1036
1036
|
card: { last4: "4343", brand: "mastercard" },
|
|
1037
1037
|
isDefault: true,
|
|
1038
1038
|
},
|
|
@@ -343,10 +343,12 @@ describe("TeamMemberService", () => {
|
|
|
343
343
|
"refreshTokens",
|
|
344
344
|
);
|
|
345
345
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
/*
|
|
347
|
+
* const updateSeatsSpy: jest.SpyInstance = jest.spyOn(
|
|
348
|
+
* TeamMemberService,
|
|
349
|
+
* "updateSubscriptionSeatsByUniqueTeamMembersInProject",
|
|
350
|
+
* );
|
|
351
|
+
*/
|
|
350
352
|
|
|
351
353
|
const user: User = await UserService.create({
|
|
352
354
|
data: UserServiceHelper.generateRandomUser(),
|
|
@@ -741,8 +743,10 @@ describe("TeamMemberService", () => {
|
|
|
741
743
|
|
|
742
744
|
describe("getUniqueTeamMemberCountInProject", () => {
|
|
743
745
|
it("should return the count of unique team members in a project", async () => {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
+
/*
|
|
747
|
+
* make findBy to return 4 team members: 1 normal, 2 with the same id and 1 without a user ID
|
|
748
|
+
* total should be 2 unique team members
|
|
749
|
+
*/
|
|
746
750
|
|
|
747
751
|
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
|
748
752
|
null,
|
|
@@ -839,9 +843,11 @@ describe("TeamMemberService", () => {
|
|
|
839
843
|
|
|
840
844
|
describe("getUsersInTeam(s)", () => {
|
|
841
845
|
it("should return users in specified team", async () => {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
846
|
+
/*
|
|
847
|
+
* team A members: user1 & user2
|
|
848
|
+
* team B members: user2 & user3
|
|
849
|
+
* team C members: user 3
|
|
850
|
+
*/
|
|
845
851
|
|
|
846
852
|
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
|
847
853
|
null,
|
|
@@ -966,9 +972,11 @@ describe("TeamMemberService", () => {
|
|
|
966
972
|
});
|
|
967
973
|
|
|
968
974
|
it("should return users in multiple teams", async () => {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
975
|
+
/*
|
|
976
|
+
* team A members: user1 & user2
|
|
977
|
+
* team B members: user2 & user3
|
|
978
|
+
* team C members: user 3
|
|
979
|
+
*/
|
|
972
980
|
|
|
973
981
|
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
|
974
982
|
null,
|
|
@@ -68,7 +68,7 @@ const getStripeSubscription: GetStripeSubscriptionFunction =
|
|
|
68
68
|
data: [
|
|
69
69
|
{
|
|
70
70
|
id: Faker.generateRandomObjectID().toString(),
|
|
71
|
-
// @ts-
|
|
71
|
+
// @ts-expect-error - Simplified mock price object for testing without all required Stripe Price properties
|
|
72
72
|
price: {
|
|
73
73
|
id: new BillingService().getMeteredPlanPriceId(
|
|
74
74
|
ProductType.ActiveMonitoring,
|
|
@@ -100,7 +100,7 @@ const getSubscriptionPlanData: GetSubscriptionPlanDataFunction =
|
|
|
100
100
|
type GetStripeInvoiceFunction = () => Stripe.Invoice;
|
|
101
101
|
|
|
102
102
|
const getStripeInvoice: GetStripeInvoiceFunction = (): Stripe.Invoice => {
|
|
103
|
-
// @ts-
|
|
103
|
+
// @ts-expect-error - Simplified mock invoice object for testing without all required Stripe Invoice properties
|
|
104
104
|
return {
|
|
105
105
|
id: Faker.generateRandomObjectID().toString(),
|
|
106
106
|
amount_due: Faker.getNumberBetweenMinAndMax({ min: 1, max: 100 }),
|
|
@@ -220,8 +220,10 @@ describe("LayerUtil getEvents - Daily Restrictions", () => {
|
|
|
220
220
|
calendarEndDate: calendarEnd,
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
/*
|
|
224
|
+
* Expect two events: 23:00 -> 23:59:59 (approx) and 00:00 -> 11:00 next day (depending on trimming logic)
|
|
225
|
+
* We simplify by checking presence of one starting at 23:00 and one ending at 11:00.
|
|
226
|
+
*/
|
|
225
227
|
expect(events.length).toBeGreaterThanOrEqual(2); // Expect at least two distinct segments across midnight.
|
|
226
228
|
const has23Window: boolean = events.some((e: CalendarEvent) => {
|
|
227
229
|
return OneUptimeDate.getLocalHourAndMinuteFromDate(e.start) === "23:00";
|
|
@@ -436,8 +438,10 @@ describe("LayerUtil getEvents - Rotation Handoff", () => {
|
|
|
436
438
|
return e.title;
|
|
437
439
|
});
|
|
438
440
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
+
/*
|
|
442
|
+
* Titles are user ids (strings we passed) according to implementation.
|
|
443
|
+
* Check that at least first three rotate u1 -> u2 -> u3
|
|
444
|
+
*/
|
|
441
445
|
expect(userSequence.slice(0, 3)).toEqual(["u1", "u2", "u3"]);
|
|
442
446
|
});
|
|
443
447
|
});
|