@oneuptime/common 14.0.91 → 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/AutoRemediationRule.js +1 -1
- package/Models/DatabaseModels/CodeRepository.d.mts +1 -0
- package/Models/DatabaseModels/CodeRepository.d.ts +1 -0
- package/Models/DatabaseModels/CodeRepository.js +69 -6
- 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/AI/CodeTask.d.mts +1 -0
- package/Types/AI/CodeTask.d.ts +1 -0
- package/Types/AI/TelemetryAiActivity.d.mts +1 -0
- package/Types/AI/TelemetryAiActivity.d.ts +1 -0
- package/Types/AI/TelemetryAiActivity.js +4 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.mts +15 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.ts +15 -0
- package/Types/CodeRepository/CodeRepositorySetting.js +49 -0
- package/Types/CodeRepository/CodeRepositorySetting.mjs +3 -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/Date.d.mts +10 -0
- package/Types/Date.d.ts +10 -0
- package/Types/Date.js +385 -98
- package/Types/DateLanguage.d.mts +67 -0
- package/Types/DateLanguage.d.ts +67 -0
- package/Types/DateLanguage.js +478 -0
- package/Types/DateLanguage.mjs +21 -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/Runner/CodeRepositoryRunner.d.mts +7 -0
- package/Types/Runner/CodeRepositoryRunner.d.ts +7 -0
- package/Types/Runner/CodeRepositoryRunner.js +60 -14
- package/Types/Runner/CodeRepositoryRunner.mjs +1 -0
- package/Types/SecurityEvent/OcsfProcessActivity.d.mts +25 -0
- package/Types/SecurityEvent/OcsfProcessActivity.d.ts +25 -0
- package/Types/SecurityEvent/OcsfProcessActivity.js +131 -0
- package/Types/SecurityEvent/OcsfProcessActivity.mjs +8 -0
- package/Types/Workflow/Templates.js +2 -5
- package/UI/Utils/TranslateTemplate.d.mts +73 -0
- package/UI/Utils/TranslateTemplate.d.ts +73 -0
- 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/CronTab.d.mts +41 -3
- package/Utils/CronTab.d.ts +41 -3
- package/Utils/CronTab.js +112 -38
- 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/MonitorOverviewTargetUtil.d.mts +2 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +2 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.js +13 -2
- 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/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.mts +5 -0
- package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.ts +5 -0
- package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.js +219 -58
- package/Utils/SecurityEvent/OcsfNormalizer.js +22 -13
- package/Utils/Slo/SloDuration.d.mts +1 -0
- package/Utils/Slo/SloDuration.d.ts +1 -0
- package/Utils/Slo/SloDuration.js +57 -8
- package/Utils/Slo/SloDuration.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/Utils/Suggestions/CodeFixSuggestion.d.mts +15 -0
- package/Utils/Suggestions/CodeFixSuggestion.d.ts +15 -0
- package/Utils/Suggestions/CodeFixSuggestion.js +62 -1
- package/Utils/Suggestions/CodeFixSuggestion.mjs +4 -0
- package/Utils/Suggestions/ProfileFixSuggestion.js +4 -0
- package/Utils/Suggestions/SuggestionBlocker.d.mts +8 -0
- package/Utils/Suggestions/SuggestionBlocker.d.ts +8 -0
- package/Utils/Suggestions/SuggestionBlocker.js +51 -0
- package/Utils/Suggestions/SuggestionBlocker.mjs +4 -0
- package/Utils/Suggestions/SuggestionOffer.d.mts +2 -1
- package/Utils/Suggestions/SuggestionOffer.d.ts +2 -1
- package/Utils/Suggestions/SuggestionOffer.js +5 -0
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -7
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -7
- package/Utils/Suggestions/TelemetryAiFixSuggestion.js +8 -36
- package/Utils/Suggestions/TelemetryImprovementSuggestion.d.mts +1 -0
- package/Utils/Suggestions/TelemetryImprovementSuggestion.d.ts +1 -0
- package/Utils/Suggestions/TelemetryImprovementSuggestion.js +1 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +6 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +6 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.js +46 -5
- package/package.json +8 -1
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +0 -61
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +0 -61
- package/Utils/Monitor/MonitorCheckScheduleUtil.js +0 -476
- package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +0 -3
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +0 -39
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +0 -39
- package/Utils/Monitor/MonitorOverviewFamily.js +0 -206
- package/Utils/Monitor/MonitorOverviewFamily.mjs +0 -4
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +0 -189
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +0 -189
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +0 -1480
- package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +0 -5
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +0 -112
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +0 -112
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +0 -640
- package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +0 -3
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +0 -27
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +0 -27
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +0 -132
- package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +0 -2
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +0 -42
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +0 -42
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +0 -468
- package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +0 -2
package/Utils/CronTab.js
CHANGED
|
@@ -30,6 +30,15 @@
|
|
|
30
30
|
* (UTC in production). Displaying UTC keeps the preview honest.
|
|
31
31
|
*/
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
/*
|
|
34
|
+
* Marks an English label as a key of the Dashboard's locales, so its
|
|
35
|
+
* extractor (scripts/i18n/ExtractStrings.ts, which reads this file) finds
|
|
36
|
+
* it - the same marker as Common/UI/Utils/TranslateTemplate's, kept here so
|
|
37
|
+
* CronTab stays free of every dependency. It returns the text unchanged.
|
|
38
|
+
*/
|
|
39
|
+
const translationKey = (text) => {
|
|
40
|
+
return text;
|
|
41
|
+
};
|
|
33
42
|
/*
|
|
34
43
|
* Matches a string of one or more ASCII digits. Kept as a named const so the
|
|
35
44
|
* linter doesn't fight over wrapping an inline regex literal used with .test().
|
|
@@ -135,6 +144,19 @@ class CronTab {
|
|
|
135
144
|
}
|
|
136
145
|
return this.describe(parsed);
|
|
137
146
|
}
|
|
147
|
+
/*
|
|
148
|
+
* The shape getHumanReadableDescription puts in words, for a caller that
|
|
149
|
+
* words it in another language (Common/Utils/CronScheduleText). Null when
|
|
150
|
+
* the expression cannot be parsed.
|
|
151
|
+
*/
|
|
152
|
+
static getScheduleShape(expression) {
|
|
153
|
+
try {
|
|
154
|
+
return this.getShapeOf(this.parse(expression));
|
|
155
|
+
}
|
|
156
|
+
catch (_a) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
138
160
|
/**
|
|
139
161
|
* Computes the next `count` fire times (in UTC) at or after `from`
|
|
140
162
|
* (exclusive). Returns fewer than `count` entries only if the pattern has no
|
|
@@ -400,7 +422,7 @@ class CronTab {
|
|
|
400
422
|
return new Date(Date.UTC(year, month - 1, 1, 0, 0, 0, 0));
|
|
401
423
|
}
|
|
402
424
|
// ----- Human-readable description --------------------------------------
|
|
403
|
-
static
|
|
425
|
+
static getShapeOf(parsed) {
|
|
404
426
|
const minute = parsed.minute;
|
|
405
427
|
const hour = parsed.hour;
|
|
406
428
|
const dom = parsed.dayOfMonth;
|
|
@@ -419,7 +441,7 @@ class CronTab {
|
|
|
419
441
|
dom.isWildcard &&
|
|
420
442
|
month.isWildcard &&
|
|
421
443
|
dow.isWildcard) {
|
|
422
|
-
return "
|
|
444
|
+
return { kind: "everyMinute" };
|
|
423
445
|
}
|
|
424
446
|
// Every N minutes.
|
|
425
447
|
if (minuteStep !== null &&
|
|
@@ -428,8 +450,8 @@ class CronTab {
|
|
|
428
450
|
month.isWildcard &&
|
|
429
451
|
dow.isWildcard) {
|
|
430
452
|
return minuteStep === 1
|
|
431
|
-
? "
|
|
432
|
-
:
|
|
453
|
+
? { kind: "everyMinute" }
|
|
454
|
+
: { kind: "everyMinutes", step: minuteStep };
|
|
433
455
|
}
|
|
434
456
|
// Every hour (on the hour).
|
|
435
457
|
if (minute.values.length === 1 &&
|
|
@@ -438,7 +460,7 @@ class CronTab {
|
|
|
438
460
|
dom.isWildcard &&
|
|
439
461
|
month.isWildcard &&
|
|
440
462
|
dow.isWildcard) {
|
|
441
|
-
return
|
|
463
|
+
return { kind: "everyHourOnTheHour" };
|
|
442
464
|
}
|
|
443
465
|
// Every N hours (at minute M).
|
|
444
466
|
if (minute.values.length === 1 &&
|
|
@@ -446,42 +468,76 @@ class CronTab {
|
|
|
446
468
|
dom.isWildcard &&
|
|
447
469
|
month.isWildcard &&
|
|
448
470
|
dow.isWildcard) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
: `Every ${hourStep} hours${atMinute}`;
|
|
471
|
+
return {
|
|
472
|
+
kind: "everyHours",
|
|
473
|
+
step: hourStep,
|
|
474
|
+
minute: minute.values[0],
|
|
475
|
+
};
|
|
455
476
|
}
|
|
456
477
|
const isSingleTime = minute.values.length === 1 && hour.values.length === 1;
|
|
457
478
|
if (isSingleTime) {
|
|
458
|
-
const
|
|
479
|
+
const at = {
|
|
480
|
+
hour: hour.values[0],
|
|
481
|
+
minute: minute.values[0],
|
|
482
|
+
};
|
|
459
483
|
// Every day at HH:MM.
|
|
460
484
|
if (dom.isWildcard && month.isWildcard && dow.isWildcard) {
|
|
461
|
-
return
|
|
485
|
+
return Object.assign({ kind: "daily" }, at);
|
|
462
486
|
}
|
|
463
487
|
// Every week on <days> at HH:MM.
|
|
464
488
|
if (dom.isWildcard && month.isWildcard && !dow.isWildcard) {
|
|
465
|
-
return
|
|
489
|
+
return Object.assign({ kind: "weekly", weekdays: [...dow.values] }, at);
|
|
466
490
|
}
|
|
467
491
|
// Every month on the <day> at HH:MM.
|
|
468
492
|
if (!dom.isWildcard && month.isWildcard && dow.isWildcard) {
|
|
469
|
-
return
|
|
493
|
+
return Object.assign({ kind: "monthly", daysOfMonth: [...dom.values], monthStep: 1 }, at);
|
|
470
494
|
}
|
|
471
495
|
// Every N months on the <day> at HH:MM.
|
|
472
496
|
const monthStep = this.detectStep(month, 1, 12);
|
|
473
497
|
if (!dom.isWildcard && monthStep !== null && dow.isWildcard) {
|
|
474
|
-
|
|
475
|
-
return `Every ${everyMonths} on the ${this.describeDaysOfMonth(dom.values)} at ${time} (UTC)`;
|
|
498
|
+
return Object.assign({ kind: "monthly", daysOfMonth: [...dom.values], monthStep: monthStep }, at);
|
|
476
499
|
}
|
|
477
500
|
// Specific month(s) on the <day> at HH:MM (e.g. yearly).
|
|
478
501
|
if (!dom.isWildcard && !month.isWildcard && dow.isWildcard) {
|
|
479
|
-
return
|
|
502
|
+
return Object.assign({ kind: "yearly", daysOfMonth: [...dom.values], months: [...month.values] }, at);
|
|
480
503
|
}
|
|
481
504
|
}
|
|
482
505
|
}
|
|
483
|
-
|
|
484
|
-
|
|
506
|
+
return { kind: "fieldByField" };
|
|
507
|
+
}
|
|
508
|
+
// A shape's time of day: "09:30".
|
|
509
|
+
static describeTimeOfDay(hour, minute) {
|
|
510
|
+
return `${this.pad(hour)}:${this.pad(minute)}`;
|
|
511
|
+
}
|
|
512
|
+
static describe(parsed) {
|
|
513
|
+
const shape = this.getShapeOf(parsed);
|
|
514
|
+
switch (shape.kind) {
|
|
515
|
+
case "everyMinute":
|
|
516
|
+
return "Every minute";
|
|
517
|
+
case "everyMinutes":
|
|
518
|
+
return `Every ${shape.step} minutes`;
|
|
519
|
+
case "everyHourOnTheHour":
|
|
520
|
+
return "Every hour, on the hour";
|
|
521
|
+
case "everyHours": {
|
|
522
|
+
const atMinute = shape.minute === 0 ? "" : ` at minute ${this.pad(shape.minute)}`;
|
|
523
|
+
return shape.step === 1
|
|
524
|
+
? `Every hour${atMinute}`
|
|
525
|
+
: `Every ${shape.step} hours${atMinute}`;
|
|
526
|
+
}
|
|
527
|
+
case "daily":
|
|
528
|
+
return `Every day at ${this.describeTimeOfDay(shape.hour, shape.minute)} (UTC)`;
|
|
529
|
+
case "weekly":
|
|
530
|
+
return `Every week on ${this.describeWeekdays(shape.weekdays)} at ${this.describeTimeOfDay(shape.hour, shape.minute)} (UTC)`;
|
|
531
|
+
case "monthly": {
|
|
532
|
+
const everyMonths = shape.monthStep === 1 ? "month" : `${shape.monthStep} months`;
|
|
533
|
+
return `Every ${everyMonths} on the ${this.describeDaysOfMonth(shape.daysOfMonth)} at ${this.describeTimeOfDay(shape.hour, shape.minute)} (UTC)`;
|
|
534
|
+
}
|
|
535
|
+
case "yearly":
|
|
536
|
+
return `On the ${this.describeDaysOfMonth(shape.daysOfMonth)} of ${this.describeMonths(shape.months)} at ${this.describeTimeOfDay(shape.hour, shape.minute)} (UTC)`;
|
|
537
|
+
default:
|
|
538
|
+
// Generic fallback: list only the constrained fields.
|
|
539
|
+
return this.describeGeneric(parsed);
|
|
540
|
+
}
|
|
485
541
|
}
|
|
486
542
|
static describeGeneric(parsed) {
|
|
487
543
|
const parts = [];
|
|
@@ -552,16 +608,19 @@ class CronTab {
|
|
|
552
608
|
}
|
|
553
609
|
return step;
|
|
554
610
|
}
|
|
611
|
+
// "Monday, Wednesday and Friday": weekdays 0 (Sunday) - 6, in English.
|
|
555
612
|
static describeWeekdays(values) {
|
|
556
613
|
return this.joinList(values.map((v) => {
|
|
557
614
|
return DAY_NAMES_LONG[v] || `day ${v}`;
|
|
558
615
|
}));
|
|
559
616
|
}
|
|
617
|
+
// "January and July": months 1 - 12, in English.
|
|
560
618
|
static describeMonths(values) {
|
|
561
619
|
return this.joinList(values.map((v) => {
|
|
562
620
|
return MONTH_NAMES_LONG[v - 1] || `month ${v}`;
|
|
563
621
|
}));
|
|
564
622
|
}
|
|
623
|
+
// "1st and 15th", in English.
|
|
565
624
|
static describeDaysOfMonth(values) {
|
|
566
625
|
return this.joinList(values.map((v) => {
|
|
567
626
|
return this.ordinal(v);
|
|
@@ -604,24 +663,39 @@ class CronTab {
|
|
|
604
663
|
* is a valid 5-field cron expression.
|
|
605
664
|
*/
|
|
606
665
|
CronTab.PRESETS = [
|
|
607
|
-
{ label: "Every minute", value: "* * * * *" },
|
|
608
|
-
{ label: "Every 5 minutes", value: "*/5 * * * *" },
|
|
609
|
-
{ label: "Every 10 minutes", value: "*/10 * * * *" },
|
|
610
|
-
{ label: "Every 15 minutes", value: "*/15 * * * *" },
|
|
611
|
-
{ label: "Every 30 minutes", value: "*/30 * * * *" },
|
|
612
|
-
{ label: "Every hour", value: "0 * * * *" },
|
|
613
|
-
{ label: "Every 2 hours", value: "0 */2 * * *" },
|
|
614
|
-
{ label: "Every 3 hours", value: "0 */3 * * *" },
|
|
615
|
-
{ label: "Every 6 hours", value: "0 */6 * * *" },
|
|
616
|
-
{ label: "Every 12 hours", value: "0 */12 * * *" },
|
|
617
|
-
{ label: "Every day at midnight", value: "0 0 * * *" },
|
|
618
|
-
{ label: "Every day at 9:00 AM", value: "0 9 * * *" },
|
|
619
|
-
{ label: "Every Monday at 9:00 AM", value: "0 9 * * 1" },
|
|
620
|
-
{
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
{
|
|
666
|
+
{ label: translationKey("Every minute"), value: "* * * * *" },
|
|
667
|
+
{ label: translationKey("Every 5 minutes"), value: "*/5 * * * *" },
|
|
668
|
+
{ label: translationKey("Every 10 minutes"), value: "*/10 * * * *" },
|
|
669
|
+
{ label: translationKey("Every 15 minutes"), value: "*/15 * * * *" },
|
|
670
|
+
{ label: translationKey("Every 30 minutes"), value: "*/30 * * * *" },
|
|
671
|
+
{ label: translationKey("Every hour"), value: "0 * * * *" },
|
|
672
|
+
{ label: translationKey("Every 2 hours"), value: "0 */2 * * *" },
|
|
673
|
+
{ label: translationKey("Every 3 hours"), value: "0 */3 * * *" },
|
|
674
|
+
{ label: translationKey("Every 6 hours"), value: "0 */6 * * *" },
|
|
675
|
+
{ label: translationKey("Every 12 hours"), value: "0 */12 * * *" },
|
|
676
|
+
{ label: translationKey("Every day at midnight"), value: "0 0 * * *" },
|
|
677
|
+
{ label: translationKey("Every day at 9:00 AM"), value: "0 9 * * *" },
|
|
678
|
+
{ label: translationKey("Every Monday at 9:00 AM"), value: "0 9 * * 1" },
|
|
679
|
+
{
|
|
680
|
+
label: translationKey("Every week (Sunday at midnight)"),
|
|
681
|
+
value: "0 0 * * 0",
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
label: translationKey("Every month (1st at midnight)"),
|
|
685
|
+
value: "0 0 1 * *",
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
label: translationKey("Every 3 months (1st at midnight)"),
|
|
689
|
+
value: "0 0 1 */3 *",
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
label: translationKey("Every 6 months (1st at midnight)"),
|
|
693
|
+
value: "0 0 1 */6 *",
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
label: translationKey("Every year (Jan 1st at midnight)"),
|
|
697
|
+
value: "0 0 1 1 *",
|
|
698
|
+
},
|
|
625
699
|
];
|
|
626
700
|
// ----- Next-run computation --------------------------------------------
|
|
627
701
|
/*
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import MonitorSteps from "../../Types/Monitor/MonitorSteps.mjs";
|
|
2
2
|
import MonitorType from "../../Types/Monitor/MonitorType.mjs";
|
|
3
|
+
import { Translator } from "../../UI/Utils/TranslateTemplate.mjs";
|
|
3
4
|
export interface MonitorOverviewTarget {
|
|
4
5
|
value: string;
|
|
5
6
|
isMono: boolean;
|
|
@@ -10,6 +11,7 @@ export default class MonitorOverviewTargetUtil {
|
|
|
10
11
|
monitorType: MonitorType;
|
|
11
12
|
monitorSteps: MonitorSteps | undefined;
|
|
12
13
|
serverHostname?: string | undefined;
|
|
14
|
+
translator?: Translator | undefined;
|
|
13
15
|
}): MonitorOverviewTarget | null;
|
|
14
16
|
static redactUrl(value: string): string;
|
|
15
17
|
static redactHost(value: string): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import MonitorSteps from "../../Types/Monitor/MonitorSteps";
|
|
2
2
|
import MonitorType from "../../Types/Monitor/MonitorType";
|
|
3
|
+
import { Translator } from "../../UI/Utils/TranslateTemplate";
|
|
3
4
|
export interface MonitorOverviewTarget {
|
|
4
5
|
value: string;
|
|
5
6
|
isMono: boolean;
|
|
@@ -10,6 +11,7 @@ export default class MonitorOverviewTargetUtil {
|
|
|
10
11
|
monitorType: MonitorType;
|
|
11
12
|
monitorSteps: MonitorSteps | undefined;
|
|
12
13
|
serverHostname?: string | undefined;
|
|
14
|
+
translator?: Translator | undefined;
|
|
13
15
|
}): MonitorOverviewTarget | null;
|
|
14
16
|
static redactUrl(value: string): string;
|
|
15
17
|
static redactHost(value: string): string;
|
|
@@ -50,6 +50,7 @@ class MonitorOverviewTargetUtil {
|
|
|
50
50
|
monitorType: data.monitorType,
|
|
51
51
|
step: step,
|
|
52
52
|
serverHostname: data.serverHostname,
|
|
53
|
+
translator: data.translator,
|
|
53
54
|
});
|
|
54
55
|
if (!target || !target.value) {
|
|
55
56
|
return null;
|
|
@@ -205,9 +206,19 @@ class MonitorOverviewTargetUtil {
|
|
|
205
206
|
case MonitorType_1.default.Server:
|
|
206
207
|
return { value: toText(data.serverHostname), isMono: true };
|
|
207
208
|
case MonitorType_1.default.SyntheticMonitor:
|
|
208
|
-
return {
|
|
209
|
+
return {
|
|
210
|
+
value: data.translator
|
|
211
|
+
? data.translator.translateTemplate("Browser script")
|
|
212
|
+
: "Browser script",
|
|
213
|
+
isMono: false,
|
|
214
|
+
};
|
|
209
215
|
case MonitorType_1.default.CustomJavaScriptCode:
|
|
210
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
value: data.translator
|
|
218
|
+
? data.translator.translateTemplate("Custom script")
|
|
219
|
+
: "Custom script",
|
|
220
|
+
isMono: false,
|
|
221
|
+
};
|
|
211
222
|
default:
|
|
212
223
|
/*
|
|
213
224
|
* Network devices link to the device instead; heartbeats, telemetry,
|
|
@@ -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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RuleRunResult, RuleRunType } from "../../Types/Rules/RuleRun.mjs";
|
|
2
|
+
export declare function withIndefiniteArticle(noun: string): string;
|
|
2
3
|
export default class RuleRunSummary {
|
|
3
4
|
static describeConfirmation(ruleType: RuleRunType): string;
|
|
4
5
|
static describeRunNowCard(ruleType: RuleRunType): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RuleRunResult, RuleRunType } from "../../Types/Rules/RuleRun";
|
|
2
|
+
export declare function withIndefiniteArticle(noun: string): string;
|
|
2
3
|
export default class RuleRunSummary {
|
|
3
4
|
static describeConfirmation(ruleType: RuleRunType): string;
|
|
4
5
|
static describeRunNowCard(ruleType: RuleRunType): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withIndefiniteArticle = withIndefiniteArticle;
|
|
3
4
|
const RuleRun_1 = require("../../Types/Rules/RuleRun");
|
|
4
5
|
/*
|
|
5
6
|
* The sentences a rule run shows: before it starts, while it is chaining
|
|
@@ -23,6 +24,23 @@ function wasOrWere(value) {
|
|
|
23
24
|
function capitalize(text) {
|
|
24
25
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
25
26
|
}
|
|
27
|
+
/*
|
|
28
|
+
* Initialisms said letter by letter whose first letter sounds like a vowel:
|
|
29
|
+
* "an SLO". Every other noun takes "an" before a vowel letter ("an
|
|
30
|
+
* incident", "an IoT fleet", "an on-call policy") and "a" otherwise ("a
|
|
31
|
+
* host", "a RUM application").
|
|
32
|
+
*/
|
|
33
|
+
const INITIALISMS_SAID_WITH_A_VOWEL = ["SLO"];
|
|
34
|
+
/*
|
|
35
|
+
* The singular with its indefinite article, as it reads mid-sentence: "an
|
|
36
|
+
* incident", "a host". The Run Now card said "when a incident is created".
|
|
37
|
+
*/
|
|
38
|
+
function withIndefiniteArticle(noun) {
|
|
39
|
+
const firstWord = noun.split(" ")[0] || "";
|
|
40
|
+
const isAn = INITIALISMS_SAID_WITH_A_VOWEL.includes(firstWord) ||
|
|
41
|
+
"aeiouAEIOU".includes(noun.charAt(0) || "-");
|
|
42
|
+
return `${isAn ? "an" : "a"} ${noun}`;
|
|
43
|
+
}
|
|
26
44
|
class RuleRunSummary {
|
|
27
45
|
// What the confirmation modal says the run is about to do.
|
|
28
46
|
static describeConfirmation(ruleType) {
|
|
@@ -54,7 +72,7 @@ class RuleRunSummary {
|
|
|
54
72
|
if (meta.action === RuleRun_1.RuleRunAction.SyncSloMonitors) {
|
|
55
73
|
return "Re-sync this SLO's monitors now with its enabled rules. Monitors attached by hand are left alone.";
|
|
56
74
|
}
|
|
57
|
-
return `This rule runs only when
|
|
75
|
+
return `This rule runs only when ${withIndefiniteArticle(meta.resourceSingular)} is created. Run it now for the ${meta.resourcePlural} that already exist.`;
|
|
58
76
|
}
|
|
59
77
|
/*
|
|
60
78
|
* The confirmation for running several rules from the table's bulk actions.
|
|
@@ -3,6 +3,11 @@ import { SecurityEventRecord } from "./SecurityEventRecord.mjs";
|
|
|
3
3
|
export declare enum UdmEventType {
|
|
4
4
|
UserLogin = "USER_LOGIN",
|
|
5
5
|
ProcessLaunch = "PROCESS_LAUNCH",
|
|
6
|
+
ProcessOpen = "PROCESS_OPEN",
|
|
7
|
+
ProcessInjection = "PROCESS_INJECTION",
|
|
8
|
+
ProcessTermination = "PROCESS_TERMINATION",
|
|
9
|
+
ProcessPrivilegeEscalation = "PROCESS_PRIVILEGE_ESCALATION",
|
|
10
|
+
ProcessUncategorized = "PROCESS_UNCATEGORIZED",
|
|
6
11
|
NetworkConnection = "NETWORK_CONNECTION",
|
|
7
12
|
GenericEvent = "GENERIC_EVENT"
|
|
8
13
|
}
|
|
@@ -3,6 +3,11 @@ import { SecurityEventRecord } from "./SecurityEventRecord";
|
|
|
3
3
|
export declare enum UdmEventType {
|
|
4
4
|
UserLogin = "USER_LOGIN",
|
|
5
5
|
ProcessLaunch = "PROCESS_LAUNCH",
|
|
6
|
+
ProcessOpen = "PROCESS_OPEN",
|
|
7
|
+
ProcessInjection = "PROCESS_INJECTION",
|
|
8
|
+
ProcessTermination = "PROCESS_TERMINATION",
|
|
9
|
+
ProcessPrivilegeEscalation = "PROCESS_PRIVILEGE_ESCALATION",
|
|
10
|
+
ProcessUncategorized = "PROCESS_UNCATEGORIZED",
|
|
6
11
|
NetworkConnection = "NETWORK_CONNECTION",
|
|
7
12
|
GenericEvent = "GENERIC_EVENT"
|
|
8
13
|
}
|