@oneuptime/common 9.4.11 → 9.4.13
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/Incident.ts +77 -0
- package/Models/DatabaseModels/IncidentEpisode.ts +1223 -0
- package/Models/DatabaseModels/IncidentEpisodeFeed.ts +533 -0
- package/Models/DatabaseModels/IncidentEpisodeInternalNote.ts +456 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.ts +587 -0
- package/Models/DatabaseModels/IncidentEpisodeOwnerTeam.ts +421 -0
- package/Models/DatabaseModels/IncidentEpisodeOwnerUser.ts +419 -0
- package/Models/DatabaseModels/IncidentEpisodeStateTimeline.ts +524 -0
- package/Models/DatabaseModels/IncidentGroupingRule.ts +1430 -0
- package/Models/DatabaseModels/Index.ts +18 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +70 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.ts +59 -0
- package/Models/DatabaseModels/Project.ts +29 -0
- package/Models/DatabaseModels/UserOnCallLog.ts +48 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +49 -0
- package/Models/DatabaseModels/WorkspaceNotificationLog.ts +57 -0
- package/Server/API/BillingAPI.ts +78 -1
- package/Server/API/IncidentEpisodeAPI.ts +150 -0
- package/Server/API/SlackAPI.ts +23 -0
- package/Server/API/UserOnCallLogTimelineAPI.ts +24 -4
- package/Server/BillingConfig.ts +3 -0
- package/Server/EnvironmentConfig.ts +1 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769599843642-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.ts +729 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.ts +261 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Services/AIBillingService.ts +10 -0
- package/Server/Services/BillingService.ts +349 -1
- package/Server/Services/CallService.ts +1 -0
- package/Server/Services/IncidentEpisodeFeedService.ts +94 -0
- package/Server/Services/IncidentEpisodeInternalNoteService.ts +71 -0
- package/Server/Services/IncidentEpisodeMemberService.ts +321 -0
- package/Server/Services/IncidentEpisodeOwnerTeamService.ts +10 -0
- package/Server/Services/IncidentEpisodeOwnerUserService.ts +10 -0
- package/Server/Services/IncidentEpisodeService.ts +1045 -0
- package/Server/Services/IncidentEpisodeStateTimelineService.ts +566 -0
- package/Server/Services/IncidentGroupingEngineService.ts +1047 -0
- package/Server/Services/IncidentGroupingRuleService.ts +14 -0
- package/Server/Services/IncidentService.ts +11 -0
- package/Server/Services/Index.ts +18 -0
- package/Server/Services/MailService.ts +1 -0
- package/Server/Services/MonitorService.ts +9 -0
- package/Server/Services/NotificationService.ts +10 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +18 -0
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +64 -2
- package/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.ts +26 -1
- package/Server/Services/OnCallDutyPolicyService.ts +15 -0
- package/Server/Services/ProjectService.ts +33 -2
- package/Server/Services/SmsService.ts +1 -0
- package/Server/Services/UserNotificationRuleService.ts +48 -2
- package/Server/Services/UserNotificationSettingService.ts +23 -0
- package/Server/Services/UserOnCallLogService.ts +41 -4
- package/Server/Services/UserService.ts +45 -1
- package/Server/Services/WhatsAppService.ts +1 -0
- package/Server/Services/WorkspaceNotificationLogService.ts +16 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +116 -0
- package/Server/Types/Database/Permissions/TenantPermission.ts +20 -0
- package/Server/Utils/AI/IncidentEpisodeAIContextBuilder.ts +490 -0
- package/Server/Utils/Monitor/Criteria/APIRequestCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.ts +1 -1
- package/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.ts +2 -2
- package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +182 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +13 -0
- package/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.ts +1 -1
- package/Server/Utils/Monitor/MonitorTemplateUtil.ts +37 -0
- package/Server/Utils/PushNotificationUtil.ts +31 -0
- package/Server/Utils/WhatsAppTemplateUtil.ts +14 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.ts +18 -0
- package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +702 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +20 -0
- package/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +11 -0
- package/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.ts +918 -0
- package/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.ts +120 -0
- package/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.ts +74 -0
- package/Types/Email/EmailTemplateType.ts +7 -0
- package/Types/Monitor/CriteriaFilter.ts +24 -4
- package/Types/Monitor/MonitorCriteriaInstance.ts +67 -0
- package/Types/Monitor/MonitorStep.ts +37 -0
- package/Types/Monitor/MonitorStepSnmpMonitor.ts +102 -0
- package/Types/Monitor/MonitorType.ts +15 -2
- package/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.ts +8 -0
- package/Types/Monitor/SnmpMonitor/SnmpDataType.ts +21 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +16 -0
- package/Types/Monitor/SnmpMonitor/SnmpOid.ts +60 -0
- package/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.ts +7 -0
- package/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.ts +7 -0
- package/Types/Monitor/SnmpMonitor/SnmpV3Auth.ts +12 -0
- package/Types/Monitor/SnmpMonitor/SnmpVersion.ts +7 -0
- package/Types/NotificationSetting/NotificationSettingEventType.ts +7 -0
- package/Types/Permission.ts +311 -0
- package/Types/Probe/ProbeMonitorResponse.ts +2 -0
- package/Types/UserNotification/UserNotificationEventType.ts +1 -0
- package/Types/WhatsApp/WhatsAppTemplates.ts +24 -0
- package/Types/Workspace/NotificationRules/EventType.ts +1 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +38 -1
- package/Utils/Monitor/MonitorMetricType.ts +2 -1
- package/build/dist/Models/DatabaseModels/Incident.js +78 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js +1250 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisode.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js +555 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeInternalNote.js +467 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeInternalNote.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js +607 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeMember.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerTeam.js +437 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerUser.js +436 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js +546 -0
- package/build/dist/Models/DatabaseModels/IncidentEpisodeStateTimeline.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js +1437 -0
- package/build/dist/Models/DatabaseModels/IncidentGroupingRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +16 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +69 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +58 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +30 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js +47 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js +58 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js.map +1 -1
- package/build/dist/Server/API/BillingAPI.js +44 -1
- package/build/dist/Server/API/BillingAPI.js.map +1 -1
- package/build/dist/Server/API/IncidentEpisodeAPI.js +97 -0
- package/build/dist/Server/API/IncidentEpisodeAPI.js.map +1 -0
- package/build/dist/Server/API/SlackAPI.js +18 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -1
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js +30 -10
- package/build/dist/Server/API/UserOnCallLogTimelineAPI.js.map +1 -1
- package/build/dist/Server/BillingConfig.js +2 -0
- package/build/dist/Server/BillingConfig.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769599843642-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769599843642-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.js +256 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769626069479-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.js +96 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769629928240-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.js +25 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1769676117342-RenameEvaluateOverTimeInCriteriaFilter.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIBillingService.js +10 -1
- package/build/dist/Server/Services/AIBillingService.js.map +1 -1
- package/build/dist/Server/Services/BillingService.js +224 -5
- package/build/dist/Server/Services/BillingService.js.map +1 -1
- package/build/dist/Server/Services/CallService.js.map +1 -1
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js +83 -0
- package/build/dist/Server/Services/IncidentEpisodeFeedService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js +70 -0
- package/build/dist/Server/Services/IncidentEpisodeInternalNoteService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js +298 -0
- package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js +9 -0
- package/build/dist/Server/Services/IncidentEpisodeOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js +933 -0
- package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -0
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js +498 -0
- package/build/dist/Server/Services/IncidentEpisodeStateTimelineService.js.map +1 -0
- package/build/dist/Server/Services/IncidentGroupingEngineService.js +799 -0
- package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -0
- package/build/dist/Server/Services/IncidentGroupingRuleService.js +13 -0
- package/build/dist/Server/Services/IncidentGroupingRuleService.js.map +1 -0
- package/build/dist/Server/Services/IncidentService.js +10 -0
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +16 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MailService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +9 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/NotificationService.js +10 -1
- package/build/dist/Server/Services/NotificationService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +10 -0
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +48 -2
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js +20 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogTimelineService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyService.js +8 -0
- package/build/dist/Server/Services/OnCallDutyPolicyService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +16 -3
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/SmsService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +39 -2
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +9 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +35 -3
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +40 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/WhatsAppService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js +12 -0
- package/build/dist/Server/Services/WorkspaceNotificationLogService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +95 -1
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js +17 -0
- package/build/dist/Server/Types/Database/Permissions/TenantPermission.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js +402 -0
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/Criteria/APIRequestCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/IncomingRequestCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SSLMonitorCriteria.js +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/ServerMonitorCriteria.js +2 -2
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +135 -0
- package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +10 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +26 -0
- package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/PushNotificationUtil.js +20 -0
- package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +8 -0
- package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js +17 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +547 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +15 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js +10 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/ActionTypes.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js +651 -0
- package/build/dist/Server/Utils/Workspace/Slack/Actions/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js +100 -0
- package/build/dist/Server/Utils/Workspace/Slack/Messages/IncidentEpisode.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js +70 -0
- package/build/dist/Server/Utils/Workspace/WorkspaceMessages/IncidentEpisode.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +6 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +16 -3
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +62 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +26 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js +77 -0
- package/build/dist/Types/Monitor/MonitorStepSnmpMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +13 -2
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js +9 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpAuthProtocol.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpDataType.js +22 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpDataType.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpOid.js +55 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpOid.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpPrivProtocol.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpSecurityLevel.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpV3Auth.js +2 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpV3Auth.js.map +1 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js +8 -0
- package/build/dist/Types/Monitor/SnmpMonitor/SnmpVersion.js.map +1 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +5 -0
- package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
- package/build/dist/Types/Permission.js +264 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/UserNotification/UserNotificationEventType.js +1 -0
- package/build/dist/Types/UserNotification/UserNotificationEventType.js.map +1 -1
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +15 -0
- package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/EventType.js +1 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +33 -1
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js +2 -1
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/package.json +1 -1
|
@@ -198,6 +198,15 @@ import AlertEpisodeInternalNote from "./AlertEpisodeInternalNote";
|
|
|
198
198
|
import AlertEpisodeFeed from "./AlertEpisodeFeed";
|
|
199
199
|
import AlertGroupingRule from "./AlertGroupingRule";
|
|
200
200
|
|
|
201
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
202
|
+
import IncidentEpisodeMember from "./IncidentEpisodeMember";
|
|
203
|
+
import IncidentEpisodeStateTimeline from "./IncidentEpisodeStateTimeline";
|
|
204
|
+
import IncidentEpisodeOwnerUser from "./IncidentEpisodeOwnerUser";
|
|
205
|
+
import IncidentEpisodeOwnerTeam from "./IncidentEpisodeOwnerTeam";
|
|
206
|
+
import IncidentEpisodeInternalNote from "./IncidentEpisodeInternalNote";
|
|
207
|
+
import IncidentEpisodeFeed from "./IncidentEpisodeFeed";
|
|
208
|
+
import IncidentGroupingRule from "./IncidentGroupingRule";
|
|
209
|
+
|
|
201
210
|
import TableView from "./TableView";
|
|
202
211
|
import Dashboard from "./Dashboard";
|
|
203
212
|
|
|
@@ -291,6 +300,15 @@ const AllModelTypes: Array<{
|
|
|
291
300
|
AlertEpisodeFeed,
|
|
292
301
|
AlertGroupingRule,
|
|
293
302
|
|
|
303
|
+
IncidentEpisode,
|
|
304
|
+
IncidentEpisodeMember,
|
|
305
|
+
IncidentEpisodeStateTimeline,
|
|
306
|
+
IncidentEpisodeOwnerUser,
|
|
307
|
+
IncidentEpisodeOwnerTeam,
|
|
308
|
+
IncidentEpisodeInternalNote,
|
|
309
|
+
IncidentEpisodeFeed,
|
|
310
|
+
IncidentGroupingRule,
|
|
311
|
+
|
|
294
312
|
MonitorStatusTimeline,
|
|
295
313
|
|
|
296
314
|
File,
|
|
@@ -26,6 +26,7 @@ import UserNotificationEventType from "../../Types/UserNotification/UserNotifica
|
|
|
26
26
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
27
27
|
import Alert from "./Alert";
|
|
28
28
|
import AlertEpisode from "./AlertEpisode";
|
|
29
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
29
30
|
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
30
31
|
|
|
31
32
|
@TableBillingAccessControl({
|
|
@@ -412,6 +413,75 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
412
413
|
})
|
|
413
414
|
public triggeredByAlertEpisodeId?: ObjectID = undefined;
|
|
414
415
|
|
|
416
|
+
@ColumnAccessControl({
|
|
417
|
+
create: [
|
|
418
|
+
Permission.ProjectOwner,
|
|
419
|
+
Permission.ProjectAdmin,
|
|
420
|
+
Permission.ProjectMember,
|
|
421
|
+
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
422
|
+
],
|
|
423
|
+
read: [
|
|
424
|
+
Permission.ProjectOwner,
|
|
425
|
+
Permission.ProjectAdmin,
|
|
426
|
+
Permission.ProjectMember,
|
|
427
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
428
|
+
],
|
|
429
|
+
update: [],
|
|
430
|
+
})
|
|
431
|
+
@TableColumn({
|
|
432
|
+
manyToOneRelationColumn: "triggeredByIncidentEpisodeId",
|
|
433
|
+
type: TableColumnType.Entity,
|
|
434
|
+
modelType: IncidentEpisode,
|
|
435
|
+
title: "Triggered By Incident Episode",
|
|
436
|
+
description:
|
|
437
|
+
"Relation to the incident episode which triggered this on-call escalation policy.",
|
|
438
|
+
})
|
|
439
|
+
@ManyToOne(
|
|
440
|
+
() => {
|
|
441
|
+
return IncidentEpisode;
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
eager: false,
|
|
445
|
+
nullable: true,
|
|
446
|
+
onDelete: "CASCADE",
|
|
447
|
+
orphanedRowAction: "nullify",
|
|
448
|
+
},
|
|
449
|
+
)
|
|
450
|
+
@JoinColumn({ name: "triggeredByIncidentEpisodeId" })
|
|
451
|
+
public triggeredByIncidentEpisode?: IncidentEpisode = undefined;
|
|
452
|
+
|
|
453
|
+
@ColumnAccessControl({
|
|
454
|
+
create: [
|
|
455
|
+
Permission.ProjectOwner,
|
|
456
|
+
Permission.ProjectAdmin,
|
|
457
|
+
Permission.ProjectMember,
|
|
458
|
+
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
459
|
+
],
|
|
460
|
+
read: [
|
|
461
|
+
Permission.ProjectOwner,
|
|
462
|
+
Permission.ProjectAdmin,
|
|
463
|
+
Permission.ProjectMember,
|
|
464
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
465
|
+
],
|
|
466
|
+
update: [],
|
|
467
|
+
})
|
|
468
|
+
@Index()
|
|
469
|
+
@TableColumn({
|
|
470
|
+
type: TableColumnType.ObjectID,
|
|
471
|
+
required: false,
|
|
472
|
+
canReadOnRelationQuery: true,
|
|
473
|
+
title: "Triggered By Incident Episode ID",
|
|
474
|
+
description:
|
|
475
|
+
"ID of the incident episode which triggered this on-call escalation policy.",
|
|
476
|
+
example: "a7b8c9d0-e1f2-3456-0123-567890123456",
|
|
477
|
+
})
|
|
478
|
+
@Column({
|
|
479
|
+
type: ColumnType.ObjectID,
|
|
480
|
+
nullable: true,
|
|
481
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
482
|
+
})
|
|
483
|
+
public triggeredByIncidentEpisodeId?: ObjectID = undefined;
|
|
484
|
+
|
|
415
485
|
@ColumnAccessControl({
|
|
416
486
|
create: [
|
|
417
487
|
Permission.ProjectOwner,
|
|
@@ -28,6 +28,7 @@ import UserNotificationEventType from "../../Types/UserNotification/UserNotifica
|
|
|
28
28
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
29
29
|
import Alert from "./Alert";
|
|
30
30
|
import AlertEpisode from "./AlertEpisode";
|
|
31
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
31
32
|
|
|
32
33
|
@TableBillingAccessControl({
|
|
33
34
|
create: PlanType.Growth,
|
|
@@ -347,6 +348,64 @@ export default class OnCallDutyPolicyExecutionLogTimeline extends BaseModel {
|
|
|
347
348
|
})
|
|
348
349
|
public triggeredByAlertEpisodeId?: ObjectID = undefined;
|
|
349
350
|
|
|
351
|
+
@ColumnAccessControl({
|
|
352
|
+
create: [],
|
|
353
|
+
read: [
|
|
354
|
+
Permission.ProjectOwner,
|
|
355
|
+
Permission.ProjectAdmin,
|
|
356
|
+
Permission.ProjectMember,
|
|
357
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
|
|
358
|
+
],
|
|
359
|
+
update: [],
|
|
360
|
+
})
|
|
361
|
+
@TableColumn({
|
|
362
|
+
manyToOneRelationColumn: "triggeredByIncidentEpisodeId",
|
|
363
|
+
type: TableColumnType.Entity,
|
|
364
|
+
modelType: IncidentEpisode,
|
|
365
|
+
title: "Incident Episode",
|
|
366
|
+
description:
|
|
367
|
+
"Relation to Incident Episode Resource in which this object belongs",
|
|
368
|
+
})
|
|
369
|
+
@ManyToOne(
|
|
370
|
+
() => {
|
|
371
|
+
return IncidentEpisode;
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
eager: false,
|
|
375
|
+
nullable: true,
|
|
376
|
+
onDelete: "CASCADE",
|
|
377
|
+
orphanedRowAction: "nullify",
|
|
378
|
+
},
|
|
379
|
+
)
|
|
380
|
+
@JoinColumn({ name: "triggeredByIncidentEpisodeId" })
|
|
381
|
+
public triggeredByIncidentEpisode?: IncidentEpisode = undefined;
|
|
382
|
+
|
|
383
|
+
@ColumnAccessControl({
|
|
384
|
+
create: [],
|
|
385
|
+
read: [
|
|
386
|
+
Permission.ProjectOwner,
|
|
387
|
+
Permission.ProjectAdmin,
|
|
388
|
+
Permission.ProjectMember,
|
|
389
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
|
|
390
|
+
],
|
|
391
|
+
update: [],
|
|
392
|
+
})
|
|
393
|
+
@Index()
|
|
394
|
+
@TableColumn({
|
|
395
|
+
type: TableColumnType.ObjectID,
|
|
396
|
+
required: false,
|
|
397
|
+
canReadOnRelationQuery: true,
|
|
398
|
+
title: "Incident Episode ID",
|
|
399
|
+
description:
|
|
400
|
+
"ID of your OneUptime Incident Episode in which this object belongs",
|
|
401
|
+
})
|
|
402
|
+
@Column({
|
|
403
|
+
type: ColumnType.ObjectID,
|
|
404
|
+
nullable: true,
|
|
405
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
406
|
+
})
|
|
407
|
+
public triggeredByIncidentEpisodeId?: ObjectID = undefined;
|
|
408
|
+
|
|
350
409
|
@ColumnAccessControl({
|
|
351
410
|
create: [],
|
|
352
411
|
read: [
|
|
@@ -1105,6 +1105,35 @@ export default class Project extends TenantModel {
|
|
|
1105
1105
|
})
|
|
1106
1106
|
public enableAutoRechargeAiBalance?: boolean = undefined;
|
|
1107
1107
|
|
|
1108
|
+
@ColumnAccessControl({
|
|
1109
|
+
create: [Permission.ProjectOwner, Permission.ManageProjectBilling],
|
|
1110
|
+
read: [
|
|
1111
|
+
Permission.ProjectOwner,
|
|
1112
|
+
Permission.ProjectAdmin,
|
|
1113
|
+
Permission.ProjectMember,
|
|
1114
|
+
Permission.ReadProject,
|
|
1115
|
+
Permission.UnAuthorizedSsoUser,
|
|
1116
|
+
Permission.ProjectUser,
|
|
1117
|
+
],
|
|
1118
|
+
update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
|
|
1119
|
+
})
|
|
1120
|
+
@TableColumn({
|
|
1121
|
+
required: true,
|
|
1122
|
+
isDefaultValueColumn: true,
|
|
1123
|
+
type: TableColumnType.Boolean,
|
|
1124
|
+
title: "Send Invoices by Email",
|
|
1125
|
+
description:
|
|
1126
|
+
"When enabled, invoices will be automatically sent to the finance/accounting email when they are generated.",
|
|
1127
|
+
defaultValue: false,
|
|
1128
|
+
example: true,
|
|
1129
|
+
})
|
|
1130
|
+
@Column({
|
|
1131
|
+
nullable: false,
|
|
1132
|
+
default: false,
|
|
1133
|
+
type: ColumnType.Boolean,
|
|
1134
|
+
})
|
|
1135
|
+
public sendInvoicesByEmail?: boolean = undefined;
|
|
1136
|
+
|
|
1108
1137
|
@ColumnAccessControl({
|
|
1109
1138
|
create: [],
|
|
1110
1139
|
read: [],
|
|
@@ -29,6 +29,7 @@ import UserNotificationEventType from "../../Types/UserNotification/UserNotifica
|
|
|
29
29
|
import UserNotificationExecutionStatus from "../../Types/UserNotification/UserNotificationExecutionStatus";
|
|
30
30
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
31
31
|
import AlertEpisode from "./AlertEpisode";
|
|
32
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
32
33
|
import Alert from "./Alert";
|
|
33
34
|
|
|
34
35
|
@EnableDocumentation()
|
|
@@ -481,6 +482,53 @@ export default class UserOnCallLog extends BaseModel {
|
|
|
481
482
|
})
|
|
482
483
|
public triggeredByAlertEpisodeId?: ObjectID = undefined;
|
|
483
484
|
|
|
485
|
+
@ColumnAccessControl({
|
|
486
|
+
create: [],
|
|
487
|
+
read: [Permission.CurrentUser],
|
|
488
|
+
update: [],
|
|
489
|
+
})
|
|
490
|
+
@TableColumn({
|
|
491
|
+
manyToOneRelationColumn: "triggeredByIncidentEpisodeId",
|
|
492
|
+
type: TableColumnType.Entity,
|
|
493
|
+
modelType: IncidentEpisode,
|
|
494
|
+
title: "Triggered By Incident Episode",
|
|
495
|
+
description:
|
|
496
|
+
"Relation to Incident Episode which triggered this on-call duty policy.",
|
|
497
|
+
})
|
|
498
|
+
@ManyToOne(
|
|
499
|
+
() => {
|
|
500
|
+
return IncidentEpisode;
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
eager: false,
|
|
504
|
+
nullable: true,
|
|
505
|
+
onDelete: "CASCADE",
|
|
506
|
+
orphanedRowAction: "nullify",
|
|
507
|
+
},
|
|
508
|
+
)
|
|
509
|
+
@JoinColumn({ name: "triggeredByIncidentEpisodeId" })
|
|
510
|
+
public triggeredByIncidentEpisode?: IncidentEpisode = undefined;
|
|
511
|
+
|
|
512
|
+
@ColumnAccessControl({
|
|
513
|
+
create: [],
|
|
514
|
+
read: [Permission.CurrentUser],
|
|
515
|
+
update: [],
|
|
516
|
+
})
|
|
517
|
+
@TableColumn({
|
|
518
|
+
type: TableColumnType.ObjectID,
|
|
519
|
+
title: "Triggered By Incident Episode ID",
|
|
520
|
+
required: false,
|
|
521
|
+
description:
|
|
522
|
+
"ID of the Incident Episode which triggered this on-call escalation policy.",
|
|
523
|
+
example: "3c4d5e6f-7a8b-9c0d-1e2f-3a4b5c6d7e8f",
|
|
524
|
+
})
|
|
525
|
+
@Column({
|
|
526
|
+
type: ColumnType.ObjectID,
|
|
527
|
+
nullable: true,
|
|
528
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
529
|
+
})
|
|
530
|
+
public triggeredByIncidentEpisodeId?: ObjectID = undefined;
|
|
531
|
+
|
|
484
532
|
@ColumnAccessControl({
|
|
485
533
|
create: [],
|
|
486
534
|
read: [Permission.CurrentUser],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Incident from "./Incident";
|
|
2
2
|
import Alert from "./Alert";
|
|
3
3
|
import AlertEpisode from "./AlertEpisode";
|
|
4
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
4
5
|
import OnCallDutyPolicy from "./OnCallDutyPolicy";
|
|
5
6
|
import OnCallDutyPolicyEscalationRule from "./OnCallDutyPolicyEscalationRule";
|
|
6
7
|
import OnCallDutyPolicyExecutionLog from "./OnCallDutyPolicyExecutionLog";
|
|
@@ -438,6 +439,54 @@ export default class UserOnCallLogTimeline extends BaseModel {
|
|
|
438
439
|
})
|
|
439
440
|
public triggeredByAlertEpisodeId?: ObjectID = undefined;
|
|
440
441
|
|
|
442
|
+
@ColumnAccessControl({
|
|
443
|
+
create: [],
|
|
444
|
+
read: [Permission.CurrentUser],
|
|
445
|
+
update: [],
|
|
446
|
+
})
|
|
447
|
+
@TableColumn({
|
|
448
|
+
manyToOneRelationColumn: "triggeredByIncidentEpisodeId",
|
|
449
|
+
type: TableColumnType.Entity,
|
|
450
|
+
modelType: IncidentEpisode,
|
|
451
|
+
title: "Incident Episode",
|
|
452
|
+
description:
|
|
453
|
+
"Relation to Incident Episode Resource in which this object belongs",
|
|
454
|
+
})
|
|
455
|
+
@ManyToOne(
|
|
456
|
+
() => {
|
|
457
|
+
return IncidentEpisode;
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
eager: false,
|
|
461
|
+
nullable: true,
|
|
462
|
+
onDelete: "CASCADE",
|
|
463
|
+
orphanedRowAction: "nullify",
|
|
464
|
+
},
|
|
465
|
+
)
|
|
466
|
+
@JoinColumn({ name: "triggeredByIncidentEpisodeId" })
|
|
467
|
+
public triggeredByIncidentEpisode?: IncidentEpisode = undefined;
|
|
468
|
+
|
|
469
|
+
@ColumnAccessControl({
|
|
470
|
+
create: [],
|
|
471
|
+
read: [Permission.CurrentUser],
|
|
472
|
+
update: [],
|
|
473
|
+
})
|
|
474
|
+
@Index()
|
|
475
|
+
@TableColumn({
|
|
476
|
+
type: TableColumnType.ObjectID,
|
|
477
|
+
required: false,
|
|
478
|
+
canReadOnRelationQuery: true,
|
|
479
|
+
title: "Incident Episode ID",
|
|
480
|
+
description:
|
|
481
|
+
"ID of your OneUptime Incident Episode in which this object belongs",
|
|
482
|
+
})
|
|
483
|
+
@Column({
|
|
484
|
+
type: ColumnType.ObjectID,
|
|
485
|
+
nullable: true,
|
|
486
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
487
|
+
})
|
|
488
|
+
public triggeredByIncidentEpisodeId?: ObjectID = undefined;
|
|
489
|
+
|
|
441
490
|
@ColumnAccessControl({
|
|
442
491
|
create: [],
|
|
443
492
|
read: [Permission.CurrentUser],
|
|
@@ -2,6 +2,7 @@ import Project from "./Project";
|
|
|
2
2
|
import Incident from "./Incident";
|
|
3
3
|
import Alert from "./Alert";
|
|
4
4
|
import AlertEpisode from "./AlertEpisode";
|
|
5
|
+
import IncidentEpisode from "./IncidentEpisode";
|
|
5
6
|
import ScheduledMaintenance from "./ScheduledMaintenance";
|
|
6
7
|
import StatusPage from "./StatusPage";
|
|
7
8
|
import StatusPageAnnouncement from "./StatusPageAnnouncement";
|
|
@@ -539,6 +540,62 @@ export default class WorkspaceNotificationLog extends BaseModel {
|
|
|
539
540
|
})
|
|
540
541
|
public alertEpisodeId?: ObjectID = undefined;
|
|
541
542
|
|
|
543
|
+
@ColumnAccessControl({
|
|
544
|
+
create: [],
|
|
545
|
+
read: [
|
|
546
|
+
Permission.ProjectOwner,
|
|
547
|
+
Permission.ProjectAdmin,
|
|
548
|
+
Permission.ProjectMember,
|
|
549
|
+
Permission.ReadPushLog,
|
|
550
|
+
],
|
|
551
|
+
update: [],
|
|
552
|
+
})
|
|
553
|
+
@TableColumn({
|
|
554
|
+
manyToOneRelationColumn: "incidentEpisodeId",
|
|
555
|
+
type: TableColumnType.Entity,
|
|
556
|
+
modelType: IncidentEpisode,
|
|
557
|
+
title: "Incident Episode",
|
|
558
|
+
description: "Incident Episode associated with this message (if any)",
|
|
559
|
+
})
|
|
560
|
+
@ManyToOne(
|
|
561
|
+
() => {
|
|
562
|
+
return IncidentEpisode;
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
eager: false,
|
|
566
|
+
nullable: true,
|
|
567
|
+
onDelete: "CASCADE",
|
|
568
|
+
orphanedRowAction: "nullify",
|
|
569
|
+
},
|
|
570
|
+
)
|
|
571
|
+
@JoinColumn({ name: "incidentEpisodeId" })
|
|
572
|
+
public incidentEpisode?: IncidentEpisode = undefined;
|
|
573
|
+
|
|
574
|
+
@ColumnAccessControl({
|
|
575
|
+
create: [],
|
|
576
|
+
read: [
|
|
577
|
+
Permission.ProjectOwner,
|
|
578
|
+
Permission.ProjectAdmin,
|
|
579
|
+
Permission.ProjectMember,
|
|
580
|
+
Permission.ReadPushLog,
|
|
581
|
+
],
|
|
582
|
+
update: [],
|
|
583
|
+
})
|
|
584
|
+
@Index()
|
|
585
|
+
@TableColumn({
|
|
586
|
+
type: TableColumnType.ObjectID,
|
|
587
|
+
required: false,
|
|
588
|
+
canReadOnRelationQuery: true,
|
|
589
|
+
title: "Incident Episode ID",
|
|
590
|
+
description: "ID of Incident Episode associated with this message (if any)",
|
|
591
|
+
})
|
|
592
|
+
@Column({
|
|
593
|
+
type: ColumnType.ObjectID,
|
|
594
|
+
nullable: true,
|
|
595
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
596
|
+
})
|
|
597
|
+
public incidentEpisodeId?: ObjectID = undefined;
|
|
598
|
+
|
|
542
599
|
@ColumnAccessControl({
|
|
543
600
|
create: [],
|
|
544
601
|
read: [
|
package/Server/API/BillingAPI.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
1
|
+
import { BillingWebhookSecret, IsBillingEnabled } from "../EnvironmentConfig";
|
|
2
|
+
import Stripe from "stripe";
|
|
2
3
|
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
3
4
|
import BillingService from "../Services/BillingService";
|
|
4
5
|
import ProjectService from "../Services/ProjectService";
|
|
@@ -16,6 +17,7 @@ import Project from "../../Models/DatabaseModels/Project";
|
|
|
16
17
|
import CommonAPI from "./CommonAPI";
|
|
17
18
|
import ObjectID from "../../Types/ObjectID";
|
|
18
19
|
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
20
|
+
import logger from "../Utils/Logger";
|
|
19
21
|
|
|
20
22
|
export default class BillingAPI {
|
|
21
23
|
public router: ExpressRouter;
|
|
@@ -23,6 +25,81 @@ export default class BillingAPI {
|
|
|
23
25
|
public constructor() {
|
|
24
26
|
this.router = Express.getRouter();
|
|
25
27
|
|
|
28
|
+
// Stripe webhook endpoint - uses raw body captured by JSON parser for signature verification
|
|
29
|
+
this.router.post(
|
|
30
|
+
`/billing/webhook`,
|
|
31
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
32
|
+
try {
|
|
33
|
+
logger.debug(
|
|
34
|
+
`[Invoice Email] Webhook endpoint hit - /billing/webhook`,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (!IsBillingEnabled) {
|
|
38
|
+
logger.debug(
|
|
39
|
+
`[Invoice Email] Billing not enabled, returning early`,
|
|
40
|
+
);
|
|
41
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
42
|
+
message: "Billing is not enabled",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!BillingWebhookSecret) {
|
|
47
|
+
logger.error(
|
|
48
|
+
`[Invoice Email] Billing webhook secret is not configured`,
|
|
49
|
+
);
|
|
50
|
+
throw new BadDataException(
|
|
51
|
+
"Billing webhook secret is not configured",
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const signature: string = req.headers["stripe-signature"] as string;
|
|
56
|
+
logger.debug(
|
|
57
|
+
`[Invoice Email] Stripe signature header present: ${Boolean(signature)}`,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (!signature) {
|
|
61
|
+
logger.error(`[Invoice Email] Missing Stripe signature header`);
|
|
62
|
+
throw new BadDataException("Missing Stripe signature header");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const rawBody: string | undefined = (req as OneUptimeRequest).rawBody;
|
|
66
|
+
logger.debug(
|
|
67
|
+
`[Invoice Email] Raw body present: ${Boolean(rawBody)}, length: ${rawBody?.length || 0}`,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
if (!rawBody) {
|
|
71
|
+
logger.error(
|
|
72
|
+
`[Invoice Email] Missing raw body for webhook verification`,
|
|
73
|
+
);
|
|
74
|
+
throw new BadDataException(
|
|
75
|
+
"Missing raw body for webhook verification",
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
logger.debug(`[Invoice Email] Verifying webhook signature...`);
|
|
80
|
+
const event: Stripe.Event = BillingService.verifyWebhookSignature(
|
|
81
|
+
rawBody,
|
|
82
|
+
signature,
|
|
83
|
+
);
|
|
84
|
+
logger.debug(
|
|
85
|
+
`[Invoice Email] Webhook signature verified successfully, event type: ${event.type}`,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
// Handle the event asynchronously
|
|
89
|
+
logger.debug(`[Invoice Email] Handling webhook event...`);
|
|
90
|
+
await BillingService.handleWebhookEvent(event);
|
|
91
|
+
logger.debug(`[Invoice Email] Webhook event handled successfully`);
|
|
92
|
+
|
|
93
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
94
|
+
received: true,
|
|
95
|
+
});
|
|
96
|
+
} catch (err) {
|
|
97
|
+
logger.error(`[Invoice Email] Stripe webhook error: ${err}`);
|
|
98
|
+
next(err);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
|
|
26
103
|
this.router.get(
|
|
27
104
|
`/billing/customer-balance`,
|
|
28
105
|
UserMiddleware.getUserMiddleware,
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import IncidentEpisode from "../../Models/DatabaseModels/IncidentEpisode";
|
|
2
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
3
|
+
import NotFoundException from "../../Types/Exception/NotFoundException";
|
|
4
|
+
import ObjectID from "../../Types/ObjectID";
|
|
5
|
+
import IncidentEpisodeService, {
|
|
6
|
+
Service as IncidentEpisodeServiceType,
|
|
7
|
+
} from "../Services/IncidentEpisodeService";
|
|
8
|
+
import UserMiddleware from "../Middleware/UserAuthorization";
|
|
9
|
+
import Response from "../Utils/Response";
|
|
10
|
+
import BaseAPI from "./BaseAPI";
|
|
11
|
+
import {
|
|
12
|
+
ExpressRequest,
|
|
13
|
+
ExpressResponse,
|
|
14
|
+
NextFunction,
|
|
15
|
+
} from "../Utils/Express";
|
|
16
|
+
import CommonAPI from "./CommonAPI";
|
|
17
|
+
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
|
18
|
+
import AIService, { AILogRequest, AILogResponse } from "../Services/AIService";
|
|
19
|
+
import IncidentEpisodeAIContextBuilder, {
|
|
20
|
+
IncidentEpisodeContextData,
|
|
21
|
+
} from "../Utils/AI/IncidentEpisodeAIContextBuilder";
|
|
22
|
+
import { AIGenerationContext } from "../Utils/AI/IncidentAIContextBuilder";
|
|
23
|
+
import JSONFunctions from "../../Types/JSONFunctions";
|
|
24
|
+
import Permission from "../../Types/Permission";
|
|
25
|
+
|
|
26
|
+
export default class IncidentEpisodeAPI extends BaseAPI<
|
|
27
|
+
IncidentEpisode,
|
|
28
|
+
IncidentEpisodeServiceType
|
|
29
|
+
> {
|
|
30
|
+
public constructor() {
|
|
31
|
+
super(IncidentEpisode, IncidentEpisodeService);
|
|
32
|
+
|
|
33
|
+
// Generate postmortem from AI
|
|
34
|
+
this.router.post(
|
|
35
|
+
`${new this.entityType()
|
|
36
|
+
.getCrudApiPath()
|
|
37
|
+
?.toString()}/generate-postmortem-from-ai/:episodeId`,
|
|
38
|
+
UserMiddleware.getUserMiddleware,
|
|
39
|
+
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
|
40
|
+
try {
|
|
41
|
+
await this.generatePostmortemFromAI(req, res);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
next(err);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private async generatePostmortemFromAI(
|
|
50
|
+
req: ExpressRequest,
|
|
51
|
+
res: ExpressResponse,
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
const episodeIdParam: string | undefined = req.params["episodeId"];
|
|
54
|
+
|
|
55
|
+
if (!episodeIdParam) {
|
|
56
|
+
throw new BadDataException("Episode ID is required");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let episodeId: ObjectID;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
episodeId = new ObjectID(episodeIdParam);
|
|
63
|
+
} catch {
|
|
64
|
+
throw new BadDataException("Invalid Episode ID");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const props: DatabaseCommonInteractionProps =
|
|
68
|
+
await CommonAPI.getDatabaseCommonInteractionProps(req);
|
|
69
|
+
|
|
70
|
+
// Verify user has permission to edit the episode
|
|
71
|
+
const permissions: Array<Permission> | undefined = props
|
|
72
|
+
.userTenantAccessPermission?.["permissions"] as
|
|
73
|
+
| Array<Permission>
|
|
74
|
+
| undefined;
|
|
75
|
+
|
|
76
|
+
const hasPermission: boolean = permissions
|
|
77
|
+
? permissions.some((p: Permission) => {
|
|
78
|
+
return (
|
|
79
|
+
p === Permission.ProjectOwner ||
|
|
80
|
+
p === Permission.ProjectAdmin ||
|
|
81
|
+
p === Permission.EditIncidentEpisode
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
: false;
|
|
85
|
+
|
|
86
|
+
if (!hasPermission && !props.isMasterAdmin) {
|
|
87
|
+
throw new BadDataException(
|
|
88
|
+
"You do not have permission to generate postmortem for this episode. You need to have one of these permissions: Project Owner, Project Admin, Edit Incident Episode.",
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Get the template from request body if provided
|
|
93
|
+
const template: string | undefined = JSONFunctions.getJSONValueInPath(
|
|
94
|
+
req.body,
|
|
95
|
+
"template",
|
|
96
|
+
) as string | undefined;
|
|
97
|
+
|
|
98
|
+
// Always include workspace messages for comprehensive context
|
|
99
|
+
const includeWorkspaceMessages: boolean = true;
|
|
100
|
+
|
|
101
|
+
// Get the episode to verify it exists and get the project ID
|
|
102
|
+
const episode: IncidentEpisode | null = await this.service.findOneById({
|
|
103
|
+
id: episodeId,
|
|
104
|
+
select: {
|
|
105
|
+
_id: true,
|
|
106
|
+
projectId: true,
|
|
107
|
+
},
|
|
108
|
+
props,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
if (!episode || !episode.projectId) {
|
|
112
|
+
throw new NotFoundException("Episode not found");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Build episode context
|
|
116
|
+
const contextData: IncidentEpisodeContextData =
|
|
117
|
+
await IncidentEpisodeAIContextBuilder.buildEpisodeContext({
|
|
118
|
+
episodeId,
|
|
119
|
+
includeWorkspaceMessages,
|
|
120
|
+
workspaceMessageLimit: 500,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Format context for postmortem generation
|
|
124
|
+
const aiContext: AIGenerationContext =
|
|
125
|
+
IncidentEpisodeAIContextBuilder.formatEpisodeContextForPostmortem(
|
|
126
|
+
contextData,
|
|
127
|
+
template,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// Generate postmortem using AIService (handles billing and logging)
|
|
131
|
+
const aiLogRequest: AILogRequest = {
|
|
132
|
+
projectId: episode.projectId,
|
|
133
|
+
feature: "Incident Episode Postmortem",
|
|
134
|
+
messages: aiContext.messages,
|
|
135
|
+
maxTokens: 8192,
|
|
136
|
+
temperature: 0.7,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (props.userId) {
|
|
140
|
+
aiLogRequest.userId = props.userId;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const response: AILogResponse =
|
|
144
|
+
await AIService.executeWithLogging(aiLogRequest);
|
|
145
|
+
|
|
146
|
+
return Response.sendJsonObjectResponse(req, res, {
|
|
147
|
+
postmortemNote: response.content,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|