@oneuptime/common 14.0.92 → 14.0.93
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.js +8 -1
- package/Models/DatabaseModels/AlertEpisodeMember.d.mts +1 -0
- package/Models/DatabaseModels/AlertEpisodeMember.d.ts +1 -0
- package/Models/DatabaseModels/AlertEpisodeMember.js +50 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.d.mts +1 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.d.ts +1 -0
- package/Models/DatabaseModels/IncidentEpisodeMember.js +50 -0
- package/Models/DatabaseModels/IncomingCallPolicy.js +1 -1
- package/Models/DatabaseModels/LlmProvider.js +1 -1
- package/Models/DatabaseModels/MonitorTemplate.js +10 -4
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +13 -13
- package/Models/DatabaseModels/OnCallDutyPolicy.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +1 -1
- package/Models/DatabaseModels/StatusPage.d.mts +2 -0
- package/Models/DatabaseModels/StatusPage.d.ts +2 -0
- package/Models/DatabaseModels/StatusPage.js +100 -0
- package/Types/Database/BlankColumnValue.d.mts +6 -0
- package/Types/Database/BlankColumnValue.d.ts +6 -0
- package/Types/Database/BlankColumnValue.js +77 -0
- package/Types/Database/BlankColumnValue.mjs +4 -0
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +1 -0
- package/Types/IncomingCall/IncomingCallPolicyRepeat.d.mts +6 -0
- package/Types/IncomingCall/IncomingCallPolicyRepeat.d.ts +6 -0
- package/Types/IncomingCall/IncomingCallPolicyRepeat.js +41 -14
- package/Types/IncomingCall/IncomingCallPolicyRepeat.mjs +3 -0
- package/Types/Monitor/CriteriaFilter.d.mts +1 -0
- package/Types/Monitor/CriteriaFilter.d.ts +1 -0
- package/Types/Monitor/CriteriaFilter.js +9 -0
- package/Types/Monitor/DatabaseMetricCatalog.js +2 -2
- package/Types/Monitor/KubernetesEventAlertTemplates.d.mts +20 -0
- package/Types/Monitor/KubernetesEventAlertTemplates.d.ts +20 -0
- package/Types/Monitor/KubernetesEventAlertTemplates.js +232 -0
- package/Types/Monitor/KubernetesEventAlertTemplates.mjs +8 -0
- package/Types/Monitor/MonitorType.js +12 -2
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +27 -2
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.mts +1 -0
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.ts +1 -0
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +31 -1
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +3 -1
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +3 -1
- package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +3 -2
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.mts +1 -0
- package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.ts +1 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +2 -0
- package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +10 -3
- package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
- package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
- package/Types/NotificationSetting/NotificationSettingEventType.js +7 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.mts +7 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.ts +7 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.js +51 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.mjs +4 -0
- package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.mts +8 -0
- package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.ts +8 -0
- package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.js +55 -0
- package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.mjs +5 -0
- package/Types/Workflow/Templates.js +2 -5
- package/Utils/ColorContrast.d.mts +3 -0
- package/Utils/ColorContrast.d.ts +3 -0
- package/Utils/ColorContrast.js +41 -3
- package/Utils/ColorContrast.mjs +2 -0
- package/Utils/Incident/WhoOpenedItRootCause.d.mts +2 -0
- package/Utils/Incident/WhoOpenedItRootCause.d.ts +2 -0
- package/Utils/Incident/WhoOpenedItRootCause.js +50 -0
- package/Utils/Incident/WhoOpenedItRootCause.mjs +3 -0
- package/Utils/Monitor/SyntheticMonitorStepsUtil.d.mts +18 -0
- package/Utils/Monitor/SyntheticMonitorStepsUtil.d.ts +18 -0
- package/Utils/Monitor/SyntheticMonitorStepsUtil.js +129 -0
- package/Utils/Monitor/SyntheticMonitorStepsUtil.mjs +4 -0
- package/Utils/Rules/RuleRunSummary.d.mts +1 -0
- package/Utils/Rules/RuleRunSummary.d.ts +1 -0
- package/Utils/Rules/RuleRunSummary.js +19 -1
- package/Utils/Rules/RuleRunSummary.mjs +1 -0
- package/Utils/Sms/Gsm7Text.js +9 -1
- package/Utils/Sms/OnCallPageSms.d.mts +2 -0
- package/Utils/Sms/OnCallPageSms.d.ts +2 -0
- package/Utils/Sms/OnCallPageSms.js +19 -2
- package/Utils/Sms/OnCallPageSms.mjs +1 -0
- package/Utils/Sms/SubscriberSms.d.mts +2 -0
- package/Utils/Sms/SubscriberSms.d.ts +2 -0
- package/Utils/Sms/SubscriberSms.js +35 -0
- package/Utils/Sms/SubscriberSms.mjs +3 -0
- package/package.json +1 -1
|
@@ -86,6 +86,8 @@ exports.ROLLUP_CATEGORY_BY_EVENT_TYPE = {
|
|
|
86
86
|
[NotificationSettingEventType_1.default.SEND_INCIDENT_OWNER_ADDED_NOTIFICATION]: RollupCategory.Incidents,
|
|
87
87
|
[NotificationSettingEventType_1.default.SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION]: RollupCategory.Incidents,
|
|
88
88
|
[NotificationSettingEventType_1.default.SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION]: RollupCategory.Incidents,
|
|
89
|
+
// Never held back (NEVER_ROLLED_UP_EVENT_TYPES): filed here all the same.
|
|
90
|
+
[NotificationSettingEventType_1.default.SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION]: RollupCategory.Incidents,
|
|
89
91
|
// Alerts
|
|
90
92
|
[NotificationSettingEventType_1.default.SEND_ALERT_CREATED_OWNER_NOTIFICATION]: RollupCategory.Alerts,
|
|
91
93
|
[NotificationSettingEventType_1.default.SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION]: RollupCategory.Alerts,
|
|
@@ -15,8 +15,8 @@ const NotificationSettingEventType_1 = __importDefault(require("./NotificationSe
|
|
|
15
15
|
* between them.
|
|
16
16
|
*/
|
|
17
17
|
/*
|
|
18
|
-
* Time-critical
|
|
19
|
-
*
|
|
18
|
+
* Time-critical mail. Never held back, never counted, never written to the
|
|
19
|
+
* queue table at all.
|
|
20
20
|
*
|
|
21
21
|
* A five-minute coalescing window eats a thirty-minute shift lead time, which
|
|
22
22
|
* is the entire value of "your shift starts soon". And "you are on call now",
|
|
@@ -24,6 +24,12 @@ const NotificationSettingEventType_1 = __importDefault(require("./NotificationSe
|
|
|
24
24
|
* allowed to have. The saving from rolling these up would be nil anyway: they
|
|
25
25
|
* fire once per roster transition, not per resource, so they are not what
|
|
26
26
|
* floods anyone's inbox.
|
|
27
|
+
*
|
|
28
|
+
* An SLA breach is a deadline that has already passed: holding it back five
|
|
29
|
+
* minutes to batch it with the incident chatter that caused it is exactly
|
|
30
|
+
* backwards, and it fires once per deadline. It borrowed "Incident created"
|
|
31
|
+
* until it had an event of its own, so its sender asked for the bypass
|
|
32
|
+
* (forceImmediate) every time; now the event type says it.
|
|
27
33
|
*/
|
|
28
34
|
exports.NEVER_ROLLED_UP_EVENT_TYPES = new Set([
|
|
29
35
|
NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_ON_CALL_ROSTER,
|
|
@@ -31,6 +37,7 @@ exports.NEVER_ROLLED_UP_EVENT_TYPES = new Set([
|
|
|
31
37
|
NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_NO_LONGER_ACTIVE_ON_ON_CALL_ROSTER,
|
|
32
38
|
NotificationSettingEventType_1.default.SEND_BEFORE_USER_ON_CALL_SHIFT_STARTS,
|
|
33
39
|
NotificationSettingEventType_1.default.SEND_WHEN_USER_ON_CALL_SHIFT_IS_REASSIGNED,
|
|
40
|
+
NotificationSettingEventType_1.default.SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION,
|
|
34
41
|
]);
|
|
35
42
|
/*
|
|
36
43
|
* SHRINK-ONLY. These two carry ON_CALL in their member name and are still
|
|
@@ -63,7 +70,7 @@ exports.ROLLUP_ELIGIBLE_ON_CALL_ADMIN_EVENT_TYPES = new Set([
|
|
|
63
70
|
NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_REMOVED_FROM_ON_CALL_POLICY,
|
|
64
71
|
]);
|
|
65
72
|
/*
|
|
66
|
-
* Everything else -
|
|
73
|
+
* Everything else - every other member. Derived from the enum by exclusion
|
|
67
74
|
* rather than listed by hand, so the two sets are a partition by construction
|
|
68
75
|
* and cannot drift: there is no edit that adds a member to both, and no edit
|
|
69
76
|
* that drops one from both.
|
|
@@ -5,6 +5,7 @@ declare enum NotificationSettingEventType {
|
|
|
5
5
|
SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the incident",
|
|
6
6
|
SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION = "Send notification when I am assigned to an incident as a member",
|
|
7
7
|
SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION = "Send reminder notification when an incident I own is still open",
|
|
8
|
+
SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION = "Send notification when an incident I own misses an SLA deadline",
|
|
8
9
|
SEND_ALERT_CREATED_OWNER_NOTIFICATION = "Send alert created notification when I am the owner of the alert",
|
|
9
10
|
SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION = "Send alert note posted notification when I am the owner of the alert",
|
|
10
11
|
SEND_ALERT_STATE_CHANGED_OWNER_NOTIFICATION = "Send alert state changed notification when I am the owner of the alert",
|
|
@@ -5,6 +5,7 @@ declare enum NotificationSettingEventType {
|
|
|
5
5
|
SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the incident",
|
|
6
6
|
SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION = "Send notification when I am assigned to an incident as a member",
|
|
7
7
|
SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION = "Send reminder notification when an incident I own is still open",
|
|
8
|
+
SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION = "Send notification when an incident I own misses an SLA deadline",
|
|
8
9
|
SEND_ALERT_CREATED_OWNER_NOTIFICATION = "Send alert created notification when I am the owner of the alert",
|
|
9
10
|
SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION = "Send alert note posted notification when I am the owner of the alert",
|
|
10
11
|
SEND_ALERT_STATE_CHANGED_OWNER_NOTIFICATION = "Send alert state changed notification when I am the owner of the alert",
|
|
@@ -9,6 +9,13 @@ var NotificationSettingEventType;
|
|
|
9
9
|
NotificationSettingEventType["SEND_INCIDENT_OWNER_ADDED_NOTIFICATION"] = "Send notification when I am added as a owner to the incident";
|
|
10
10
|
NotificationSettingEventType["SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION"] = "Send notification when I am assigned to an incident as a member";
|
|
11
11
|
NotificationSettingEventType["SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION"] = "Send reminder notification when an incident I own is still open";
|
|
12
|
+
/*
|
|
13
|
+
* An incident SLA rule's response or resolution deadline passed
|
|
14
|
+
* (Workers IncidentSla/CheckSlaBreaches). Its own event since it had
|
|
15
|
+
* borrowed SEND_INCIDENT_CREATED_OWNER_NOTIFICATION, so switching off
|
|
16
|
+
* "Incident created" silenced SLA breaches too.
|
|
17
|
+
*/
|
|
18
|
+
NotificationSettingEventType["SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION"] = "Send notification when an incident I own misses an SLA deadline";
|
|
12
19
|
// Alerts
|
|
13
20
|
NotificationSettingEventType["SEND_ALERT_CREATED_OWNER_NOTIFICATION"] = "Send alert created notification when I am the owner of the alert";
|
|
14
21
|
NotificationSettingEventType["SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION"] = "Send alert note posted notification when I am the owner of the alert";
|
|
@@ -3,3 +3,10 @@ export interface OnCallDutyPolicyRepeatSettings {
|
|
|
3
3
|
repeatPolicyIfNoOneAcknowledgesNoOfTimes?: number | null | undefined;
|
|
4
4
|
}
|
|
5
5
|
export declare function getOnCallPolicyRepeatsAllowed(policy: OnCallDutyPolicyRepeatSettings | null | undefined): number;
|
|
6
|
+
export declare const ON_CALL_POLICY_REPEAT_COLUMNS: ReadonlyArray<string>;
|
|
7
|
+
export declare const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL: string;
|
|
8
|
+
export declare function isRepeatCountOfAtLeastOne(value: unknown): boolean;
|
|
9
|
+
export declare function getOnCallPolicyRepeatRefusal(policy: {
|
|
10
|
+
repeatPolicyIfNoOneAcknowledges?: unknown;
|
|
11
|
+
repeatPolicyIfNoOneAcknowledgesNoOfTimes?: unknown;
|
|
12
|
+
}): string | null;
|
|
@@ -3,3 +3,10 @@ export interface OnCallDutyPolicyRepeatSettings {
|
|
|
3
3
|
repeatPolicyIfNoOneAcknowledgesNoOfTimes?: number | null | undefined;
|
|
4
4
|
}
|
|
5
5
|
export declare function getOnCallPolicyRepeatsAllowed(policy: OnCallDutyPolicyRepeatSettings | null | undefined): number;
|
|
6
|
+
export declare const ON_CALL_POLICY_REPEAT_COLUMNS: ReadonlyArray<string>;
|
|
7
|
+
export declare const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL: string;
|
|
8
|
+
export declare function isRepeatCountOfAtLeastOne(value: unknown): boolean;
|
|
9
|
+
export declare function getOnCallPolicyRepeatRefusal(policy: {
|
|
10
|
+
repeatPolicyIfNoOneAcknowledges?: unknown;
|
|
11
|
+
repeatPolicyIfNoOneAcknowledgesNoOfTimes?: unknown;
|
|
12
|
+
}): string | null;
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
* Slack and Microsoft Teams message of a run (OnCallPolicyRunMessage).
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = exports.ON_CALL_POLICY_REPEAT_COLUMNS = void 0;
|
|
21
22
|
exports.getOnCallPolicyRepeatsAllowed = getOnCallPolicyRepeatsAllowed;
|
|
23
|
+
exports.isRepeatCountOfAtLeastOne = isRepeatCountOfAtLeastOne;
|
|
24
|
+
exports.getOnCallPolicyRepeatRefusal = getOnCallPolicyRepeatRefusal;
|
|
22
25
|
/*
|
|
23
26
|
* The number of repeats a run may make: 0 while "Repeat if no one
|
|
24
27
|
* acknowledges" is off, otherwise "Number of times to repeat" - a whole
|
|
@@ -35,3 +38,51 @@ function getOnCallPolicyRepeatsAllowed(policy) {
|
|
|
35
38
|
}
|
|
36
39
|
return Math.floor(times);
|
|
37
40
|
}
|
|
41
|
+
/*
|
|
42
|
+
* A POLICY THAT SAYS IT REPEATS MUST REPEAT AT LEAST ONCE.
|
|
43
|
+
*
|
|
44
|
+
* "Repeat if no one acknowledges" on with "Number of times to repeat" at 0
|
|
45
|
+
* (or below it, or not a whole number) says the policy starts again and
|
|
46
|
+
* never does: the run reads 0 repeats (above), and every screen reads the
|
|
47
|
+
* pair as "Stop paging". The Dashboard's Repeat Policy card cannot make it -
|
|
48
|
+
* its "How many more times?" box takes a whole number of 1 or more - and the
|
|
49
|
+
* server holds the API, Terraform, MCP and workflows to the same
|
|
50
|
+
* (OnCallDutyPolicyService, through Server/Utils/Database/ColumnRuleCheck).
|
|
51
|
+
* A policy stored that way before keeps running as it did, once, and an edit
|
|
52
|
+
* that leaves the pair as it is still saves.
|
|
53
|
+
*
|
|
54
|
+
* A number not given is the column's default, 0: a create that turns the
|
|
55
|
+
* switch on must say how many times.
|
|
56
|
+
*/
|
|
57
|
+
exports.ON_CALL_POLICY_REPEAT_COLUMNS = [
|
|
58
|
+
"repeatPolicyIfNoOneAcknowledges",
|
|
59
|
+
"repeatPolicyIfNoOneAcknowledgesNoOfTimes",
|
|
60
|
+
];
|
|
61
|
+
exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = "An on-call policy that repeats must start again at least once: set Repeat Policy Times If No One Acknowledges to a whole number of 1 or more, or turn off Repeat Policy If No One Acknowledges.";
|
|
62
|
+
/*
|
|
63
|
+
* Whether a count, as a write sends it, is a whole number of at least 1. A
|
|
64
|
+
* number or its digits; anything else - nothing, an empty box, a part of a
|
|
65
|
+
* number, 0 or below - is not.
|
|
66
|
+
*/
|
|
67
|
+
function isRepeatCountOfAtLeastOne(value) {
|
|
68
|
+
if (typeof value !== "number" && typeof value !== "string") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (typeof value === "string" && !value.trim()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const times = Number(value);
|
|
75
|
+
return Number.isFinite(times) && Number.isInteger(times) && times >= 1;
|
|
76
|
+
}
|
|
77
|
+
/*
|
|
78
|
+
* The refusal for a pair that says it repeats and never does, or null: the
|
|
79
|
+
* switch off (the number then means nothing), or on with 1 or more.
|
|
80
|
+
*/
|
|
81
|
+
function getOnCallPolicyRepeatRefusal(policy) {
|
|
82
|
+
if (policy.repeatPolicyIfNoOneAcknowledges !== true) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return isRepeatCountOfAtLeastOne(policy.repeatPolicyIfNoOneAcknowledgesNoOfTimes)
|
|
86
|
+
? null
|
|
87
|
+
: exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL;
|
|
88
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import commonJsModule from "./OnCallDutyPolicyRepeat.js";
|
|
2
|
+
export const ON_CALL_POLICY_REPEAT_COLUMNS = commonJsModule.ON_CALL_POLICY_REPEAT_COLUMNS;
|
|
3
|
+
export const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = commonJsModule.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL;
|
|
4
|
+
export const getOnCallPolicyRepeatRefusal = commonJsModule.getOnCallPolicyRepeatRefusal;
|
|
2
5
|
export const getOnCallPolicyRepeatsAllowed = commonJsModule.getOnCallPolicyRepeatsAllowed;
|
|
6
|
+
export const isRepeatCountOfAtLeastOne = commonJsModule.isRepeatCountOfAtLeastOne;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS: ReadonlyArray<string>;
|
|
2
|
+
export interface ScheduledMaintenanceReminderTimingValues {
|
|
3
|
+
remindWhileScheduled?: unknown;
|
|
4
|
+
stopRemindersOnState?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare function doesScheduledMaintenanceReminderRuleNeverRemind(values: ScheduledMaintenanceReminderTimingValues): boolean;
|
|
7
|
+
export declare const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL: string;
|
|
8
|
+
export declare function getScheduledMaintenanceReminderRuleRefusal(values: ScheduledMaintenanceReminderTimingValues): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS: ReadonlyArray<string>;
|
|
2
|
+
export interface ScheduledMaintenanceReminderTimingValues {
|
|
3
|
+
remindWhileScheduled?: unknown;
|
|
4
|
+
stopRemindersOnState?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare function doesScheduledMaintenanceReminderRuleNeverRemind(values: ScheduledMaintenanceReminderTimingValues): boolean;
|
|
7
|
+
export declare const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL: string;
|
|
8
|
+
export declare function getScheduledMaintenanceReminderRuleRefusal(values: ScheduledMaintenanceReminderTimingValues): string | null;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = exports.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = void 0;
|
|
7
|
+
exports.doesScheduledMaintenanceReminderRuleNeverRemind = doesScheduledMaintenanceReminderRuleNeverRemind;
|
|
8
|
+
exports.getScheduledMaintenanceReminderRuleRefusal = getScheduledMaintenanceReminderRuleRefusal;
|
|
9
|
+
const ScheduledMaintenanceReminderStopState_1 = __importDefault(require("./ScheduledMaintenanceReminderStopState"));
|
|
10
|
+
/*
|
|
11
|
+
* A SCHEDULED MAINTENANCE REMINDER RULE THAT WOULD NEVER REMIND.
|
|
12
|
+
*
|
|
13
|
+
* A reminder rule says when it reminds an event's owners with two columns:
|
|
14
|
+
* "Remind While Event is Scheduled" (remindWhileScheduled) and "Stop
|
|
15
|
+
* Reminders When" (stopRemindersOnState). With the switch off, the worker
|
|
16
|
+
* holds the first reminder back until the event starts
|
|
17
|
+
* (Workers/Jobs/ScheduledMaintenanceOwners/SendUnresolvedReminderNotification);
|
|
18
|
+
* with Ongoing, the start is where reminders stop. Together they wait for
|
|
19
|
+
* the start and stop at it: the rule matches every event it is meant for
|
|
20
|
+
* and reminds nobody.
|
|
21
|
+
*
|
|
22
|
+
* The Dashboard's form never makes that pair - it asks one question with
|
|
23
|
+
* three answers (Dashboard Components/Reminders/MaintenanceReminderTiming) -
|
|
24
|
+
* and the server holds every other way of saving a rule to the same: the
|
|
25
|
+
* API, Terraform, MCP and workflows (ScheduledMaintenanceReminderRuleService,
|
|
26
|
+
* through Server/Utils/Database/ColumnRuleCheck). A rule stored that way
|
|
27
|
+
* before the server refused it keeps working as it did: the rules list marks
|
|
28
|
+
* it "Never reminds", and an edit that leaves the pair as it is (a rename)
|
|
29
|
+
* still saves.
|
|
30
|
+
*
|
|
31
|
+
* Server-free and React-free: the server, the Dashboard and the tests read
|
|
32
|
+
* the same rule.
|
|
33
|
+
*/
|
|
34
|
+
// The two columns the rule reads, as the model names them.
|
|
35
|
+
exports.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = ["remindWhileScheduled", "stopRemindersOnState"];
|
|
36
|
+
/*
|
|
37
|
+
* Whether the pair waits for the event to start and stops when it starts. A
|
|
38
|
+
* column not given is what a new rule stores: the switch off, Completed.
|
|
39
|
+
*/
|
|
40
|
+
function doesScheduledMaintenanceReminderRuleNeverRemind(values) {
|
|
41
|
+
return (values.remindWhileScheduled !== true &&
|
|
42
|
+
values.stopRemindersOnState ===
|
|
43
|
+
ScheduledMaintenanceReminderStopState_1.default.Ongoing);
|
|
44
|
+
}
|
|
45
|
+
/*
|
|
46
|
+
* What saving that pair is refused with, in the API's own column names:
|
|
47
|
+
* what each of the two columns does to the rule, then the two ways out.
|
|
48
|
+
*/
|
|
49
|
+
exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = "This reminder rule would never send a reminder: Remind While Event is Scheduled is off, so it waits for the event to start, and Stop Reminders When is Ongoing, so it stops when the event starts. Turn on Remind While Event is Scheduled, or set Stop Reminders When to Completed.";
|
|
50
|
+
// The refusal for a pair that never reminds, or null for one that reminds.
|
|
51
|
+
function getScheduledMaintenanceReminderRuleRefusal(values) {
|
|
52
|
+
return doesScheduledMaintenanceReminderRuleNeverRemind(values)
|
|
53
|
+
? exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL
|
|
54
|
+
: null;
|
|
55
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import commonJsModule from "./ScheduledMaintenanceReminderNeverReminds.js";
|
|
2
|
+
export const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = commonJsModule.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL;
|
|
3
|
+
export const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = commonJsModule.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS;
|
|
4
|
+
export const doesScheduledMaintenanceReminderRuleNeverRemind = commonJsModule.doesScheduledMaintenanceReminderRuleNeverRemind;
|
|
5
|
+
export const getScheduledMaintenanceReminderRuleRefusal = commonJsModule.getScheduledMaintenanceReminderRuleRefusal;
|
|
@@ -467,18 +467,15 @@ const ALERT_KIND = {
|
|
|
467
467
|
creating: "Creating",
|
|
468
468
|
quietCreateFields: {},
|
|
469
469
|
quietCreateText: "",
|
|
470
|
-
/*
|
|
471
|
-
* An alert's root cause is written when the alert is created and cannot be
|
|
472
|
-
* edited afterwards, so it is not listened on. The comment still shows it.
|
|
473
|
-
*/
|
|
474
470
|
editListenOn: {
|
|
475
471
|
title: true,
|
|
476
472
|
description: true,
|
|
477
473
|
alertSeverityId: true,
|
|
478
474
|
alertSeverity: true,
|
|
475
|
+
rootCause: true,
|
|
479
476
|
remediationNotes: true,
|
|
480
477
|
},
|
|
481
|
-
editedFieldsText: "title, severity, description or remediation notes",
|
|
478
|
+
editedFieldsText: "title, severity, description, root cause or remediation notes",
|
|
482
479
|
hasPublicNotes: false,
|
|
483
480
|
otherPlural: "incidents",
|
|
484
481
|
};
|
|
@@ -8,7 +8,10 @@ export declare function getReadableShade(data: {
|
|
|
8
8
|
background: RGB;
|
|
9
9
|
minimumContrast: number;
|
|
10
10
|
maximumSaturation?: number | undefined;
|
|
11
|
+
towards?: "dark" | "light" | undefined;
|
|
11
12
|
}): RGB;
|
|
13
|
+
export declare const FILLED_TEXT_MINIMUM_CONTRAST: number;
|
|
14
|
+
export declare function getReadableTextOnFill(fill: RGB): RGB;
|
|
12
15
|
export declare function getAlphaForLuminance(data: {
|
|
13
16
|
color: RGB;
|
|
14
17
|
surface: RGB;
|
package/Utils/ColorContrast.d.ts
CHANGED
|
@@ -8,7 +8,10 @@ export declare function getReadableShade(data: {
|
|
|
8
8
|
background: RGB;
|
|
9
9
|
minimumContrast: number;
|
|
10
10
|
maximumSaturation?: number | undefined;
|
|
11
|
+
towards?: "dark" | "light" | undefined;
|
|
11
12
|
}): RGB;
|
|
13
|
+
export declare const FILLED_TEXT_MINIMUM_CONTRAST: number;
|
|
14
|
+
export declare function getReadableTextOnFill(fill: RGB): RGB;
|
|
12
15
|
export declare function getAlphaForLuminance(data: {
|
|
13
16
|
color: RGB;
|
|
14
17
|
surface: RGB;
|
package/Utils/ColorContrast.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FILLED_TEXT_MINIMUM_CONTRAST = void 0;
|
|
3
4
|
exports.parseColor = parseColor;
|
|
4
5
|
exports.getRelativeLuminance = getRelativeLuminance;
|
|
5
6
|
exports.getContrastRatio = getContrastRatio;
|
|
6
7
|
exports.composite = composite;
|
|
7
8
|
exports.getReadableShade = getReadableShade;
|
|
9
|
+
exports.getReadableTextOnFill = getReadableTextOnFill;
|
|
8
10
|
exports.getAlphaForLuminance = getAlphaForLuminance;
|
|
9
11
|
// #rgb, #rrggbb, or #rrggbbaa (the alpha is ignored); the # is optional.
|
|
10
12
|
const HEX_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/;
|
|
@@ -132,8 +134,8 @@ function hslToRgb(hsl) {
|
|
|
132
134
|
* The shade of `color` nearest to it that reaches `minimumContrast` against
|
|
133
135
|
* `background`: the colour itself when it already does, otherwise the same
|
|
134
136
|
* hue with only the lightness moved - toward black on a light background,
|
|
135
|
-
* toward white on a dark one
|
|
136
|
-
* binary search finds the boundary.
|
|
137
|
+
* toward white on a dark one, or the way `towards` says. Lightness moves
|
|
138
|
+
* luminance one way only, so a binary search finds the boundary.
|
|
137
139
|
*/
|
|
138
140
|
function getReadableShade(data) {
|
|
139
141
|
if (getContrastRatio(data.color, data.background) >= data.minimumContrast) {
|
|
@@ -150,7 +152,13 @@ function getReadableShade(data) {
|
|
|
150
152
|
}
|
|
151
153
|
// `low` never passes; `high` always does (black or white at the limit).
|
|
152
154
|
let low = hsl.lightness;
|
|
153
|
-
let high =
|
|
155
|
+
let high = data.towards
|
|
156
|
+
? data.towards === "light"
|
|
157
|
+
? 1
|
|
158
|
+
: 0
|
|
159
|
+
: getRelativeLuminance(data.background) < 0.5
|
|
160
|
+
? 1
|
|
161
|
+
: 0;
|
|
154
162
|
for (let step = 0; step < 24; step++) {
|
|
155
163
|
const middle = (low + high) / 2;
|
|
156
164
|
if (passes(middle)) {
|
|
@@ -162,6 +170,36 @@ function getReadableShade(data) {
|
|
|
162
170
|
}
|
|
163
171
|
return hslToRgb(Object.assign(Object.assign({}, hsl), { lightness: high }));
|
|
164
172
|
}
|
|
173
|
+
/*
|
|
174
|
+
* WCAG's minimum for text: what text written on a filled colour must reach.
|
|
175
|
+
*/
|
|
176
|
+
exports.FILLED_TEXT_MINIMUM_CONTRAST = 4.5;
|
|
177
|
+
const WHITE = { red: 255, green: 255, blue: 255 };
|
|
178
|
+
/*
|
|
179
|
+
* The colour of text written on a filled colour someone picked - a status
|
|
180
|
+
* page's banner in the colour its owner gave a monitor status: white when
|
|
181
|
+
* white reads on it at 4.5:1, otherwise the lightest shade of the fill's own
|
|
182
|
+
* colour that does, so the words keep its family - deep green on a green
|
|
183
|
+
* banner, deep amber on a yellow one - rather than turning grey.
|
|
184
|
+
*
|
|
185
|
+
* White on the default Operational green (#2ab57d) was 2.6:1, on Degraded's
|
|
186
|
+
* yellow (#ffbf53) 1.6:1. A shade toward black always reaches 4.5:1 where
|
|
187
|
+
* white does not (black reaches more than 4.6:1 on anything white fails
|
|
188
|
+
* on), so there always is one. The fill itself is never changed: it is the colour
|
|
189
|
+
* the owner chose, the same in the light theme and the dark one, and so is
|
|
190
|
+
* the text on it.
|
|
191
|
+
*/
|
|
192
|
+
function getReadableTextOnFill(fill) {
|
|
193
|
+
if (getContrastRatio(WHITE, fill) >= exports.FILLED_TEXT_MINIMUM_CONTRAST) {
|
|
194
|
+
return WHITE;
|
|
195
|
+
}
|
|
196
|
+
return getReadableShade({
|
|
197
|
+
color: fill,
|
|
198
|
+
background: fill,
|
|
199
|
+
minimumContrast: exports.FILLED_TEXT_MINIMUM_CONTRAST,
|
|
200
|
+
towards: "dark",
|
|
201
|
+
});
|
|
202
|
+
}
|
|
165
203
|
/*
|
|
166
204
|
* The opacity at which `color` over `surface` lands nearest to
|
|
167
205
|
* `targetLuminance`, kept inside `range`. More opacity only ever moves the
|
package/Utils/ColorContrast.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import commonJsModule from "./ColorContrast.js";
|
|
2
|
+
export const FILLED_TEXT_MINIMUM_CONTRAST = commonJsModule.FILLED_TEXT_MINIMUM_CONTRAST;
|
|
2
3
|
export const composite = commonJsModule.composite;
|
|
3
4
|
export const getAlphaForLuminance = commonJsModule.getAlphaForLuminance;
|
|
4
5
|
export const getContrastRatio = commonJsModule.getContrastRatio;
|
|
5
6
|
export const getReadableShade = commonJsModule.getReadableShade;
|
|
7
|
+
export const getReadableTextOnFill = commonJsModule.getReadableTextOnFill;
|
|
6
8
|
export const getRelativeLuminance = commonJsModule.getRelativeLuminance;
|
|
7
9
|
export const parseColor = commonJsModule.parseColor;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* A ROOT CAUSE THAT ONLY SAYS WHO OPENED THE RECORD.
|
|
4
|
+
*
|
|
5
|
+
* OneUptime used to fill an incident's or an alert's empty root cause with
|
|
6
|
+
* who opened it, when a person did:
|
|
7
|
+
*
|
|
8
|
+
* Incident created by [Maya Chen](<her page>) IncidentService
|
|
9
|
+
* Alert created by [Maya Chen](<her page>) AlertService
|
|
10
|
+
* Incident created by @maya on Slack. Slack's Declare Incident
|
|
11
|
+
* Incident created via Microsoft Teams Teams' Declare Incident
|
|
12
|
+
* Incident created via the OneUptime AI copilot. the copilot's tool
|
|
13
|
+
*
|
|
14
|
+
* That says who, not why - and the record names who opened it already (its
|
|
15
|
+
* creator, the Declared / Created tile, the feed's first entry). Written as
|
|
16
|
+
* the root cause, it stood where the cause belongs: the What happened card,
|
|
17
|
+
* the feed's "Root Cause", the first state's timeline row, and the status
|
|
18
|
+
* timeline of every monitor the incident changed. New records are left with
|
|
19
|
+
* no root cause until somebody writes one; the ones written before read as
|
|
20
|
+
* none here (the Dashboard's What happened card), while the Root Cause page
|
|
21
|
+
* still shows them as they are stored.
|
|
22
|
+
*
|
|
23
|
+
* Read in one pass over at most one line: every pattern is anchored at both
|
|
24
|
+
* ends, and each repeat stops at the character that ends it.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.isWhoOpenedItRootCause = isWhoOpenedItRootCause;
|
|
28
|
+
// "Incident created by [Name](<address>)", the name as mdText escaped it.
|
|
29
|
+
const CREATED_BY_PERSON_LINK = /^(?:Incident|Alert) created by \[(?:\\.|[^\\\]\n])*\]\([^()\s]*\)$/;
|
|
30
|
+
// "Incident created by @name on Slack." - a Slack name is at most 80 long.
|
|
31
|
+
const CREATED_ON_SLACK = /^Incident created by @[^\n]{1,200} on Slack\.$/;
|
|
32
|
+
// The ones written word for word: by the Teams form and the copilot.
|
|
33
|
+
const CREATED_VIA = [
|
|
34
|
+
"Incident created via Microsoft Teams",
|
|
35
|
+
"Incident created via the OneUptime AI copilot.",
|
|
36
|
+
];
|
|
37
|
+
/*
|
|
38
|
+
* Whether a root cause is one of the lines OneUptime wrote to say who
|
|
39
|
+
* opened the record, and nothing else.
|
|
40
|
+
*/
|
|
41
|
+
function isWhoOpenedItRootCause(rootCause) {
|
|
42
|
+
const text = (rootCause || "").trim();
|
|
43
|
+
if (!text || text.length > 1000) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return (CREATED_VIA.includes(text) ||
|
|
47
|
+
CREATED_BY_PERSON_LINK.test(text) ||
|
|
48
|
+
CREATED_ON_SLACK.test(text));
|
|
49
|
+
}
|
|
50
|
+
exports.default = isWhoOpenedItRootCause;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSONObject } from "../../Types/JSON.mjs";
|
|
2
|
+
import MonitorSteps from "../../Types/Monitor/MonitorSteps.mjs";
|
|
3
|
+
import MonitorType from "../../Types/Monitor/MonitorType.mjs";
|
|
4
|
+
export declare const SYNTHETIC_STEP_NO_BROWSER_MESSAGE: string;
|
|
5
|
+
export declare const SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE: string;
|
|
6
|
+
export interface SyntheticListsFillResult {
|
|
7
|
+
monitorSteps: JSONObject;
|
|
8
|
+
changed: boolean;
|
|
9
|
+
stepsFilled: number;
|
|
10
|
+
}
|
|
11
|
+
export default class SyntheticMonitorStepsUtil {
|
|
12
|
+
static getRunsNothingError(monitorSteps: MonitorSteps | JSONObject | null | undefined): string | null;
|
|
13
|
+
static assertRunsSomewhere(data: {
|
|
14
|
+
monitorType: MonitorType | undefined | null;
|
|
15
|
+
monitorSteps: MonitorSteps | JSONObject | null | undefined;
|
|
16
|
+
}): void;
|
|
17
|
+
static fillEmptyListsInJSON(stored: JSONObject): SyntheticListsFillResult;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSONObject } from "../../Types/JSON";
|
|
2
|
+
import MonitorSteps from "../../Types/Monitor/MonitorSteps";
|
|
3
|
+
import MonitorType from "../../Types/Monitor/MonitorType";
|
|
4
|
+
export declare const SYNTHETIC_STEP_NO_BROWSER_MESSAGE: string;
|
|
5
|
+
export declare const SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE: string;
|
|
6
|
+
export interface SyntheticListsFillResult {
|
|
7
|
+
monitorSteps: JSONObject;
|
|
8
|
+
changed: boolean;
|
|
9
|
+
stepsFilled: number;
|
|
10
|
+
}
|
|
11
|
+
export default class SyntheticMonitorStepsUtil {
|
|
12
|
+
static getRunsNothingError(monitorSteps: MonitorSteps | JSONObject | null | undefined): string | null;
|
|
13
|
+
static assertRunsSomewhere(data: {
|
|
14
|
+
monitorType: MonitorType | undefined | null;
|
|
15
|
+
monitorSteps: MonitorSteps | JSONObject | null | undefined;
|
|
16
|
+
}): void;
|
|
17
|
+
static fillEmptyListsInJSON(stored: JSONObject): SyntheticListsFillResult;
|
|
18
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE = exports.SYNTHETIC_STEP_NO_BROWSER_MESSAGE = void 0;
|
|
7
|
+
const BadDataException_1 = __importDefault(require("../../Types/Exception/BadDataException"));
|
|
8
|
+
const MonitorStep_1 = require("../../Types/Monitor/MonitorStep");
|
|
9
|
+
const MonitorSteps_1 = __importDefault(require("../../Types/Monitor/MonitorSteps"));
|
|
10
|
+
const MonitorType_1 = __importDefault(require("../../Types/Monitor/MonitorType"));
|
|
11
|
+
const BrowserType_1 = __importDefault(require("../../Types/Monitor/SyntheticMonitors/BrowserType"));
|
|
12
|
+
const ScreenSizeType_1 = __importDefault(require("../../Types/Monitor/SyntheticMonitors/ScreenSizeType"));
|
|
13
|
+
/*
|
|
14
|
+
* A Synthetic monitor's step runs its script once for each browser and
|
|
15
|
+
* screen size it lists - the probe loops over both lists - so a step with
|
|
16
|
+
* either list empty runs nothing and never fails: a monitor that looks
|
|
17
|
+
* healthy forever.
|
|
18
|
+
*
|
|
19
|
+
* The Dashboard has refused such a step since #4964 (MonitorStep
|
|
20
|
+
* .getValidationError), and a new step starts on Chromium at Desktop
|
|
21
|
+
* (SYNTHETIC_MONITOR_DEFAULT_*). This is the rest of it:
|
|
22
|
+
*
|
|
23
|
+
* - the server refuses a write that would leave a Synthetic monitor or
|
|
24
|
+
* template running nothing, so an API, Terraform, MCP or workflow
|
|
25
|
+
* caller cannot store one either (assertRunsSomewhere);
|
|
26
|
+
* - the steps stored that way before, which ran nothing, are given the
|
|
27
|
+
* defaults the form gives a new step, so each runs in Chromium at a
|
|
28
|
+
* desktop size (fillEmptyListsInJSON, run by the
|
|
29
|
+
* FillSyntheticMonitorBrowsersAndScreenSizes data migration).
|
|
30
|
+
*
|
|
31
|
+
* The server's words name the fields, since its readers are API callers:
|
|
32
|
+
* the Dashboard asks for a pick before it ever sends a write.
|
|
33
|
+
*/
|
|
34
|
+
exports.SYNTHETIC_STEP_NO_BROWSER_MESSAGE = `A Synthetic monitor step needs at least one browser in browserTypes (${Object.values(BrowserType_1.default).join(" or ")}). With none, its script never runs.`;
|
|
35
|
+
exports.SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE = `A Synthetic monitor step needs at least one screen size in screenSizeTypes (${Object.values(ScreenSizeType_1.default).join(", ")}). With none, its script never runs.`;
|
|
36
|
+
const isNonEmptyList = (value) => {
|
|
37
|
+
return Array.isArray(value) && value.length > 0;
|
|
38
|
+
};
|
|
39
|
+
const asObject = (value) => {
|
|
40
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
41
|
+
? value
|
|
42
|
+
: undefined;
|
|
43
|
+
};
|
|
44
|
+
class SyntheticMonitorStepsUtil {
|
|
45
|
+
/*
|
|
46
|
+
* Why these steps would run nothing - the first step without a browser,
|
|
47
|
+
* or without a screen size - or null when every step runs somewhere.
|
|
48
|
+
* Steps that cannot be read say nothing here: their shape is refused
|
|
49
|
+
* where they are parsed.
|
|
50
|
+
*/
|
|
51
|
+
static getRunsNothingError(monitorSteps) {
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
if (!monitorSteps) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
let steps = [];
|
|
57
|
+
try {
|
|
58
|
+
steps =
|
|
59
|
+
((_a = MonitorSteps_1.default.fromJSON(monitorSteps).data) === null || _a === void 0 ? void 0 : _a.monitorStepsInstanceArray) || [];
|
|
60
|
+
}
|
|
61
|
+
catch (_d) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
for (const step of steps) {
|
|
65
|
+
if (!isNonEmptyList((_b = step.data) === null || _b === void 0 ? void 0 : _b.browserTypes)) {
|
|
66
|
+
return exports.SYNTHETIC_STEP_NO_BROWSER_MESSAGE;
|
|
67
|
+
}
|
|
68
|
+
if (!isNonEmptyList((_c = step.data) === null || _c === void 0 ? void 0 : _c.screenSizeTypes)) {
|
|
69
|
+
return exports.SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
/*
|
|
75
|
+
* Refuses a Synthetic monitor's (or template's) steps that would run
|
|
76
|
+
* nothing. Every other type has no browsers or screen sizes to pick.
|
|
77
|
+
*/
|
|
78
|
+
static assertRunsSomewhere(data) {
|
|
79
|
+
if (data.monitorType !== MonitorType_1.default.SyntheticMonitor) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const error = SyntheticMonitorStepsUtil.getRunsNothingError(data.monitorSteps);
|
|
83
|
+
if (error) {
|
|
84
|
+
throw new BadDataException_1.default(error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/*
|
|
88
|
+
* A Synthetic monitor's stored steps with every missing or empty browser
|
|
89
|
+
* list set to Chromium, and every missing or empty screen size list to
|
|
90
|
+
* Desktop - what a new step starts on. A list with something in it is
|
|
91
|
+
* left exactly as it is, and so is everything else in the column: the
|
|
92
|
+
* JSON is edited as stored, not parsed and written back.
|
|
93
|
+
*/
|
|
94
|
+
static fillEmptyListsInJSON(stored) {
|
|
95
|
+
var _a;
|
|
96
|
+
const monitorSteps = JSON.parse(JSON.stringify(stored));
|
|
97
|
+
let stepsFilled = 0;
|
|
98
|
+
const value = asObject(monitorSteps["value"]);
|
|
99
|
+
const envelopes = Array.isArray(value === null || value === void 0 ? void 0 : value["monitorStepsInstanceArray"])
|
|
100
|
+
? value["monitorStepsInstanceArray"]
|
|
101
|
+
: [];
|
|
102
|
+
for (const envelope of envelopes) {
|
|
103
|
+
const step = asObject((_a = asObject(envelope)) === null || _a === void 0 ? void 0 : _a["value"]);
|
|
104
|
+
if (!step) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
let filled = false;
|
|
108
|
+
if (!isNonEmptyList(step["browserTypes"])) {
|
|
109
|
+
step["browserTypes"] = [...MonitorStep_1.SYNTHETIC_MONITOR_DEFAULT_BROWSER_TYPES];
|
|
110
|
+
filled = true;
|
|
111
|
+
}
|
|
112
|
+
if (!isNonEmptyList(step["screenSizeTypes"])) {
|
|
113
|
+
step["screenSizeTypes"] = [
|
|
114
|
+
...MonitorStep_1.SYNTHETIC_MONITOR_DEFAULT_SCREEN_SIZE_TYPES,
|
|
115
|
+
];
|
|
116
|
+
filled = true;
|
|
117
|
+
}
|
|
118
|
+
if (filled) {
|
|
119
|
+
stepsFilled++;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
monitorSteps: monitorSteps,
|
|
124
|
+
changed: stepsFilled > 0,
|
|
125
|
+
stepsFilled: stepsFilled,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.default = SyntheticMonitorStepsUtil;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import commonJsModule from "./SyntheticMonitorStepsUtil.js";
|
|
2
|
+
export default commonJsModule.default;
|
|
3
|
+
export const SYNTHETIC_STEP_NO_BROWSER_MESSAGE = commonJsModule.SYNTHETIC_STEP_NO_BROWSER_MESSAGE;
|
|
4
|
+
export const SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE = commonJsModule.SYNTHETIC_STEP_NO_SCREEN_SIZE_MESSAGE;
|