@oneuptime/common 7.0.2825 → 7.0.2829

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.
Files changed (54) hide show
  1. package/Types/BaseDatabase/AggregateBy.ts +17 -0
  2. package/Types/BaseDatabase/AggregatedModel.ts +4 -0
  3. package/Types/BaseDatabase/AggregatedResult.ts +5 -0
  4. package/Types/BaseDatabase/AggregationInterval.ts +10 -0
  5. package/Types/BaseDatabase/AggregationType.ts +9 -0
  6. package/Types/BaseDatabase/Query.ts +12 -0
  7. package/Types/BaseDatabase/Sort.ts +13 -0
  8. package/Types/Date.ts +13 -1
  9. package/Types/Metrics/MetricsAggregationType.ts +3 -0
  10. package/Types/Metrics/MetricsQuery.ts +9 -0
  11. package/Types/Permission.ts +119 -3
  12. package/Types/ServiceCatalog/{ServiceLanguage.ts → TechStack.ts} +2 -2
  13. package/Types/Text.ts +10 -0
  14. package/Utils/Boolean.ts +22 -0
  15. package/Utils/Number.ts +40 -0
  16. package/Utils/TechStack.ts +40 -0
  17. package/build/dist/Types/BaseDatabase/AggregateBy.js +2 -0
  18. package/build/dist/Types/BaseDatabase/AggregateBy.js.map +1 -0
  19. package/build/dist/Types/BaseDatabase/AggregatedModel.js +2 -0
  20. package/build/dist/Types/BaseDatabase/AggregatedModel.js.map +1 -0
  21. package/build/dist/Types/BaseDatabase/AggregatedResult.js +2 -0
  22. package/build/dist/Types/BaseDatabase/AggregatedResult.js.map +1 -0
  23. package/build/dist/Types/BaseDatabase/AggregationInterval.js +11 -0
  24. package/build/dist/Types/BaseDatabase/AggregationInterval.js.map +1 -0
  25. package/build/dist/Types/BaseDatabase/AggregationType.js +10 -0
  26. package/build/dist/Types/BaseDatabase/AggregationType.js.map +1 -0
  27. package/build/dist/Types/BaseDatabase/Query.js +2 -0
  28. package/build/dist/Types/BaseDatabase/Query.js.map +1 -0
  29. package/build/dist/Types/BaseDatabase/Sort.js +2 -0
  30. package/build/dist/Types/BaseDatabase/Sort.js.map +1 -0
  31. package/build/dist/Types/Date.js +10 -1
  32. package/build/dist/Types/Date.js.map +1 -1
  33. package/build/dist/Types/Metrics/MetricsAggregationType.js +3 -0
  34. package/build/dist/Types/Metrics/MetricsAggregationType.js.map +1 -0
  35. package/build/dist/Types/Metrics/MetricsQuery.js +2 -0
  36. package/build/dist/Types/Metrics/MetricsQuery.js.map +1 -0
  37. package/build/dist/Types/Permission.js +100 -1
  38. package/build/dist/Types/Permission.js.map +1 -1
  39. package/build/dist/Types/ServiceCatalog/TechStack.js +22 -0
  40. package/build/dist/Types/ServiceCatalog/TechStack.js.map +1 -0
  41. package/build/dist/Types/Text.js +8 -0
  42. package/build/dist/Types/Text.js.map +1 -1
  43. package/build/dist/Utils/Boolean.js +19 -0
  44. package/build/dist/Utils/Boolean.js.map +1 -0
  45. package/build/dist/Utils/Number.js +30 -0
  46. package/build/dist/Utils/Number.js.map +1 -1
  47. package/build/dist/Utils/TechStack.js +37 -0
  48. package/build/dist/Utils/TechStack.js.map +1 -0
  49. package/package.json +1 -1
  50. package/Utils/ServiceLanguage.ts +0 -40
  51. package/build/dist/Types/ServiceCatalog/ServiceLanguage.js +0 -22
  52. package/build/dist/Types/ServiceCatalog/ServiceLanguage.js.map +0 -1
  53. package/build/dist/Utils/ServiceLanguage.js +0 -37
  54. package/build/dist/Utils/ServiceLanguage.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ import GenericObject from "../GenericObject";
2
+ import AggregationType from "./AggregationType";
3
+ import Query from "./Query";
4
+ import Sort from "./Sort";
5
+
6
+ export default interface AggregateBy<TBaseModel extends GenericObject> {
7
+ aggregateColumnName: keyof TBaseModel;
8
+ aggregateBy: AggregationType;
9
+ // aggregationInterval?: AggregationInterval;
10
+ aggregationTimestampColumnName: keyof TBaseModel;
11
+ startTimestamp: Date;
12
+ endTimestamp: Date;
13
+ query: Query<TBaseModel>;
14
+ limit: number;
15
+ skip: number;
16
+ sort?: Sort<TBaseModel> | undefined;
17
+ }
@@ -0,0 +1,4 @@
1
+ export default interface AggregateModel {
2
+ timestamp: Date;
3
+ value: number;
4
+ }
@@ -0,0 +1,5 @@
1
+ import AggregatedModel from "./AggregatedModel";
2
+
3
+ export default interface AggregatedResult {
4
+ data: Array<AggregatedModel>;
5
+ }
@@ -0,0 +1,10 @@
1
+ export enum AggregationInterval {
2
+ Minute = "Minute",
3
+ Hour = "Hour",
4
+ Day = "Day",
5
+ Week = "Week",
6
+ Month = "Month",
7
+ Year = "Year",
8
+ }
9
+
10
+ export default AggregationInterval;
@@ -0,0 +1,9 @@
1
+ enum AggregationType {
2
+ Max = "Max",
3
+ Min = "Min",
4
+ Sum = "Sum",
5
+ Avg = "Avg",
6
+ Count = "Count",
7
+ }
8
+
9
+ export default AggregationType;
@@ -0,0 +1,12 @@
1
+ import GenericObject from "../GenericObject";
2
+ import { JSONObject, JSONValue } from "../JSON";
3
+
4
+ export type QueryPropertyOptions = JSONValue | JSONObject;
5
+
6
+ export declare type QueryOptions<Entity> = {
7
+ [P in keyof Entity]?: QueryPropertyOptions;
8
+ };
9
+
10
+ type Query<TBaseModel extends GenericObject> = QueryOptions<TBaseModel>;
11
+
12
+ export default Query;
@@ -0,0 +1,13 @@
1
+ import GenericObject from "../GenericObject";
2
+ import SortOrder from "./SortOrder";
3
+
4
+ /**
5
+ * Order by find options.
6
+ */
7
+ export declare type FindOrder<Entity extends GenericObject> = {
8
+ [P in keyof Entity]?: SortOrder;
9
+ };
10
+
11
+ type Sort<TBaseModel extends GenericObject> = FindOrder<TBaseModel>;
12
+
13
+ export default Sort;
package/Types/Date.ts CHANGED
@@ -837,6 +837,18 @@ export default class OneUptimeDate {
837
837
  return minutes;
838
838
  }
839
839
 
840
+ public static getDifferenceInMonths(date: Date, date2: Date): number {
841
+ date = this.fromString(date);
842
+ date2 = this.fromString(date2);
843
+ const months: number = moment(date).diff(moment(date2), "months");
844
+
845
+ if (months < 0) {
846
+ return months * -1;
847
+ }
848
+
849
+ return months;
850
+ }
851
+
840
852
  public static convertMinutesToDaysHoursAndMinutes(minutes: number): string {
841
853
  // should output 2 days, 3 hours and 4 minutes. If the days are 0, it should not show the days. If the hours are 0, it should not show the hours. If the minutes are 0, it should not show the minutes.
842
854
 
@@ -1059,7 +1071,7 @@ export default class OneUptimeDate {
1059
1071
  return moment(date["value"]).toDate();
1060
1072
  }
1061
1073
 
1062
- throw new BadDataException("Invalid date: " + date.toString());
1074
+ throw new BadDataException("Invalid date: " + date?.toString());
1063
1075
  }
1064
1076
 
1065
1077
  public static asDateForDatabaseQuery(date: string | Date): string {
@@ -0,0 +1,3 @@
1
+ import AggregationType from "../BaseDatabase/AggregationType";
2
+
3
+ export default AggregationType;
@@ -0,0 +1,9 @@
1
+ import Dictionary from "../Dictionary";
2
+ import MetricsAggregationType from "./MetricsAggregationType";
3
+
4
+ export default interface MetricsQuery {
5
+ metricName: string;
6
+ attributes: Dictionary<string | boolean | number>;
7
+ aggegationType: MetricsAggregationType;
8
+ aggregateBy: Dictionary<boolean>;
9
+ }
@@ -43,19 +43,26 @@ enum Permission {
43
43
  EditProjectApiKeyPermissions = "EditProjectApiKeyPermissions",
44
44
 
45
45
  // Logs
46
-
47
46
  CreateTelemetryServiceLog = "CreateTelemetryServiceLog",
48
47
  DeleteTelemetryServiceLog = "DeleteTelemetryServiceLog",
49
48
  EditTelemetryServiceLog = "EditTelemetryServiceLog",
50
49
  ReadTelemetryServiceLog = "ReadTelemetryServiceLog",
51
50
 
52
51
  // Spans
53
-
54
52
  CreateTelemetryServiceTraces = "CreateTelemetryServiceTraces",
55
53
  DeleteTelemetryServiceTraces = "DeleteTelemetryServiceTraces",
56
54
  EditTelemetryServiceTraces = "EditTelemetryServiceTraces",
57
55
  ReadTelemetryServiceTraces = "ReadTelemetryServiceTraces",
58
56
 
57
+ // Metrics
58
+ CreateTelemetryServiceMetrics = "CreateTelemetryServiceMetrics",
59
+ DeleteTelemetryServiceMetrics = "DeleteTelemetryServiceMetrics",
60
+ EditTelemetryServiceMetrics = "EditTelemetryServiceMetrics",
61
+ ReadTelemetryServiceMetrics = "ReadTelemetryServiceMetrics",
62
+
63
+ // Telemetry Attributes
64
+ DeleteTelemetryAttributes = "DeleteTelemetryAttributes",
65
+
59
66
  // Billing Permissions (Owner Permission)
60
67
  ManageProjectBilling = "ManageProjectBilling",
61
68
 
@@ -465,6 +472,16 @@ enum Permission {
465
472
  EditServiceCatlogDependency = "EditServiceCatlogDependency",
466
473
  ReadServiceCatlogDependency = "ReadServiceCatlogDependency",
467
474
 
475
+ CreateServiceCatalogMonitor = "CreateServiceCatalogMonitor",
476
+ DeleteServiceCatalogMonitor = "DeleteServiceCatalogMonitor",
477
+ EditServiceCatalogMonitor = "EditServiceCatalogMonitor",
478
+ ReadServiceCatalogMonitor = "ReadServiceCatalogMonitor",
479
+
480
+ CreateServiceCatalogTelemetryService = "CreateServiceCatalogTelemetryService",
481
+ DeleteServiceCatalogTelemetryService = "DeleteServiceCatalogTelemetryService",
482
+ EditServiceCatalogTelemetryService = "EditServiceCatalogTelemetryService",
483
+ ReadServiceCatalogTelemetryService = "ReadServiceCatalogTelemetryService",
484
+
468
485
  CreateCopilotCodeRepository = "CreateCopilotCodeRepository",
469
486
  DeleteCopilotCodeRepository = "DeleteCopilotCodeRepository",
470
487
  EditCopilotCodeRepository = "EditCopilotCodeRepository",
@@ -2555,7 +2572,7 @@ export class PermissionHelper {
2555
2572
 
2556
2573
  {
2557
2574
  permission: Permission.CreateServiceCatlogDependency,
2558
- title: "Create Service Catalog",
2575
+ title: "Create Service Catalog Dependency",
2559
2576
  description:
2560
2577
  "This permission can create Service Catalog Dependencies this project.",
2561
2578
  isAssignableToTenant: true,
@@ -2586,6 +2603,72 @@ export class PermissionHelper {
2586
2603
  isAccessControlPermission: false,
2587
2604
  },
2588
2605
 
2606
+ {
2607
+ permission: Permission.CreateServiceCatalogMonitor,
2608
+ title: "Create Service Catalog Monitor",
2609
+ description:
2610
+ "This permission can create Service Catalog Monitor this project.",
2611
+ isAssignableToTenant: true,
2612
+ isAccessControlPermission: false,
2613
+ },
2614
+ {
2615
+ permission: Permission.DeleteServiceCatalogMonitor,
2616
+ title: "Delete Service Catalog Monitor",
2617
+ description:
2618
+ "This permission can delete Service Catalog Monitor of this project.",
2619
+ isAssignableToTenant: true,
2620
+ isAccessControlPermission: false,
2621
+ },
2622
+ {
2623
+ permission: Permission.EditServiceCatalogMonitor,
2624
+ title: "Edit Service Catalog Monitor",
2625
+ description:
2626
+ "This permission can edit Service Catalog Monitor of this project.",
2627
+ isAssignableToTenant: true,
2628
+ isAccessControlPermission: false,
2629
+ },
2630
+ {
2631
+ permission: Permission.ReadServiceCatalogMonitor,
2632
+ title: "Read Service Catalog Monitor",
2633
+ description:
2634
+ "This permission can read Service Catalog Monitor of this project.",
2635
+ isAssignableToTenant: true,
2636
+ isAccessControlPermission: false,
2637
+ },
2638
+
2639
+ {
2640
+ permission: Permission.CreateServiceCatalogTelemetryService,
2641
+ title: "Create Service Catalog Telemetry Service",
2642
+ description:
2643
+ "This permission can create Service Catalog Telemetry Service this project.",
2644
+ isAssignableToTenant: true,
2645
+ isAccessControlPermission: false,
2646
+ },
2647
+ {
2648
+ permission: Permission.DeleteServiceCatalogTelemetryService,
2649
+ title: "Delete Service Catalog Telemetry Service",
2650
+ description:
2651
+ "This permission can delete Service Catalog Telemetry Service of this project.",
2652
+ isAssignableToTenant: true,
2653
+ isAccessControlPermission: false,
2654
+ },
2655
+ {
2656
+ permission: Permission.EditServiceCatalogTelemetryService,
2657
+ title: "Edit Service Catalog Telemetry Service",
2658
+ description:
2659
+ "This permission can edit Service Catalog Telemetry Service of this project.",
2660
+ isAssignableToTenant: true,
2661
+ isAccessControlPermission: false,
2662
+ },
2663
+ {
2664
+ permission: Permission.ReadServiceCatalogTelemetryService,
2665
+ title: "Read Service Catalog Telemetry Service",
2666
+ description:
2667
+ "This permission can read Service Catalog Telemetry Service of this project.",
2668
+ isAssignableToTenant: true,
2669
+ isAccessControlPermission: false,
2670
+ },
2671
+
2589
2672
  {
2590
2673
  permission: Permission.CreateTelemetryServiceTraces,
2591
2674
  title: "Create Telemetry Service Traces",
@@ -2619,6 +2702,39 @@ export class PermissionHelper {
2619
2702
  isAccessControlPermission: false,
2620
2703
  },
2621
2704
 
2705
+ {
2706
+ permission: Permission.CreateTelemetryServiceMetrics,
2707
+ title: "Create Telemetry Service Metrics",
2708
+ description:
2709
+ "This permission can create Telemetry Service Metrics this project.",
2710
+ isAssignableToTenant: true,
2711
+ isAccessControlPermission: false,
2712
+ },
2713
+ {
2714
+ permission: Permission.DeleteTelemetryServiceMetrics,
2715
+ title: "Delete Telemetry Service Metrics",
2716
+ description:
2717
+ "This permission can delete Telemetry Service Metrics of this project.",
2718
+ isAssignableToTenant: true,
2719
+ isAccessControlPermission: false,
2720
+ },
2721
+ {
2722
+ permission: Permission.EditTelemetryServiceMetrics,
2723
+ title: "Edit Telemetry Service Metrics",
2724
+ description:
2725
+ "This permission can edit Telemetry Service Metrics of this project.",
2726
+ isAssignableToTenant: true,
2727
+ isAccessControlPermission: false,
2728
+ },
2729
+ {
2730
+ permission: Permission.ReadTelemetryServiceMetrics,
2731
+ title: "Read Telemetry Service Metrics",
2732
+ description:
2733
+ "This permission can read Telemetry Service Metrics of this project.",
2734
+ isAssignableToTenant: true,
2735
+ isAccessControlPermission: false,
2736
+ },
2737
+
2622
2738
  {
2623
2739
  permission: Permission.CreateScheduledMaintenanceOwnerTeam,
2624
2740
  title: "Create Scheduled Maintenance Team Owner",
@@ -1,4 +1,4 @@
1
- export enum ServiceLanguage {
1
+ export enum TechStack {
2
2
  NodeJS = "NodeJS",
3
3
  React = "React",
4
4
  Python = "Python",
@@ -18,4 +18,4 @@ export enum ServiceLanguage {
18
18
  Other = "Other",
19
19
  }
20
20
 
21
- export default ServiceLanguage;
21
+ export default TechStack;
package/Types/Text.ts CHANGED
@@ -12,6 +12,16 @@ export default class Text {
12
12
  return hex;
13
13
  }
14
14
 
15
+ public static getLetterFromAByNumber(number: number): string {
16
+ return String.fromCharCode("a".charCodeAt(0) + number);
17
+ }
18
+
19
+ public static getNextLowercaseLetter(letter: string): string {
20
+ const charCode: number = letter.charCodeAt(0);
21
+ const nextLetter: string = String.fromCharCode(charCode + 1).toString();
22
+ return nextLetter;
23
+ }
24
+
15
25
  public static fromPascalCaseToDashes(text: string): string {
16
26
  let result: string = text.replace(/([A-Z])/g, " $1");
17
27
  result = result.trim();
@@ -0,0 +1,22 @@
1
+ export default class BooleanUtil {
2
+ public static isBoolean(value: any): boolean {
3
+ return typeof value === "boolean";
4
+ }
5
+
6
+ public static convertToBoolean(value: any): boolean {
7
+ return Boolean(value);
8
+ }
9
+
10
+ public static canBeConvertedToBoolean(value: any): boolean {
11
+ return (
12
+ value === "true" ||
13
+ value === "false" ||
14
+ value === 1 ||
15
+ value === 0 ||
16
+ value === "1" ||
17
+ value === "0" ||
18
+ value === true ||
19
+ value === false
20
+ );
21
+ }
22
+ }
package/Utils/Number.ts CHANGED
@@ -2,4 +2,44 @@ export default class NumberUtil {
2
2
  public static convertToTwoDecimalPlaces(value: number): number {
3
3
  return Math.round(value * 100) / 100;
4
4
  }
5
+
6
+ public static isNumber(value: any): boolean {
7
+ return !isNaN(value);
8
+ }
9
+
10
+ public static convertToNumber(value: any): number {
11
+ return Number(value);
12
+ }
13
+
14
+ public static canBeConvertedToNumber(value: any): boolean {
15
+ return !isNaN(Number(value));
16
+ }
17
+
18
+ public static isInteger(value: any): boolean {
19
+ return Number.isInteger(value);
20
+ }
21
+
22
+ public static isPositive(value: number): boolean {
23
+ return value > 0;
24
+ }
25
+
26
+ public static isNegative(value: number): boolean {
27
+ return value < 0;
28
+ }
29
+
30
+ public static isZero(value: number): boolean {
31
+ return value === 0;
32
+ }
33
+
34
+ public static isEven(value: number): boolean {
35
+ return value % 2 === 0;
36
+ }
37
+
38
+ public static isOdd(value: number): boolean {
39
+ return value % 2 !== 0;
40
+ }
41
+
42
+ public static isFloat(value: number): boolean {
43
+ return value % 1 !== 0;
44
+ }
5
45
  }
@@ -0,0 +1,40 @@
1
+ import TechStack from "../Types/ServiceCatalog/TechStack";
2
+
3
+ export default class ServiceLanguageUtil {
4
+ public static getLanguageByFileExtension(data: {
5
+ fileExtension: string;
6
+ }): TechStack {
7
+ const { fileExtension } = data;
8
+
9
+ switch (fileExtension) {
10
+ case "js":
11
+ return TechStack.JavaScript;
12
+ case "ts":
13
+ return TechStack.TypeScript;
14
+ case "py":
15
+ return TechStack.Python;
16
+ case "rb":
17
+ return TechStack.Ruby;
18
+ case "java":
19
+ return TechStack.Java;
20
+ case "php":
21
+ return TechStack.PHP;
22
+ case "cs":
23
+ return TechStack.CSharp;
24
+ case "cpp":
25
+ return TechStack.CPlusPlus;
26
+ case "rs":
27
+ return TechStack.Rust;
28
+ case "swift":
29
+ return TechStack.Swift;
30
+ case "kt":
31
+ return TechStack.Kotlin;
32
+ case "go":
33
+ return TechStack.Go;
34
+ case "sh":
35
+ return TechStack.Shell;
36
+ default:
37
+ return TechStack.Other;
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AggregateBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AggregateBy.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/AggregateBy.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AggregatedModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AggregatedModel.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/AggregatedModel.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AggregatedResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AggregatedResult.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/AggregatedResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export var AggregationInterval;
2
+ (function (AggregationInterval) {
3
+ AggregationInterval["Minute"] = "Minute";
4
+ AggregationInterval["Hour"] = "Hour";
5
+ AggregationInterval["Day"] = "Day";
6
+ AggregationInterval["Week"] = "Week";
7
+ AggregationInterval["Month"] = "Month";
8
+ AggregationInterval["Year"] = "Year";
9
+ })(AggregationInterval || (AggregationInterval = {}));
10
+ export default AggregationInterval;
11
+ //# sourceMappingURL=AggregationInterval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AggregationInterval.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/AggregationInterval.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,oCAAa,CAAA;IACb,sCAAe,CAAA;IACf,oCAAa,CAAA;AACf,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ var AggregationType;
2
+ (function (AggregationType) {
3
+ AggregationType["Max"] = "Max";
4
+ AggregationType["Min"] = "Min";
5
+ AggregationType["Sum"] = "Sum";
6
+ AggregationType["Avg"] = "Avg";
7
+ AggregationType["Count"] = "Count";
8
+ })(AggregationType || (AggregationType = {}));
9
+ export default AggregationType;
10
+ //# sourceMappingURL=AggregationType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AggregationType.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/AggregationType.ts"],"names":[],"mappings":"AAAA,IAAK,eAMJ;AAND,WAAK,eAAe;IAClB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,kCAAe,CAAA;AACjB,CAAC,EANI,eAAe,KAAf,eAAe,QAMnB;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/Query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sort.js","sourceRoot":"","sources":["../../../../Types/BaseDatabase/Sort.ts"],"names":[],"mappings":""}
@@ -583,6 +583,15 @@ export default class OneUptimeDate {
583
583
  }
584
584
  return minutes;
585
585
  }
586
+ static getDifferenceInMonths(date, date2) {
587
+ date = this.fromString(date);
588
+ date2 = this.fromString(date2);
589
+ const months = moment(date).diff(moment(date2), "months");
590
+ if (months < 0) {
591
+ return months * -1;
592
+ }
593
+ return months;
594
+ }
586
595
  static convertMinutesToDaysHoursAndMinutes(minutes) {
587
596
  // should output 2 days, 3 hours and 4 minutes. If the days are 0, it should not show the days. If the hours are 0, it should not show the hours. If the minutes are 0, it should not show the minutes.
588
597
  const days = Math.floor(minutes / (24 * 60));
@@ -737,7 +746,7 @@ export default class OneUptimeDate {
737
746
  (date["_type"] === "Date" || date["_type"] === "DateTime")) {
738
747
  return moment(date["value"]).toDate();
739
748
  }
740
- throw new BadDataException("Invalid date: " + date.toString());
749
+ throw new BadDataException("Invalid date: " + (date === null || date === void 0 ? void 0 : date.toString()));
741
750
  }
742
751
  static asDateForDatabaseQuery(date) {
743
752
  date = this.fromString(date);