@oneuptime/common 7.0.3621 → 7.0.3652
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/Alert.ts +29 -0
- package/Models/DatabaseModels/Index.ts +10 -0
- package/Models/DatabaseModels/ScheduledMaintenance.ts +29 -0
- package/Models/DatabaseModels/WorkspaceNotificationRule.ts +461 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +379 -0
- package/Models/DatabaseModels/WorkspaceSetting.ts +230 -0
- package/Models/DatabaseModels/WorkspaceUserAuthToken.ts +312 -0
- package/Server/API/SlackAPI.ts +368 -0
- package/Server/EnvironmentConfig.ts +10 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.ts +147 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-MigrationName.ts +23 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Middleware/SlackAuthorization.ts +60 -0
- package/Server/Services/AlertService.ts +38 -2
- package/Server/Services/Index.ts +9 -0
- package/Server/Services/ProjectService.ts +3 -1
- package/Server/Services/ScheduledMaintenanceService.ts +39 -2
- package/Server/Services/UserService.ts +1 -1
- package/Server/Services/WorkspaceCommunicationTools/Slack.ts +0 -0
- package/Server/Services/WorkspaceCommunicationTools/Teams.ts +0 -0
- package/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.ts +0 -0
- package/Server/Services/WorkspaceNotificationRuleService.ts +22 -0
- package/Server/Services/WorkspaceProjectAuthTokenService.ts +84 -0
- package/Server/Services/WorkspaceSettingService.ts +78 -0
- package/Server/Services/WorkspaceUserAuthTokenService.ts +89 -0
- package/Server/Types/Workflow/Components/Slack/SendMessageToChannel.ts +1 -1
- package/Server/Utils/Express.ts +2 -1
- package/Server/Utils/Monitor/MonitorResource.ts +2 -5
- package/Server/Utils/{Slack.ts → Slack/Slack.ts} +40 -0
- package/Server/Utils/Slack/app-manifest-temp.json +198 -0
- package/Server/Utils/Slack/app-manifest.json +67 -0
- package/Server/Utils/StartServer.ts +2 -1
- package/Types/Filter/FilterCondition.ts +2 -2
- package/Types/Monitor/CriteriaFilter.ts +31 -5
- package/Types/Monitor/MonitorCriteriaInstance.ts +40 -10
- package/Types/Monitor/MonitorStep.ts +1 -1
- package/Types/Permission.ts +34 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.ts +3 -0
- package/Types/Workspace/NotificationRules/EventType.ts +8 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.ts +355 -0
- package/Types/Workspace/NotificationRules/SlackNotificationRule.ts +19 -0
- package/Types/Workspace/WorkspaceNotificationPayload.ts +3 -0
- package/Types/Workspace/WorkspaceType.ts +6 -0
- package/UI/Components/Forms/BasicForm.tsx +9 -0
- package/UI/Components/Forms/Fields/FormField.tsx +36 -1
- package/UI/Components/Forms/Types/Field.ts +2 -0
- package/UI/Components/Forms/Types/FormFieldSchemaType.ts +1 -1
- package/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.ts +2 -2
- package/UI/Components/Icon/Icon.tsx +18 -5
- package/UI/Components/Radio/Radio.tsx +12 -10
- package/UI/Config.ts +3 -0
- package/build/dist/Models/DatabaseModels/Alert.js +31 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +8 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +31 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js +481 -0
- package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js +390 -0
- package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceSetting.js +236 -0
- package/build/dist/Models/DatabaseModels/WorkspaceSetting.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js +326 -0
- package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js.map +1 -0
- package/build/dist/Server/API/SlackAPI.js +237 -0
- package/build/dist/Server/API/SlackAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +5 -1
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.js +58 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739209832500-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739210586538-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1739217257089-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/Middleware/SlackAuthorization.js +28 -0
- package/build/dist/Server/Middleware/SlackAuthorization.js.map +1 -0
- package/build/dist/Server/Services/AlertService.js +31 -5
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +8 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +2 -1
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +30 -3
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/UserService.js +1 -1
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Slack.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Slack.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Teams.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/Teams.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.js +2 -0
- package/build/dist/Server/Services/WorkspaceCommunicationTools/WorkspaceCommunicationBaseService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +14 -0
- package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js +63 -0
- package/build/dist/Server/Services/WorkspaceProjectAuthTokenService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceSettingService.js +59 -0
- package/build/dist/Server/Services/WorkspaceSettingService.js.map +1 -0
- package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js +66 -0
- package/build/dist/Server/Services/WorkspaceUserAuthTokenService.js.map +1 -0
- package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js +1 -1
- package/build/dist/Server/Types/Workflow/Components/Slack/SendMessageToChannel.js.map +1 -1
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +2 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Slack/Slack.js +49 -0
- package/build/dist/Server/Utils/Slack/Slack.js.map +1 -0
- package/build/dist/Server/Utils/Slack/app-manifest.json +67 -0
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Types/Filter/FilterCondition.js +2 -2
- package/build/dist/Types/Filter/FilterCondition.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +19 -5
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +33 -10
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Permission.js +32 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationRules/BaseNotificationRule.js +2 -0
- package/build/dist/Types/Workspace/NotificationRules/BaseNotificationRule.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js +9 -0
- package/build/dist/Types/Workspace/NotificationRules/EventType.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js +275 -0
- package/build/dist/Types/Workspace/NotificationRules/NotificationRuleCondition.js.map +1 -0
- package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js +2 -0
- package/build/dist/Types/Workspace/NotificationRules/SlackNotificationRule.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js +2 -0
- package/build/dist/Types/Workspace/WorkspaceNotificationPayload.js.map +1 -0
- package/build/dist/Types/Workspace/WorkspaceType.js +7 -0
- package/build/dist/Types/Workspace/WorkspaceType.js.map +1 -0
- package/build/dist/UI/Components/Forms/BasicForm.js +7 -0
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +21 -4
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Forms/Types/FormFieldSchemaType.js +1 -1
- package/build/dist/UI/Components/Forms/Types/FormFieldSchemaType.js.map +1 -1
- package/build/dist/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.js +2 -2
- package/build/dist/UI/Components/Forms/Utils/FormFieldSchemaTypeUtil.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +5 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Radio/Radio.js +4 -4
- package/build/dist/UI/Components/Radio/Radio.js.map +1 -1
- package/build/dist/UI/Config.js +1 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/package.json +2 -2
- package/build/dist/Server/Utils/Slack.js +0 -20
- package/build/dist/Server/Utils/Slack.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import ObjectID from "../../Types/ObjectID";
|
|
2
|
+
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
|
|
3
|
+
import DatabaseService from "./DatabaseService";
|
|
4
|
+
import Model, {
|
|
5
|
+
SlackMiscData,
|
|
6
|
+
} from "Common/Models/DatabaseModels/WorkspaceUserAuthToken";
|
|
7
|
+
|
|
8
|
+
export class Service extends DatabaseService<Model> {
|
|
9
|
+
public constructor() {
|
|
10
|
+
super(Model);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async doesExist(data: {
|
|
14
|
+
projectId: ObjectID;
|
|
15
|
+
userId: ObjectID;
|
|
16
|
+
workspaceType: WorkspaceType;
|
|
17
|
+
}): Promise<boolean> {
|
|
18
|
+
return (
|
|
19
|
+
(
|
|
20
|
+
await this.countBy({
|
|
21
|
+
query: {
|
|
22
|
+
projectId: data.projectId,
|
|
23
|
+
userId: data.userId,
|
|
24
|
+
workspaceType: data.workspaceType,
|
|
25
|
+
},
|
|
26
|
+
skip: 0,
|
|
27
|
+
limit: 1,
|
|
28
|
+
props: {
|
|
29
|
+
isRoot: true,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
).toNumber() > 0
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async refreshAuthToken(data: {
|
|
37
|
+
projectId: ObjectID;
|
|
38
|
+
userId: ObjectID;
|
|
39
|
+
workspaceType: WorkspaceType;
|
|
40
|
+
authToken: string;
|
|
41
|
+
workspaceUserId: string;
|
|
42
|
+
miscData: SlackMiscData;
|
|
43
|
+
}): Promise<void> {
|
|
44
|
+
let userAuth: Model | null = await this.findOneBy({
|
|
45
|
+
query: {
|
|
46
|
+
projectId: data.projectId,
|
|
47
|
+
userId: data.userId,
|
|
48
|
+
workspaceType: data.workspaceType,
|
|
49
|
+
},
|
|
50
|
+
select: {
|
|
51
|
+
_id: true,
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
isRoot: true,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (!userAuth) {
|
|
59
|
+
userAuth = new Model();
|
|
60
|
+
|
|
61
|
+
userAuth.projectId = data.projectId;
|
|
62
|
+
userAuth.userId = data.userId;
|
|
63
|
+
userAuth.authToken = data.authToken;
|
|
64
|
+
userAuth.workspaceType = data.workspaceType;
|
|
65
|
+
userAuth.workspaceUserId = data.workspaceUserId;
|
|
66
|
+
userAuth.miscData = data.miscData;
|
|
67
|
+
|
|
68
|
+
await this.create({
|
|
69
|
+
data: userAuth,
|
|
70
|
+
props: {
|
|
71
|
+
isRoot: true,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
await this.updateOneById({
|
|
76
|
+
id: userAuth.id!,
|
|
77
|
+
data: {
|
|
78
|
+
authToken: data.authToken,
|
|
79
|
+
workspaceUserId: data.workspaceUserId,
|
|
80
|
+
miscData: data.miscData,
|
|
81
|
+
},
|
|
82
|
+
props: {
|
|
83
|
+
isRoot: true,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export default new Service();
|
|
@@ -8,7 +8,7 @@ import { JSONObject } from "Common/Types/JSON";
|
|
|
8
8
|
import ComponentMetadata, { Port } from "Common/Types/Workflow/Component";
|
|
9
9
|
import ComponentID from "Common/Types/Workflow/ComponentID";
|
|
10
10
|
import SlackComponents from "Common/Types/Workflow/Components/Slack";
|
|
11
|
-
import SlackUtil from "../../../../Utils/Slack";
|
|
11
|
+
import SlackUtil from "../../../../Utils/Slack/Slack";
|
|
12
12
|
|
|
13
13
|
export default class SendMessageToChannel extends ComponentCode {
|
|
14
14
|
public constructor() {
|
package/Server/Utils/Express.ts
CHANGED
|
@@ -37,7 +37,8 @@ export interface OneUptimeRequest extends express.Request {
|
|
|
37
37
|
userAuthorization?: JSONWebTokenData;
|
|
38
38
|
tenantId?: ObjectID;
|
|
39
39
|
userGlobalAccessPermission?: UserGlobalAccessPermission;
|
|
40
|
-
userTenantAccessPermission?: Dictionary<UserTenantAccessPermission>; // tenantId <-> UserTenantAccessPermission
|
|
40
|
+
userTenantAccessPermission?: Dictionary<UserTenantAccessPermission>; // tenantId <-> UserTenantAccessPermission;
|
|
41
|
+
rawBody?: string; // raw body of the request before json parsing.
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface OneUptimeResponse extends express.Response {
|
|
@@ -16,11 +16,7 @@ import BadDataException from "Common/Types/Exception/BadDataException";
|
|
|
16
16
|
import BasicInfrastructureMetrics from "Common/Types/Infrastructure/BasicMetrics";
|
|
17
17
|
import ReturnResult from "Common/Types/IsolatedVM/ReturnResult";
|
|
18
18
|
import { JSONObject } from "Common/Types/JSON";
|
|
19
|
-
import {
|
|
20
|
-
CheckOn,
|
|
21
|
-
CriteriaFilter,
|
|
22
|
-
FilterCondition,
|
|
23
|
-
} from "Common/Types/Monitor/CriteriaFilter";
|
|
19
|
+
import { CheckOn, CriteriaFilter } from "Common/Types/Monitor/CriteriaFilter";
|
|
24
20
|
import IncomingMonitorRequest from "Common/Types/Monitor/IncomingMonitor/IncomingMonitorRequest";
|
|
25
21
|
import MonitorCriteria from "Common/Types/Monitor/MonitorCriteria";
|
|
26
22
|
import MonitorCriteriaInstance from "Common/Types/Monitor/MonitorCriteriaInstance";
|
|
@@ -57,6 +53,7 @@ import MonitorMetricType from "../../../Types/Monitor/MonitorMetricType";
|
|
|
57
53
|
import TelemetryUtil from "../Telemetry/Telemetry";
|
|
58
54
|
import MetricMonitorCriteria from "./Criteria/MetricMonitorCriteria";
|
|
59
55
|
import MetricMonitorResponse from "../../../Types/Monitor/MetricMonitor/MetricMonitorResponse";
|
|
56
|
+
import FilterCondition from "../../../Types/Filter/FilterCondition";
|
|
60
57
|
|
|
61
58
|
export default class MonitorResourceUtil {
|
|
62
59
|
public static async monitorResource(
|
|
@@ -5,6 +5,46 @@ import { JSONObject } from "Common/Types/JSON";
|
|
|
5
5
|
import API from "Common/Utils/API";
|
|
6
6
|
|
|
7
7
|
export default class SlackUtil {
|
|
8
|
+
public async getTextboxField(data: {
|
|
9
|
+
title: string;
|
|
10
|
+
placeholder: string;
|
|
11
|
+
actionId: string;
|
|
12
|
+
initialValue?: string;
|
|
13
|
+
}): Promise<JSONObject> {
|
|
14
|
+
return {
|
|
15
|
+
type: "input",
|
|
16
|
+
element: {
|
|
17
|
+
type: "plain_text_input",
|
|
18
|
+
action_id: data.actionId,
|
|
19
|
+
placeholder: {
|
|
20
|
+
type: "plain_text",
|
|
21
|
+
text: data.placeholder,
|
|
22
|
+
},
|
|
23
|
+
initial_value: data.initialValue,
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
type: "plain_text",
|
|
27
|
+
text: data.title,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getButtonField(data: {
|
|
33
|
+
text: string;
|
|
34
|
+
actionId: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}): JSONObject {
|
|
37
|
+
return {
|
|
38
|
+
type: "button",
|
|
39
|
+
text: {
|
|
40
|
+
type: "plain_text",
|
|
41
|
+
text: data.text,
|
|
42
|
+
},
|
|
43
|
+
action_id: data.actionId,
|
|
44
|
+
value: data.value,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
8
48
|
public static async sendMessageToChannel(data: {
|
|
9
49
|
url: URL;
|
|
10
50
|
text: string;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
{
|
|
2
|
+
"display_information": {
|
|
3
|
+
"name": "OneUptime",
|
|
4
|
+
"description": "The Complete Open-Source Observability Platform",
|
|
5
|
+
"background_color": "#000000",
|
|
6
|
+
"long_description": "OneUptime is a comprehensive solution for monitoring and managing your online services. Whether you need to check the availability of your website, dashboard, API, or any other online resource, OneUptime can alert your team when downtime happens and keep your customers informed with a status page. OneUptime also helps you handle incidents, set up on-call rotations, run tests, secure your services, analyze logs, track performance, and debug errors."
|
|
7
|
+
},
|
|
8
|
+
"features": {
|
|
9
|
+
"app_home": {
|
|
10
|
+
"home_tab_enabled": true,
|
|
11
|
+
"messages_tab_enabled": false,
|
|
12
|
+
"messages_tab_read_only_enabled": false
|
|
13
|
+
},
|
|
14
|
+
"bot_user": {
|
|
15
|
+
"display_name": "OneUptime",
|
|
16
|
+
"always_online": true
|
|
17
|
+
},
|
|
18
|
+
"shortcuts": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Create Scheduled Event",
|
|
21
|
+
"type": "global",
|
|
22
|
+
"callback_id": "create-scheduled-maintenance",
|
|
23
|
+
"description": "Create a new scheduled event in OneUptime"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "Create New Incident",
|
|
27
|
+
"type": "global",
|
|
28
|
+
"callback_id": "create-incident",
|
|
29
|
+
"description": "Creates a new incident in OneUptime"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"slash_commands": [
|
|
33
|
+
{
|
|
34
|
+
"command": "/oneuptime",
|
|
35
|
+
"url": "https://local.genosyn.com/api/slack/command",
|
|
36
|
+
"description": "OneUptime command",
|
|
37
|
+
"usage_hint": "incident, scheduled event.",
|
|
38
|
+
"should_escape": false
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"oauth_config": {
|
|
43
|
+
"redirect_urls": [
|
|
44
|
+
"https://local.genosyn.com/api/slack/auth"
|
|
45
|
+
],
|
|
46
|
+
"scopes": {
|
|
47
|
+
"user": [
|
|
48
|
+
"users:read",
|
|
49
|
+
"users:read.email",
|
|
50
|
+
"bookmarks:read",
|
|
51
|
+
"workflows.templates:write",
|
|
52
|
+
"workflows.templates:read",
|
|
53
|
+
"users:write",
|
|
54
|
+
"users.profile:write",
|
|
55
|
+
"users.profile:read",
|
|
56
|
+
"usergroups:write",
|
|
57
|
+
"usergroups:read",
|
|
58
|
+
"team:read",
|
|
59
|
+
"team.preferences:read",
|
|
60
|
+
"team.billing:read",
|
|
61
|
+
"stars:write",
|
|
62
|
+
"stars:read",
|
|
63
|
+
"search:read",
|
|
64
|
+
"remote_files:share",
|
|
65
|
+
"reminders:read",
|
|
66
|
+
"remote_files:read",
|
|
67
|
+
"reminders:write",
|
|
68
|
+
"reactions:write",
|
|
69
|
+
"reactions:read",
|
|
70
|
+
"profile",
|
|
71
|
+
"pins:write",
|
|
72
|
+
"pins:read",
|
|
73
|
+
"openid",
|
|
74
|
+
"mpim:write.topic",
|
|
75
|
+
"mpim:write",
|
|
76
|
+
"mpim:read",
|
|
77
|
+
"mpim:history",
|
|
78
|
+
"links:write",
|
|
79
|
+
"links:read",
|
|
80
|
+
"links.embed:write",
|
|
81
|
+
"im:write.topic",
|
|
82
|
+
"im:write",
|
|
83
|
+
"im:read",
|
|
84
|
+
"im:history",
|
|
85
|
+
"identity.team",
|
|
86
|
+
"identity.email",
|
|
87
|
+
"identity.basic",
|
|
88
|
+
"identity.avatar",
|
|
89
|
+
"identify",
|
|
90
|
+
"groups:write.topic",
|
|
91
|
+
"groups:write.invites",
|
|
92
|
+
"groups:write",
|
|
93
|
+
"groups:read",
|
|
94
|
+
"groups:history",
|
|
95
|
+
"files:write",
|
|
96
|
+
"files:read",
|
|
97
|
+
"emoji:read",
|
|
98
|
+
"email",
|
|
99
|
+
"dnd:write",
|
|
100
|
+
"dnd:read",
|
|
101
|
+
"chat:write",
|
|
102
|
+
"channels:write.topic",
|
|
103
|
+
"channels:write.invites",
|
|
104
|
+
"channels:write",
|
|
105
|
+
"channels:read",
|
|
106
|
+
"channels:history",
|
|
107
|
+
"canvases:write",
|
|
108
|
+
"canvases:read",
|
|
109
|
+
"calls:write",
|
|
110
|
+
"calls:read",
|
|
111
|
+
"bookmarks:write"
|
|
112
|
+
],
|
|
113
|
+
"bot": [
|
|
114
|
+
"app_mentions:read",
|
|
115
|
+
"assistant:write",
|
|
116
|
+
"bookmarks:read",
|
|
117
|
+
"bookmarks:write",
|
|
118
|
+
"calls:write",
|
|
119
|
+
"calls:read",
|
|
120
|
+
"canvases:read",
|
|
121
|
+
"canvases:write",
|
|
122
|
+
"channels:history",
|
|
123
|
+
"channels:join",
|
|
124
|
+
"channels:manage",
|
|
125
|
+
"channels:read",
|
|
126
|
+
"channels:write.invites",
|
|
127
|
+
"channels:write.topic",
|
|
128
|
+
"chat:write",
|
|
129
|
+
"chat:write.customize",
|
|
130
|
+
"chat:write.public",
|
|
131
|
+
"commands",
|
|
132
|
+
"conversations.connect:manage",
|
|
133
|
+
"conversations.connect:read",
|
|
134
|
+
"files:read",
|
|
135
|
+
"conversations.connect:write",
|
|
136
|
+
"dnd:read",
|
|
137
|
+
"emoji:read",
|
|
138
|
+
"files:write",
|
|
139
|
+
"groups:history",
|
|
140
|
+
"groups:read",
|
|
141
|
+
"groups:write",
|
|
142
|
+
"groups:write.invites",
|
|
143
|
+
"groups:write.topic",
|
|
144
|
+
"im:read",
|
|
145
|
+
"im:history",
|
|
146
|
+
"incoming-webhook",
|
|
147
|
+
"links.embed:write",
|
|
148
|
+
"im:write.topic",
|
|
149
|
+
"im:write",
|
|
150
|
+
"links:read",
|
|
151
|
+
"links:write",
|
|
152
|
+
"metadata.message:read",
|
|
153
|
+
"mpim:history",
|
|
154
|
+
"pins:read",
|
|
155
|
+
"users:read.email",
|
|
156
|
+
"users:read",
|
|
157
|
+
"mpim:read",
|
|
158
|
+
"mpim:write",
|
|
159
|
+
"mpim:write.topic",
|
|
160
|
+
"pins:write",
|
|
161
|
+
"reactions:write",
|
|
162
|
+
"reactions:read",
|
|
163
|
+
"reminders:read",
|
|
164
|
+
"search:read.files",
|
|
165
|
+
"remote_files:write",
|
|
166
|
+
"remote_files:share",
|
|
167
|
+
"reminders:write",
|
|
168
|
+
"remote_files:read",
|
|
169
|
+
"search:read.im",
|
|
170
|
+
"team.billing:read",
|
|
171
|
+
"team.preferences:read",
|
|
172
|
+
"search:read.mpim",
|
|
173
|
+
"search:read.private",
|
|
174
|
+
"search:read.public",
|
|
175
|
+
"usergroups:read",
|
|
176
|
+
"usergroups:write",
|
|
177
|
+
"triggers:write",
|
|
178
|
+
"team:read",
|
|
179
|
+
"triggers:read",
|
|
180
|
+
"users.profile:read",
|
|
181
|
+
"users:write",
|
|
182
|
+
"workflows.templates:read",
|
|
183
|
+
"workflow.steps:execute",
|
|
184
|
+
"workflows.templates:write"
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"settings": {
|
|
189
|
+
"interactivity": {
|
|
190
|
+
"is_enabled": true,
|
|
191
|
+
"request_url": "https://local.genosyn.com/api/slack/interactive",
|
|
192
|
+
"message_menu_options_url": "https://local.genosyn.com/api/slack/options-load"
|
|
193
|
+
},
|
|
194
|
+
"org_deploy_enabled": true,
|
|
195
|
+
"socket_mode_enabled": false,
|
|
196
|
+
"token_rotation_enabled": false
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"display_information": {
|
|
3
|
+
"name": "OneUptime",
|
|
4
|
+
"description": "The Complete Open-Source Observability Platform",
|
|
5
|
+
"background_color": "#000000",
|
|
6
|
+
"long_description": "OneUptime is a comprehensive solution for monitoring and managing your online services. Whether you need to check the availability of your website, dashboard, API, or any other online resource, OneUptime can alert your team when downtime happens and keep your customers informed with a status page. OneUptime also helps you handle incidents, set up on-call rotations, run tests, secure your services, analyze logs, track performance, and debug errors."
|
|
7
|
+
},
|
|
8
|
+
"features": {
|
|
9
|
+
"app_home": {
|
|
10
|
+
"home_tab_enabled": true,
|
|
11
|
+
"messages_tab_enabled": false,
|
|
12
|
+
"messages_tab_read_only_enabled": false
|
|
13
|
+
},
|
|
14
|
+
"bot_user": {
|
|
15
|
+
"display_name": "OneUptime",
|
|
16
|
+
"always_online": true
|
|
17
|
+
},
|
|
18
|
+
"shortcuts": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Create Scheduled Event",
|
|
21
|
+
"type": "global",
|
|
22
|
+
"callback_id": "create-scheduled-maintenance",
|
|
23
|
+
"description": "Create a new scheduled event in OneUptime"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "Create New Incident",
|
|
27
|
+
"type": "global",
|
|
28
|
+
"callback_id": "create-incident",
|
|
29
|
+
"description": "Creates a new incident in OneUptime"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"slash_commands": [
|
|
33
|
+
{
|
|
34
|
+
"command": "/oneuptime",
|
|
35
|
+
"url": "https://local.genosyn.com/api/slack/command",
|
|
36
|
+
"description": "OneUptime command",
|
|
37
|
+
"usage_hint": "incident, scheduled event.",
|
|
38
|
+
"should_escape": false
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"oauth_config": {
|
|
43
|
+
"redirect_urls": [
|
|
44
|
+
"https://local.genosyn.com/api/slack/auth"
|
|
45
|
+
],
|
|
46
|
+
"scopes": {
|
|
47
|
+
"user": [
|
|
48
|
+
"identity.email",
|
|
49
|
+
"identity.basic",
|
|
50
|
+
"email"
|
|
51
|
+
],
|
|
52
|
+
"bot": [
|
|
53
|
+
"commands"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"settings": {
|
|
58
|
+
"interactivity": {
|
|
59
|
+
"is_enabled": true,
|
|
60
|
+
"request_url": "https://local.genosyn.com/api/slack/interactive",
|
|
61
|
+
"message_menu_options_url": "https://local.genosyn.com/api/slack/options-load"
|
|
62
|
+
},
|
|
63
|
+
"org_deploy_enabled": true,
|
|
64
|
+
"socket_mode_enabled": false,
|
|
65
|
+
"token_rotation_enabled": false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -12,6 +12,7 @@ import Express, {
|
|
|
12
12
|
ExpressStatic,
|
|
13
13
|
ExpressUrlEncoded,
|
|
14
14
|
NextFunction,
|
|
15
|
+
OneUptimeRequest,
|
|
15
16
|
RequestHandler,
|
|
16
17
|
} from "./Express";
|
|
17
18
|
import logger from "./Logger";
|
|
@@ -82,7 +83,7 @@ app.set("view engine", "ejs");
|
|
|
82
83
|
* https://stackoverflow.com/questions/19917401/error-request-entity-too-large
|
|
83
84
|
*/
|
|
84
85
|
|
|
85
|
-
app.use((req:
|
|
86
|
+
app.use((req: OneUptimeRequest, res: ExpressResponse, next: NextFunction) => {
|
|
86
87
|
if (req.headers["content-encoding"] === "gzip") {
|
|
87
88
|
const buffers: any = [];
|
|
88
89
|
|
|
@@ -110,12 +110,38 @@ export enum FilterType {
|
|
|
110
110
|
IsNotExecuting = "Is Not Executing",
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export enum FilterCondition {
|
|
114
|
-
All = "All",
|
|
115
|
-
Any = "Any",
|
|
116
|
-
}
|
|
117
|
-
|
|
118
113
|
export class CriteriaFilterUtil {
|
|
114
|
+
public static hasValueField(data: {
|
|
115
|
+
checkOn: CheckOn;
|
|
116
|
+
filterType: FilterType | undefined;
|
|
117
|
+
}): boolean {
|
|
118
|
+
const { checkOn } = data;
|
|
119
|
+
|
|
120
|
+
if (checkOn === CheckOn.IsOnline) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (
|
|
125
|
+
checkOn === CheckOn.IsValidCertificate ||
|
|
126
|
+
checkOn === CheckOn.IsSelfSignedCertificate ||
|
|
127
|
+
checkOn === CheckOn.IsExpiredCertificate ||
|
|
128
|
+
checkOn === CheckOn.IsNotAValidCertificate
|
|
129
|
+
) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (
|
|
134
|
+
FilterType.IsEmpty === data.filterType ||
|
|
135
|
+
FilterType.IsNotEmpty === data.filterType ||
|
|
136
|
+
FilterType.True === data.filterType ||
|
|
137
|
+
FilterType.False === data.filterType
|
|
138
|
+
) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
119
145
|
public static getEvaluateOverTimeTypeByCriteriaFilter(
|
|
120
146
|
criteriaFilter: CriteriaFilter | undefined,
|
|
121
147
|
): Array<EvaluateOverTimeType> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import DatabaseProperty from "../Database/DatabaseProperty";
|
|
2
2
|
import BadDataException from "../Exception/BadDataException";
|
|
3
|
+
import FilterCondition from "../Filter/FilterCondition";
|
|
3
4
|
import { JSONObject, ObjectType } from "../JSON";
|
|
4
5
|
import JSONFunctions from "../JSONFunctions";
|
|
5
6
|
import ObjectID from "../ObjectID";
|
|
@@ -8,9 +9,9 @@ import { CriteriaAlert } from "./CriteriaAlert";
|
|
|
8
9
|
import {
|
|
9
10
|
CheckOn,
|
|
10
11
|
CriteriaFilter,
|
|
11
|
-
FilterCondition,
|
|
12
12
|
FilterType,
|
|
13
13
|
EvaluateOverTimeType,
|
|
14
|
+
CriteriaFilterUtil,
|
|
14
15
|
} from "./CriteriaFilter";
|
|
15
16
|
import { CriteriaIncident } from "./CriteriaIncident";
|
|
16
17
|
import MonitorType from "./MonitorType";
|
|
@@ -699,19 +700,19 @@ export default class MonitorCriteriaInstance extends DatabaseProperty {
|
|
|
699
700
|
monitorType: MonitorType,
|
|
700
701
|
): string | null {
|
|
701
702
|
if (!value.data) {
|
|
702
|
-
return
|
|
703
|
+
return `Monitor Step is required.`;
|
|
703
704
|
}
|
|
704
705
|
|
|
705
706
|
if (value.data.filters.length === 0) {
|
|
706
|
-
return
|
|
707
|
+
return `Filter is required for criteria "${value.data.name}"`;
|
|
707
708
|
}
|
|
708
709
|
|
|
709
710
|
if (!value.data.name) {
|
|
710
|
-
return
|
|
711
|
+
return `Name is required for criteria "${value.data.name}"`;
|
|
711
712
|
}
|
|
712
713
|
|
|
713
714
|
if (!value.data.description) {
|
|
714
|
-
return
|
|
715
|
+
return `Description is required for criteria "${value.data.name}"`;
|
|
715
716
|
}
|
|
716
717
|
|
|
717
718
|
for (const incident of value.data.incidents) {
|
|
@@ -720,21 +721,39 @@ export default class MonitorCriteriaInstance extends DatabaseProperty {
|
|
|
720
721
|
}
|
|
721
722
|
|
|
722
723
|
if (!incident.title) {
|
|
723
|
-
return
|
|
724
|
+
return `Incident title is required for criteria "${value.data.name}"`;
|
|
724
725
|
}
|
|
725
726
|
|
|
726
727
|
if (!incident.description) {
|
|
727
|
-
return
|
|
728
|
+
return `Incident description is required for criteria "${value.data.name}"`;
|
|
728
729
|
}
|
|
729
730
|
|
|
730
731
|
if (!incident.incidentSeverityId) {
|
|
731
|
-
return
|
|
732
|
+
return `Incident severity is required for criteria "${value.data.name}"`;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
for (const alert of value.data.alerts) {
|
|
737
|
+
if (!alert) {
|
|
738
|
+
continue;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
if (!alert.title) {
|
|
742
|
+
return `Alert title is required for criteria "${value.data.name}"`;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
if (!alert.description) {
|
|
746
|
+
return `Alert description is required for criteria "${value.data.name}"`;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
if (!alert.alertSeverityId) {
|
|
750
|
+
return `Alert severity is required for criteria "${value.data.name}"`;
|
|
732
751
|
}
|
|
733
752
|
}
|
|
734
753
|
|
|
735
754
|
for (const filter of value.data.filters) {
|
|
736
755
|
if (!filter.checkOn) {
|
|
737
|
-
return
|
|
756
|
+
return `Filter Type is required for criteria "${value.data.name}"`;
|
|
738
757
|
}
|
|
739
758
|
|
|
740
759
|
if (
|
|
@@ -742,7 +761,7 @@ export default class MonitorCriteriaInstance extends DatabaseProperty {
|
|
|
742
761
|
filter.checkOn !== CheckOn.IsOnline &&
|
|
743
762
|
filter.checkOn !== CheckOn.ResponseTime
|
|
744
763
|
) {
|
|
745
|
-
return "Ping
|
|
764
|
+
return "Ping Monitor cannot have filter type: " + filter.checkOn;
|
|
746
765
|
}
|
|
747
766
|
|
|
748
767
|
if (
|
|
@@ -751,6 +770,17 @@ export default class MonitorCriteriaInstance extends DatabaseProperty {
|
|
|
751
770
|
) {
|
|
752
771
|
return "Disk Path is required for Disk Usage Percent";
|
|
753
772
|
}
|
|
773
|
+
|
|
774
|
+
if (
|
|
775
|
+
CriteriaFilterUtil.hasValueField({
|
|
776
|
+
checkOn: filter.checkOn,
|
|
777
|
+
filterType: filter.filterType,
|
|
778
|
+
})
|
|
779
|
+
) {
|
|
780
|
+
if (!filter.value && filter.value !== 0) {
|
|
781
|
+
return `Value is required for criteria "${value.data.name}" on filter type: ${filter.checkOn}`;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
754
784
|
}
|
|
755
785
|
|
|
756
786
|
return null;
|