@oneuptime/common 7.0.2972 → 7.0.2981
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/AnalyticsModels/AnalyticsBaseModel/CommonModel.ts +8 -7
- package/Models/DatabaseModels/Monitor.ts +36 -0
- package/Models/DatabaseModels/StatusPage.ts +71 -0
- package/Models/DatabaseModels/StatusPageResource.ts +1 -7
- package/Server/API/BaseAnalyticsAPI.ts +2 -6
- package/Server/API/StatusPageAPI.ts +2 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1723825511054-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1723828588502-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724078044172-MigrationName.ts +23 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/AnalyticsDatabaseService.ts +2 -2
- package/Server/Services/DatabaseService.ts +2 -2
- package/Server/Services/MonitorService.ts +9 -0
- package/Server/Services/ProjectService.ts +16 -2
- package/Server/Services/StatusPageHeaderLinkService.ts +1 -1
- package/Server/Services/StatusPageService.ts +11 -3
- package/Server/Types/AnalyticsDatabase/QueryHelper.ts +8 -7
- package/Server/Types/Database/Query.ts +6 -20
- package/Server/Types/Database/QueryHelper.ts +59 -42
- package/Server/Types/Database/QueryUtil.ts +8 -7
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +1 -1
- package/Tests/Types/Database/CompareBase.test.ts +6 -6
- package/Tests/Types/Database/Date.test.ts +1 -1
- package/Tests/Types/Database/EqualToOrNull.test.ts +14 -8
- package/Tests/Types/Database/InBetween.test.ts +8 -8
- package/Tests/Types/Database/NotEqual.test.ts +2 -2
- package/Types/BaseDatabase/AggregateBy.ts +1 -1
- package/Types/BaseDatabase/EqualToOrNull.ts +12 -16
- package/Types/BaseDatabase/GreaterThan.ts +8 -6
- package/Types/BaseDatabase/GreaterThanOrEqual.ts +10 -6
- package/Types/BaseDatabase/InBetween.ts +21 -23
- package/Types/BaseDatabase/Includes.ts +2 -2
- package/Types/BaseDatabase/IsNull.ts +3 -2
- package/Types/BaseDatabase/LessThan.ts +8 -6
- package/Types/BaseDatabase/LessThanOrEqual.ts +10 -6
- package/Types/BaseDatabase/NotEqual.ts +10 -17
- package/Types/BaseDatabase/NotNull.ts +3 -2
- package/Types/BaseDatabase/Query.ts +17 -6
- package/Types/BaseDatabase/QueryOperator.ts +11 -0
- package/Types/BaseDatabase/Search.ts +12 -10
- package/Types/Database/CompareBase.ts +10 -6
- package/Types/Database/Date.ts +1 -1
- package/Types/Date.ts +3 -1
- package/Types/Domain.ts +1 -1
- package/Types/JSON.ts +17 -16
- package/Types/JSONFunctions.ts +3 -2
- package/Types/Monitor/MonitorSteps.ts +1 -1
- package/Types/StatusPage/UptimePrecision.ts +8 -0
- package/UI/Components/Alerts/Alert.tsx +18 -7
- package/UI/Components/Date/StartAndEndDate.tsx +6 -8
- package/UI/Components/Filters/DateFilter.tsx +6 -3
- package/UI/Components/Filters/FilterViewer.tsx +3 -1
- package/UI/Components/Filters/JSONFilter.tsx +4 -1
- package/UI/Components/Filters/Types/FilterData.ts +1 -1
- package/UI/Components/HeaderAlert/HeaderModelAlert.tsx +1 -1
- package/UI/Components/Link/Link.tsx +14 -0
- package/UI/Components/ModelFilter/Filter.ts +1 -1
- package/UI/Components/ModelList/ModelList.tsx +1 -1
- package/UI/Components/ModelListModal/ModelListModal.tsx +1 -1
- package/UI/Components/ModelProgress/ModelProgress.tsx +1 -1
- package/UI/Components/ModelTable/AnalyticsModelTable.tsx +1 -1
- package/UI/Components/ModelTable/BaseModelTable.tsx +1 -1
- package/UI/Components/ModelTable/ModelTable.tsx +1 -1
- package/UI/Components/SideMenu/CountModelSideMenuItem.tsx +1 -1
- package/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.ts +1 -1
- package/UI/Utils/ModelAPI/ModelAPI.ts +1 -1
- package/UI/Utils/Realtime.ts +1 -1
- package/Utils/CronTime.ts +1 -0
- package/Utils/Uptime/UptimeUtil.ts +119 -6
- package/build/dist/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Monitor.js +36 -0
- package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +75 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageResource.js +1 -7
- package/build/dist/Models/DatabaseModels/StatusPageResource.js.map +1 -1
- package/build/dist/Server/API/BaseAnalyticsAPI.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +2 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1723825511054-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1723825511054-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1723828588502-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1723828588502-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724078044172-MigrationName.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724078044172-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/Services/AnalyticsDatabaseService.js +2 -2
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +7 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/ProjectService.js +15 -2
- package/build/dist/Server/Services/ProjectService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageHeaderLinkService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +6 -1
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/QueryHelper.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Tests/Types/Database/CompareBase.test.js.map +1 -1
- package/build/dist/Tests/Types/Database/EqualToOrNull.test.js.map +1 -1
- package/build/dist/Tests/Types/Database/InBetween.test.js.map +1 -1
- package/build/dist/Tests/Types/Database/NotEqual.test.js.map +1 -1
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js +4 -10
- package/build/dist/Types/BaseDatabase/EqualToOrNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/GreaterThan.js.map +1 -1
- package/build/dist/Types/BaseDatabase/GreaterThanOrEqual.js.map +1 -1
- package/build/dist/Types/BaseDatabase/InBetween.js +2 -2
- package/build/dist/Types/BaseDatabase/InBetween.js.map +1 -1
- package/build/dist/Types/BaseDatabase/Includes.js +2 -2
- package/build/dist/Types/BaseDatabase/Includes.js.map +1 -1
- package/build/dist/Types/BaseDatabase/IsNull.js +2 -2
- package/build/dist/Types/BaseDatabase/IsNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/LessThan.js.map +1 -1
- package/build/dist/Types/BaseDatabase/LessThanOrEqual.js.map +1 -1
- package/build/dist/Types/BaseDatabase/NotEqual.js +4 -11
- package/build/dist/Types/BaseDatabase/NotEqual.js.map +1 -1
- package/build/dist/Types/BaseDatabase/NotNull.js +2 -2
- package/build/dist/Types/BaseDatabase/NotNull.js.map +1 -1
- package/build/dist/Types/BaseDatabase/QueryOperator.js +7 -0
- package/build/dist/Types/BaseDatabase/QueryOperator.js.map +1 -0
- package/build/dist/Types/BaseDatabase/Search.js +2 -2
- package/build/dist/Types/BaseDatabase/Search.js.map +1 -1
- package/build/dist/Types/Database/CompareBase.js +2 -2
- package/build/dist/Types/Database/CompareBase.js.map +1 -1
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Domain.js +1 -1
- package/build/dist/Types/Domain.js.map +1 -1
- package/build/dist/Types/JSON.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorSteps.js +1 -1
- package/build/dist/Types/Monitor/MonitorSteps.js.map +1 -1
- package/build/dist/Types/StatusPage/UptimePrecision.js +9 -0
- package/build/dist/Types/StatusPage/UptimePrecision.js.map +1 -0
- package/build/dist/UI/Components/Alerts/Alert.js +11 -8
- package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
- package/build/dist/UI/Components/Date/StartAndEndDate.js.map +1 -1
- package/build/dist/UI/Components/Filters/DateFilter.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/Filters/JSONFilter.js.map +1 -1
- package/build/dist/UI/Components/Link/Link.js +13 -1
- package/build/dist/UI/Components/Link/Link.js.map +1 -1
- package/build/dist/UI/Utils/AnalyticsModelAPI/AnalyticsModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/ModelAPI/ModelAPI.js.map +1 -1
- package/build/dist/UI/Utils/Realtime.js.map +1 -1
- package/build/dist/Utils/CronTime.js +1 -0
- package/build/dist/Utils/CronTime.js.map +1 -1
- package/build/dist/Utils/Uptime/UptimeUtil.js +72 -5
- package/build/dist/Utils/Uptime/UptimeUtil.js.map +1 -1
- package/package.json +2 -2
- package/UI/Utils/BaseDatabase/Query.ts +0 -25
- package/build/dist/UI/Utils/BaseDatabase/Query.js +0 -2
- package/build/dist/UI/Utils/BaseDatabase/Query.js.map +0 -1
|
@@ -9,6 +9,7 @@ import LessThan from "../../../Types/BaseDatabase/LessThan";
|
|
|
9
9
|
import LessThanOrEqual from "../../../Types/BaseDatabase/LessThanOrEqual";
|
|
10
10
|
import NotEqual from "../../../Types/BaseDatabase/NotEqual";
|
|
11
11
|
import Search from "../../../Types/BaseDatabase/Search";
|
|
12
|
+
import { CompareType } from "../../../Types/Database/CompareBase";
|
|
12
13
|
import OneUptimeDate from "../../../Types/Date";
|
|
13
14
|
import BadDataException from "../../../Types/Exception/BadDataException";
|
|
14
15
|
import { JSONArray, JSONObject, JSONValue } from "../../../Types/JSON";
|
|
@@ -21,15 +22,15 @@ export type RecordValue =
|
|
|
21
22
|
| number
|
|
22
23
|
| boolean
|
|
23
24
|
| Date
|
|
24
|
-
| Search
|
|
25
|
-
| NotEqual
|
|
26
|
-
| GreaterThan
|
|
27
|
-
| InBetween
|
|
25
|
+
| Search<string>
|
|
26
|
+
| NotEqual<CompareType>
|
|
27
|
+
| GreaterThan<CompareType>
|
|
28
|
+
| InBetween<CompareType>
|
|
28
29
|
| Includes
|
|
29
30
|
| Date
|
|
30
|
-
| LessThan
|
|
31
|
-
| LessThanOrEqual
|
|
32
|
-
| GreaterThanOrEqual
|
|
31
|
+
| LessThan<CompareType>
|
|
32
|
+
| LessThanOrEqual<CompareType>
|
|
33
|
+
| GreaterThanOrEqual<CompareType>
|
|
33
34
|
| Array<number>
|
|
34
35
|
| Array<string>
|
|
35
36
|
| Array<ObjectID>
|
|
@@ -709,6 +709,42 @@ export default class Monitor extends BaseModel {
|
|
|
709
709
|
})
|
|
710
710
|
public incomingRequestReceivedAt?: Date = undefined;
|
|
711
711
|
|
|
712
|
+
@ColumnAccessControl({
|
|
713
|
+
create: [
|
|
714
|
+
Permission.ProjectOwner,
|
|
715
|
+
Permission.ProjectAdmin,
|
|
716
|
+
Permission.ProjectMember,
|
|
717
|
+
Permission.CreateProjectMonitor,
|
|
718
|
+
],
|
|
719
|
+
read: [
|
|
720
|
+
Permission.ProjectOwner,
|
|
721
|
+
Permission.ProjectAdmin,
|
|
722
|
+
Permission.ProjectMember,
|
|
723
|
+
Permission.ReadProjectMonitor,
|
|
724
|
+
],
|
|
725
|
+
update: [
|
|
726
|
+
Permission.ProjectOwner,
|
|
727
|
+
Permission.ProjectAdmin,
|
|
728
|
+
Permission.ProjectMember,
|
|
729
|
+
Permission.CreateProjectMonitor,
|
|
730
|
+
],
|
|
731
|
+
})
|
|
732
|
+
@Index()
|
|
733
|
+
@TableColumn({
|
|
734
|
+
type: TableColumnType.Date,
|
|
735
|
+
required: false,
|
|
736
|
+
isDefaultValueColumn: false,
|
|
737
|
+
title:
|
|
738
|
+
"When was the last time we checked the heartbeat for incoming request?",
|
|
739
|
+
description:
|
|
740
|
+
"This field is for Incoming Request monitor only. When was the last time we checked the heartbeat?",
|
|
741
|
+
})
|
|
742
|
+
@Column({
|
|
743
|
+
type: ColumnType.Date,
|
|
744
|
+
nullable: true,
|
|
745
|
+
})
|
|
746
|
+
public incomingRequestMonitorHeartbeatCheckedAt?: Date = undefined;
|
|
747
|
+
|
|
712
748
|
@ColumnAccessControl({
|
|
713
749
|
create: [
|
|
714
750
|
Permission.ProjectOwner,
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
ManyToMany,
|
|
40
40
|
ManyToOne,
|
|
41
41
|
} from "typeorm";
|
|
42
|
+
import UptimePrecision from "../../Types/StatusPage/UptimePrecision";
|
|
42
43
|
|
|
43
44
|
@EnableDocumentation()
|
|
44
45
|
@AccessControlColumn("labels")
|
|
@@ -1864,4 +1865,74 @@ export default class StatusPage extends BaseModel {
|
|
|
1864
1865
|
create: PlanType.Free,
|
|
1865
1866
|
})
|
|
1866
1867
|
public reportDataInDays?: number = undefined;
|
|
1868
|
+
|
|
1869
|
+
@ColumnAccessControl({
|
|
1870
|
+
create: [
|
|
1871
|
+
Permission.ProjectOwner,
|
|
1872
|
+
Permission.ProjectAdmin,
|
|
1873
|
+
Permission.ProjectMember,
|
|
1874
|
+
Permission.CreateProjectStatusPage,
|
|
1875
|
+
],
|
|
1876
|
+
read: [
|
|
1877
|
+
Permission.ProjectOwner,
|
|
1878
|
+
Permission.ProjectAdmin,
|
|
1879
|
+
Permission.ProjectMember,
|
|
1880
|
+
Permission.ReadProjectStatusPage,
|
|
1881
|
+
],
|
|
1882
|
+
update: [
|
|
1883
|
+
Permission.ProjectOwner,
|
|
1884
|
+
Permission.ProjectAdmin,
|
|
1885
|
+
Permission.ProjectMember,
|
|
1886
|
+
Permission.EditProjectStatusPage,
|
|
1887
|
+
],
|
|
1888
|
+
})
|
|
1889
|
+
@TableColumn({
|
|
1890
|
+
isDefaultValueColumn: true,
|
|
1891
|
+
type: TableColumnType.Boolean,
|
|
1892
|
+
title: "Show Overall Uptime Percent on Status Page",
|
|
1893
|
+
description: "Show Overall Uptime Percent on Status Page?",
|
|
1894
|
+
})
|
|
1895
|
+
@Column({
|
|
1896
|
+
type: ColumnType.Boolean,
|
|
1897
|
+
default: false,
|
|
1898
|
+
})
|
|
1899
|
+
@ColumnBillingAccessControl({
|
|
1900
|
+
read: PlanType.Free,
|
|
1901
|
+
update: PlanType.Scale,
|
|
1902
|
+
create: PlanType.Free,
|
|
1903
|
+
})
|
|
1904
|
+
public showOverallUptimePercentOnStatusPage?: boolean = undefined;
|
|
1905
|
+
|
|
1906
|
+
@ColumnAccessControl({
|
|
1907
|
+
create: [
|
|
1908
|
+
Permission.ProjectOwner,
|
|
1909
|
+
Permission.ProjectAdmin,
|
|
1910
|
+
Permission.ProjectMember,
|
|
1911
|
+
Permission.CreateProjectStatusPage,
|
|
1912
|
+
],
|
|
1913
|
+
read: [
|
|
1914
|
+
Permission.ProjectOwner,
|
|
1915
|
+
Permission.ProjectAdmin,
|
|
1916
|
+
Permission.ProjectMember,
|
|
1917
|
+
Permission.ReadProjectStatusPage,
|
|
1918
|
+
],
|
|
1919
|
+
update: [
|
|
1920
|
+
Permission.ProjectOwner,
|
|
1921
|
+
Permission.ProjectAdmin,
|
|
1922
|
+
Permission.ProjectMember,
|
|
1923
|
+
Permission.EditProjectStatusPage,
|
|
1924
|
+
],
|
|
1925
|
+
})
|
|
1926
|
+
@TableColumn({
|
|
1927
|
+
type: TableColumnType.ShortText,
|
|
1928
|
+
title: "Overall Uptime Percent Precision",
|
|
1929
|
+
required: false,
|
|
1930
|
+
description: "Overall Precision of uptime percent for this status page.",
|
|
1931
|
+
})
|
|
1932
|
+
@Column({
|
|
1933
|
+
type: ColumnType.ShortText,
|
|
1934
|
+
nullable: true,
|
|
1935
|
+
default: UptimePrecision.TWO_DECIMAL,
|
|
1936
|
+
})
|
|
1937
|
+
public overallUptimePercentPrecision?: UptimePrecision = undefined;
|
|
1867
1938
|
}
|
|
@@ -23,13 +23,7 @@ import IconProp from "../../Types/Icon/IconProp";
|
|
|
23
23
|
import ObjectID from "../../Types/ObjectID";
|
|
24
24
|
import Permission from "../../Types/Permission";
|
|
25
25
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
26
|
-
|
|
27
|
-
export enum UptimePrecision {
|
|
28
|
-
NO_DECIMAL = "99% (No Decimal)",
|
|
29
|
-
ONE_DECIMAL = "99.9% (One Decimal)",
|
|
30
|
-
TWO_DECIMAL = "99.99% (Two Decimal)",
|
|
31
|
-
THREE_DECIMAL = "99.999% (Three Decimal)",
|
|
32
|
-
}
|
|
26
|
+
import UptimePrecision from "../../Types/StatusPage/UptimePrecision";
|
|
33
27
|
|
|
34
28
|
@EnableDocumentation()
|
|
35
29
|
@CanAccessIfCanReadOn("statusPage")
|
|
@@ -234,9 +234,7 @@ export default class BaseAnalyticsAPI<
|
|
|
234
234
|
let groupBy: GroupBy<AnalyticsDataModel> = {};
|
|
235
235
|
|
|
236
236
|
if (req.body) {
|
|
237
|
-
query = JSONFunctions.deserialize(
|
|
238
|
-
req.body["query"],
|
|
239
|
-
) as Query<AnalyticsDataModel>;
|
|
237
|
+
query = JSONFunctions.deserialize(req.body["query"]) as Query<any>;
|
|
240
238
|
|
|
241
239
|
select = JSONFunctions.deserialize(
|
|
242
240
|
req.body["select"],
|
|
@@ -316,9 +314,7 @@ export default class BaseAnalyticsAPI<
|
|
|
316
314
|
await this.onBeforeCount(req, res);
|
|
317
315
|
|
|
318
316
|
if (req.body) {
|
|
319
|
-
query = JSONFunctions.deserialize(
|
|
320
|
-
req.body["query"],
|
|
321
|
-
) as Query<AnalyticsDataModel>;
|
|
317
|
+
query = JSONFunctions.deserialize(req.body["query"]) as Query<any>;
|
|
322
318
|
}
|
|
323
319
|
|
|
324
320
|
const databaseProps: DatabaseCommonInteractionProps =
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1723825511054 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1723825511054";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "StatusPage" ADD "showOverallUptimePercentOnStatusPage" boolean NOT NULL DEFAULT false`,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "StatusPage" DROP COLUMN "showOverallUptimePercentOnStatusPage"`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1723828588502 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1723828588502";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "StatusPage" ADD "overallUptimePercentPrecision" character varying DEFAULT '99.99% (Two Decimal)'`,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "StatusPage" DROP COLUMN "overallUptimePercentPrecision"`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1724078044172 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1724078044172";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "Monitor" ADD "incomingRequestMonitorHeartbeatCheckedAt" TIMESTAMP WITH TIME ZONE`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_62cf90e5fbcd9f3742ed35a2bb" ON "Monitor" ("incomingRequestMonitorHeartbeatCheckedAt") `,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`DROP INDEX "public"."IDX_62cf90e5fbcd9f3742ed35a2bb"`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "Monitor" DROP COLUMN "incomingRequestMonitorHeartbeatCheckedAt"`,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -38,6 +38,9 @@ import { MigrationName1721779190475 } from "./1721779190475-MigrationName";
|
|
|
38
38
|
import { MigrationName1722031205897 } from "./1722031205897-MigrationName";
|
|
39
39
|
import { MigrationName1722543640526 } from "./1722543640526-MigrationName";
|
|
40
40
|
import { MigrationName1722892318363 } from "./1722892318363-MigrationName";
|
|
41
|
+
import { MigrationName1723825511054 } from "./1723825511054-MigrationName";
|
|
42
|
+
import { MigrationName1723828588502 } from "./1723828588502-MigrationName";
|
|
43
|
+
import { MigrationName1724078044172 } from "./1724078044172-MigrationName";
|
|
41
44
|
|
|
42
45
|
export default [
|
|
43
46
|
InitialMigration,
|
|
@@ -80,4 +83,7 @@ export default [
|
|
|
80
83
|
MigrationName1722031205897,
|
|
81
84
|
MigrationName1722543640526,
|
|
82
85
|
MigrationName1722892318363,
|
|
86
|
+
MigrationName1723825511054,
|
|
87
|
+
MigrationName1723828588502,
|
|
88
|
+
MigrationName1724078044172,
|
|
83
89
|
];
|
|
@@ -208,8 +208,8 @@ export default class AnalyticsDatabaseService<
|
|
|
208
208
|
aggregateBy.limit = 10;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
if (!aggregateBy.
|
|
212
|
-
throw new BadDataException("
|
|
211
|
+
if (!aggregateBy.aggregationType) {
|
|
212
|
+
throw new BadDataException("aggregationType is required");
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
if (!aggregateBy.aggregationTimestampColumnName) {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "../Types/Database/Hooks";
|
|
19
19
|
import ModelPermission from "../Types/Database/Permissions/Index";
|
|
20
20
|
import { CheckReadPermissionType } from "../Types/Database/Permissions/ReadPermission";
|
|
21
|
-
import Query
|
|
21
|
+
import Query from "../Types/Database/Query";
|
|
22
22
|
import QueryHelper from "../Types/Database/QueryHelper";
|
|
23
23
|
import RelationSelect from "../Types/Database/RelationSelect";
|
|
24
24
|
import SearchBy from "../Types/Database/SearchBy";
|
|
@@ -60,6 +60,7 @@ import API from "Common/Utils/API";
|
|
|
60
60
|
import Slug from "Common/Utils/Slug";
|
|
61
61
|
import { DataSource, Repository, SelectQueryBuilder } from "typeorm";
|
|
62
62
|
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
|
|
63
|
+
import { FindWhere } from "../../Types/BaseDatabase/Query";
|
|
63
64
|
|
|
64
65
|
class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
|
65
66
|
public modelType!: { new (): TBaseModel };
|
|
@@ -691,7 +692,6 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
|
|
691
692
|
[totalItemsColumnName]:
|
|
692
693
|
createdBy.data.getColumnValue(totalItemsColumnName),
|
|
693
694
|
} as FindWhere<TBaseModel>,
|
|
694
|
-
|
|
695
695
|
skip: 0,
|
|
696
696
|
limit: LIMIT_MAX,
|
|
697
697
|
props: {
|
|
@@ -49,6 +49,7 @@ import { SMSMessage } from "../../Types/SMS/SMS";
|
|
|
49
49
|
import { CallRequestMessage } from "../../Types/Call/CallRequest";
|
|
50
50
|
import UserNotificationSettingService from "./UserNotificationSettingService";
|
|
51
51
|
import NotificationSettingEventType from "../../Types/NotificationSetting/NotificationSettingEventType";
|
|
52
|
+
import Query from "../Types/Database/Query";
|
|
52
53
|
|
|
53
54
|
export class Service extends DatabaseService<Model> {
|
|
54
55
|
public constructor() {
|
|
@@ -126,6 +127,14 @@ export class Service extends DatabaseService<Model> {
|
|
|
126
127
|
return { updateBy, carryForward: null };
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
public getEnabledMonitorQuery(): Query<Model> {
|
|
131
|
+
return {
|
|
132
|
+
disableActiveMonitoring: false, // do not fetch if disabled is true.
|
|
133
|
+
disableActiveMonitoringBecauseOfManualIncident: false,
|
|
134
|
+
disableActiveMonitoringBecauseOfScheduledMaintenanceEvent: false,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
protected override async onBeforeCreate(
|
|
130
139
|
createBy: CreateBy<Model>,
|
|
131
140
|
): Promise<OnCreate<Model>> {
|
|
@@ -48,8 +48,8 @@ import Team from "Common/Models/DatabaseModels/Team";
|
|
|
48
48
|
import TeamMember from "Common/Models/DatabaseModels/TeamMember";
|
|
49
49
|
import TeamPermission from "Common/Models/DatabaseModels/TeamPermission";
|
|
50
50
|
import User from "Common/Models/DatabaseModels/User";
|
|
51
|
-
import { In } from "typeorm";
|
|
52
51
|
import Select from "../Types/Database/Select";
|
|
52
|
+
import Query from "../Types/Database/Query";
|
|
53
53
|
|
|
54
54
|
export interface CurrentPlan {
|
|
55
55
|
plan: PlanType | null;
|
|
@@ -886,7 +886,7 @@ export class ProjectService extends DatabaseService<Model> {
|
|
|
886
886
|
findBy.props.userGlobalAccessPermission?.projectIds.length === 0
|
|
887
887
|
) {
|
|
888
888
|
findBy.props.isRoot = true;
|
|
889
|
-
findBy.query._id =
|
|
889
|
+
findBy.query._id = ObjectID.getZeroObjectID().toString(); // should not get any projects.
|
|
890
890
|
}
|
|
891
891
|
|
|
892
892
|
return { findBy, carryForward: null };
|
|
@@ -1114,6 +1114,20 @@ export class ProjectService extends DatabaseService<Model> {
|
|
|
1114
1114
|
});
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
|
+
public getActiveProjectStatusQuery(): Query<Model> {
|
|
1118
|
+
return {
|
|
1119
|
+
// get only active projects
|
|
1120
|
+
paymentProviderSubscriptionStatus: QueryHelper.equalToOrNull([
|
|
1121
|
+
SubscriptionStatus.Active,
|
|
1122
|
+
SubscriptionStatus.Trialing,
|
|
1123
|
+
]),
|
|
1124
|
+
paymentProviderMeteredSubscriptionStatus: QueryHelper.equalToOrNull([
|
|
1125
|
+
SubscriptionStatus.Active,
|
|
1126
|
+
SubscriptionStatus.Trialing,
|
|
1127
|
+
]),
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1117
1131
|
public async isSMSNotificationsEnabled(
|
|
1118
1132
|
projectId: ObjectID,
|
|
1119
1133
|
): Promise<boolean> {
|
|
@@ -192,7 +192,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
192
192
|
// get status page resource with this order.
|
|
193
193
|
const resources: Array<Model> = await this.findBy({
|
|
194
194
|
query: {
|
|
195
|
-
order: QueryHelper.greaterThanEqualTo(currentOrder),
|
|
195
|
+
order: QueryHelper.greaterThanEqualTo<number>(currentOrder),
|
|
196
196
|
statusPageId: statusPageId,
|
|
197
197
|
},
|
|
198
198
|
limit: LIMIT_MAX,
|
|
@@ -43,9 +43,7 @@ import MailService from "./MailService";
|
|
|
43
43
|
import EmailTemplateType from "../../Types/Email/EmailTemplateType";
|
|
44
44
|
import { FileRoute } from "Common/ServiceRoute";
|
|
45
45
|
import ProjectSMTPConfigService from "./ProjectSmtpConfigService";
|
|
46
|
-
import StatusPageResource
|
|
47
|
-
UptimePrecision,
|
|
48
|
-
} from "Common/Models/DatabaseModels/StatusPageResource";
|
|
46
|
+
import StatusPageResource from "Common/Models/DatabaseModels/StatusPageResource";
|
|
49
47
|
import StatusPageResourceService from "./StatusPageResourceService";
|
|
50
48
|
import Dictionary from "../../Types/Dictionary";
|
|
51
49
|
import MonitorGroupResource from "Common/Models/DatabaseModels/MonitorGroupResource";
|
|
@@ -57,6 +55,7 @@ import MonitorStatusTimeline from "Common/Models/DatabaseModels/MonitorStatusTim
|
|
|
57
55
|
import MonitorStatusTimelineService from "./MonitorStatusTimelineService";
|
|
58
56
|
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
59
57
|
import UptimeUtil from "Common/Utils/Uptime/UptimeUtil";
|
|
58
|
+
import UptimePrecision from "../../Types/StatusPage/UptimePrecision";
|
|
60
59
|
|
|
61
60
|
export interface StatusPageReportItem {
|
|
62
61
|
resourceName: string;
|
|
@@ -67,6 +66,7 @@ export interface StatusPageReportItem {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
export interface StatusPageReport {
|
|
69
|
+
reportDates: string; // start date and end date in string. e.g. "01 July 2021 - 14 July 2021"
|
|
70
70
|
totalResources: number;
|
|
71
71
|
totalIncidents: number;
|
|
72
72
|
averageUptimePercent: string;
|
|
@@ -755,8 +755,15 @@ export class Service extends DatabaseService<StatusPage> {
|
|
|
755
755
|
statusPageId: data.statusPageId,
|
|
756
756
|
});
|
|
757
757
|
|
|
758
|
+
const currentDate: Date = OneUptimeDate.getCurrentDate();
|
|
759
|
+
const startDate: Date = OneUptimeDate.getSomeDaysAgo(
|
|
760
|
+
data.historyDays || 14,
|
|
761
|
+
);
|
|
762
|
+
const startAndEndDate: string = `${OneUptimeDate.getDateAsLocalFormattedString(startDate, true)} - ${OneUptimeDate.getDateAsLocalFormattedString(currentDate, true)}`;
|
|
763
|
+
|
|
758
764
|
if (statusPageResources.length === 0) {
|
|
759
765
|
return {
|
|
766
|
+
reportDates: startAndEndDate,
|
|
760
767
|
totalResources: 0,
|
|
761
768
|
totalIncidents: 0,
|
|
762
769
|
averageUptimePercent: "0%",
|
|
@@ -854,6 +861,7 @@ export class Service extends DatabaseService<StatusPage> {
|
|
|
854
861
|
);
|
|
855
862
|
|
|
856
863
|
return {
|
|
864
|
+
reportDates: startAndEndDate,
|
|
857
865
|
totalResources: statusPageResources.length,
|
|
858
866
|
totalIncidents: incidentCount,
|
|
859
867
|
averageUptimePercent: avgUptimePercentString,
|
|
@@ -3,9 +3,10 @@ import InBetween from "Common/Types/BaseDatabase/InBetween";
|
|
|
3
3
|
import Includes from "Common/Types/BaseDatabase/Includes";
|
|
4
4
|
import LessThan from "Common/Types/BaseDatabase/LessThan";
|
|
5
5
|
import ObjectID from "Common/Types/ObjectID";
|
|
6
|
+
import { CompareType } from "../../../Types/Database/CompareBase";
|
|
6
7
|
|
|
7
8
|
export default class QueryHelper {
|
|
8
|
-
public static lessThan(value:
|
|
9
|
+
public static lessThan<T extends CompareType>(value: T): LessThan<T> {
|
|
9
10
|
return new LessThan(value);
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -13,14 +14,14 @@ export default class QueryHelper {
|
|
|
13
14
|
return new Includes(values);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
public static greaterThan(value:
|
|
17
|
-
return new GreaterThan(value);
|
|
17
|
+
public static greaterThan<T extends CompareType>(value: T): GreaterThan<T> {
|
|
18
|
+
return new GreaterThan<T>(value);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
public static inBetween(
|
|
21
|
-
startValue:
|
|
22
|
-
endValue:
|
|
23
|
-
): InBetween {
|
|
21
|
+
public static inBetween<T extends CompareType>(
|
|
22
|
+
startValue: T,
|
|
23
|
+
endValue: T,
|
|
24
|
+
): InBetween<T> {
|
|
24
25
|
return new InBetween(startValue, endValue);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import BaseModel from "Common/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import BaseQuery, {
|
|
3
|
+
OrQuery as BaseQueryOrQuery,
|
|
4
|
+
} from "../../../Types/BaseDatabase/Query";
|
|
4
5
|
|
|
5
|
-
export declare type
|
|
6
|
-
|
|
7
|
-
? Property | FindOperator<Property> | Array<Property>
|
|
8
|
-
: FindOptionsWhereProperty<Property>;
|
|
9
|
-
/**
|
|
10
|
-
* :
|
|
11
|
-
* Used for find operations.
|
|
12
|
-
*/
|
|
13
|
-
export declare type FindWhere<Entity> = {
|
|
14
|
-
[P in keyof Entity]?:
|
|
15
|
-
| FindWhereProperty<NonNullable<Entity[P]>>
|
|
16
|
-
| FindOperator<NonNullable<Entity[P]>>;
|
|
17
|
-
};
|
|
6
|
+
export declare type OrQuery<TBaseModel extends BaseModel> =
|
|
7
|
+
BaseQueryOrQuery<TBaseModel>;
|
|
18
8
|
|
|
19
|
-
declare type Query<TBaseModel extends BaseModel> =
|
|
20
|
-
|
|
21
|
-
export declare type OrQuery<TBaseModel extends BaseModel> = Array<
|
|
22
|
-
Query<TBaseModel>
|
|
23
|
-
>;
|
|
9
|
+
declare type Query<TBaseModel extends BaseModel> = BaseQuery<TBaseModel>;
|
|
24
10
|
|
|
25
11
|
export default Query;
|