@oneuptime/common 14.1.0 → 14.2.0
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.d.mts +1 -0
- package/Models/DatabaseModels/Alert.d.ts +1 -0
- package/Models/DatabaseModels/Alert.js +34 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.mts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.ts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/Models/DatabaseModels/Incident.d.mts +1 -0
- package/Models/DatabaseModels/Incident.d.ts +1 -0
- package/Models/DatabaseModels/Incident.js +35 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.mts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.ts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.js +591 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.mjs +3 -0
- package/Models/DatabaseModels/Index.js +2 -0
- package/Models/DatabaseModels/TelemetryIngestionKey.js +1 -1
- package/Types/AI/AIActionWords.d.mts +3 -1
- package/Types/AI/AIActionWords.d.ts +3 -1
- package/Types/AI/AIActionWords.js +70 -1
- package/Types/AI/AIActionWords.mjs +2 -0
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AIReadTableWords.d.mts +192 -0
- package/Types/AI/AIReadTableWords.d.ts +192 -0
- package/Types/AI/AIReadTableWords.js +368 -0
- package/Types/AI/AIReadTableWords.mjs +18 -0
- package/Types/AI/AiRunRefusal.d.mts +3 -0
- package/Types/AI/AiRunRefusal.d.ts +3 -0
- package/Types/AI/AiRunRefusal.js +22 -1
- package/Types/AI/ResourceAiAccessPermissions.js +7 -18
- package/Types/AuditLog/AuditLogActionLabel.js +19 -9
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.js +123 -16
- package/Types/Cloud/CloudResourceHealth.d.mts +30 -1
- package/Types/Cloud/CloudResourceHealth.d.ts +30 -1
- package/Types/Cloud/CloudResourceHealth.js +405 -13
- package/Types/Cloud/CloudResourceHealth.mjs +28 -0
- package/Types/DataObservability/DataCheckRefusals.d.mts +32 -0
- package/Types/DataObservability/DataCheckRefusals.d.ts +32 -0
- package/Types/DataObservability/DataCheckRefusals.js +77 -0
- package/Types/DataObservability/DataCheckRefusals.mjs +8 -0
- package/Types/Database/AccessControl/PermissionScopeNarrowing.js +4 -0
- package/Types/Date.d.mts +2 -0
- package/Types/Date.d.ts +2 -0
- package/Types/Date.js +22 -0
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +8 -5
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Exception/EgressGuardException.js +1 -1
- package/Types/Exception/ErrorMessageRule.d.mts +1 -0
- package/Types/Exception/ErrorMessageRule.d.ts +1 -0
- package/Types/Exception/ErrorMessageRule.js +67 -13
- package/Types/Exception/ErrorMessageRule.mjs +1 -0
- package/Types/Exception/ExceptionMessages.d.mts +2 -0
- package/Types/Exception/ExceptionMessages.d.ts +2 -0
- package/Types/Exception/ExceptionMessages.js +2 -0
- package/Types/Incident/PostmortemActionItemStatus.d.mts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.d.ts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.js +74 -0
- package/Types/Incident/PostmortemActionItemStatus.mjs +5 -0
- package/Types/JSONFunctions.js +10 -3
- package/Types/Link.d.mts +1 -0
- package/Types/Link.d.ts +1 -0
- package/Types/MeaningKeys.d.mts +4 -0
- package/Types/MeaningKeys.d.ts +4 -0
- package/Types/MeaningKeys.js +74 -0
- package/Types/MeaningKeys.mjs +5 -0
- package/Types/Monitor/WhoIsTold.d.mts +3 -0
- package/Types/Monitor/WhoIsTold.d.ts +3 -0
- package/Types/Monitor/WhoIsTold.js +63 -13
- package/Types/NoBreakSpaces.d.mts +16 -0
- package/Types/NoBreakSpaces.d.ts +16 -0
- package/Types/NoBreakSpaces.js +419 -0
- package/Types/NoBreakSpaces.mjs +9 -0
- package/Types/NotificationRule/PagingLadder.d.mts +12 -0
- package/Types/NotificationRule/PagingLadder.d.ts +12 -0
- package/Types/NotificationRule/PagingLadder.js +159 -11
- package/Types/NotificationRule/PagingLadder.mjs +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.mts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.ts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.js +42 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.mjs +4 -0
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.mts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.ts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.js +21 -20
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.js +125 -1
- package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +12 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OpenStack/OpenStackCapacity.js +12 -5
- package/Types/Permission.d.mts +4 -0
- package/Types/Permission.d.ts +4 -0
- package/Types/Permission.js +64 -8
- package/Types/Product/ProductUsage.js +2 -1
- package/Types/Product/ProjectProductsAnswer.js +2 -1
- package/Types/ResourceAiAgent/AiResourceType.d.mts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.js +12 -0
- package/Types/Rum/ProductAnalyticsEventReads.js +10 -1
- package/Types/Rum/ProductAnalyticsEvents.js +13 -1
- package/Types/Rum/SessionReplayCustomEvents.d.mts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.d.ts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.js +12 -0
- package/Types/Rum/SessionReplayCustomEvents.mjs +1 -0
- package/Types/SetupHealth/SetupHealth.d.mts +1 -0
- package/Types/SetupHealth/SetupHealth.d.ts +1 -0
- package/Types/SetupHealth/SetupHealth.js +13 -5
- package/Types/StatusPage/DefaultStatusNames.d.mts +11 -3
- package/Types/StatusPage/DefaultStatusNames.d.ts +11 -3
- package/Types/StatusPage/DefaultStatusNames.js +74 -28
- package/Types/StatusPage/DefaultStatusNames.mjs +9 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.mts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
- package/Types/Telemetry/TelemetryIngestionKeyType.js +7 -6
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +100 -19
- package/Types/Translator.mjs +1 -0
- package/Types/UserSession/SessionLength.d.mts +33 -0
- package/Types/UserSession/SessionLength.d.ts +33 -0
- package/Types/UserSession/SessionLength.js +134 -5
- package/Types/UserSession/SessionLength.mjs +5 -0
- package/Types/Workflow/WorkflowStatus.js +21 -10
- package/Utils/AI/InvestigationReport.js +2 -2
- package/Utils/API.d.mts +0 -11
- package/Utils/API.d.ts +0 -11
- package/Utils/API.js +0 -432
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +2 -2
- package/Utils/AiRemediation/VerifiedFixRunbook.d.mts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.d.ts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.js +231 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.mjs +10 -0
- package/Utils/Dashboard/DashboardWidgetSorts.js +11 -2
- package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.js +5 -3
- package/Utils/DefaultRecordNames.d.mts +6 -0
- package/Utils/DefaultRecordNames.d.ts +6 -0
- package/Utils/DefaultRecordNames.js +122 -0
- package/Utils/DefaultRecordNames.mjs +6 -0
- package/Utils/Grok/Grok.js +7 -4
- package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.js +107 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.mjs +10 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.mts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.ts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.js +118 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.mjs +12 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.mts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.ts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.js +544 -0
- package/Utils/Incident/PostmortemNoteActionItems.mjs +7 -0
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +61 -0
- package/Utils/LookupTable.mjs +3 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +101 -1
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +2 -0
- package/Utils/Markdown/OverLongText.js +296 -2
- package/Utils/Markdown/SlowMarkdown.d.mts +1 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +1 -0
- package/Utils/Markdown/SlowMarkdown.js +354 -4
- package/Utils/Markdown/SlowMarkdown.mjs +1 -0
- package/Utils/Metrics/MetricFormulaEvaluator.js +10 -4
- package/Utils/Metrics/MetricSeriesFingerprint.js +13 -4
- package/Utils/Metrics/MetricSeriesScope.d.mts +5 -0
- package/Utils/Metrics/MetricSeriesScope.d.ts +5 -0
- package/Utils/Metrics/MetricSeriesScope.js +5 -1
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +3 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +3 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +100 -11
- package/Utils/Monitor/ProbeAgreementRule.d.mts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.d.ts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.js +58 -0
- package/Utils/Monitor/ProbeAgreementRule.mjs +3 -0
- package/Utils/Monitor/ProbeFailureReading.d.mts +4 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +4 -0
- package/Utils/Monitor/ProbeFailureReading.js +30 -1
- package/Utils/Monitor/ProbeFailureReading.mjs +1 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.mts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.ts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.js +252 -0
- package/Utils/Monitor/RequestFailureDescriptions.mjs +6 -0
- package/Utils/PromQL/PromQLEngine.js +18 -9
- package/Utils/PromQL/PromQLFunctionEvaluators.js +114 -58
- package/Utils/PromQL/PromQLLabelOrder.d.mts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.d.ts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.js +212 -0
- package/Utils/PromQL/PromQLLabelOrder.mjs +6 -0
- package/Utils/PromQL/PromQLLabels.js +4 -3
- package/Utils/PromQL/PromQLMetricNames.js +8 -2
- package/Utils/PromQL/PromQLParser.js +11 -6
- package/Utils/PromQL/PromQLRegex.d.mts +11 -0
- package/Utils/PromQL/PromQLRegex.d.ts +11 -0
- package/Utils/PromQL/PromQLRegex.js +990 -50
- package/Utils/PromQL/PromQLRegex.mjs +3 -0
- package/Utils/PromQL/PrometheusResponse.js +3 -1
- package/Utils/PromQL/RE2CharacterClass.d.mts +24 -0
- package/Utils/PromQL/RE2CharacterClass.d.ts +24 -0
- package/Utils/PromQL/RE2CharacterClass.js +532 -0
- package/Utils/PromQL/RE2CharacterClass.mjs +16 -0
- package/Utils/RequestFailedDetailsUtil.d.mts +15 -0
- package/Utils/RequestFailedDetailsUtil.d.ts +15 -0
- package/Utils/RequestFailedDetailsUtil.js +452 -0
- package/Utils/RequestFailedDetailsUtil.mjs +2 -0
- package/Utils/Rum/UrlScrubber.d.mts +1 -1
- package/Utils/Rum/UrlScrubber.d.ts +1 -1
- package/Utils/Rum/UrlScrubber.js +10 -4
- package/Utils/Rum/UserFlow.js +22 -4
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.mts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.ts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.js +99 -17
- package/Utils/SecurityCase/SecurityOverviewMetrics.mjs +3 -0
- package/Utils/Sms/OnCallPageSms.d.mts +2 -0
- package/Utils/Sms/OnCallPageSms.d.ts +2 -0
- package/Utils/Sms/OnCallPageSms.js +3 -1
- package/Utils/StateListType.d.mts +11 -0
- package/Utils/StateListType.d.ts +11 -0
- package/Utils/StateListType.js +21 -0
- package/Utils/StateListType.mjs +2 -0
- package/Utils/StateOrder.d.mts +8 -11
- package/Utils/StateOrder.d.ts +8 -11
- package/Utils/StateOrder.js +49 -84
- package/Utils/StateOrder.mjs +2 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.mts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.ts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.js +25 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.mjs +2 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.mts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.ts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.js +39 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.mjs +2 -0
- package/Utils/Syslog/SyslogMessageParser.js +16 -6
- package/Utils/Telemetry/HeartbeatAvailability.js +16 -21
- package/Utils/ValueFormatter.d.mts +1 -0
- package/Utils/ValueFormatter.d.ts +1 -0
- package/Utils/ValueFormatter.js +258 -18
- package/package.json +1 -1
|
@@ -0,0 +1,231 @@
|
|
|
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.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH = exports.VERIFIED_FIX_RUNBOOK_REFUSAL_MESSAGES = exports.VerifiedFixRunbookRefusal = void 0;
|
|
7
|
+
exports.getSucceededCommands = getSucceededCommands;
|
|
8
|
+
exports.getSucceededMcpCalls = getSucceededMcpCalls;
|
|
9
|
+
exports.getVerifiedFixRunbookRefusal = getVerifiedFixRunbookRefusal;
|
|
10
|
+
exports.toRunbookSteps = toRunbookSteps;
|
|
11
|
+
exports.buildVerifiedFixRunbook = buildVerifiedFixRunbook;
|
|
12
|
+
exports.getUniqueRunbookName = getUniqueRunbookName;
|
|
13
|
+
const AiRemediationCommandPlan_1 = require("../../Types/AutoRemediation/AiRemediationCommandPlan");
|
|
14
|
+
const AiRemediationCommandPolicyVerdict_1 = require("../../Types/AutoRemediation/AiRemediationCommandPolicyVerdict");
|
|
15
|
+
const AutoRemediationSuggestionType_1 = __importDefault(require("../../Types/AutoRemediation/AutoRemediationSuggestionType"));
|
|
16
|
+
const AutoRemediationVerificationStatus_1 = __importDefault(require("../../Types/AutoRemediation/AutoRemediationVerificationStatus"));
|
|
17
|
+
const ExternalMcpToolCallPlan_1 = require("../../Types/AutoRemediation/ExternalMcpToolCallPlan");
|
|
18
|
+
const ColumnLength_1 = __importDefault(require("../../Types/Database/ColumnLength"));
|
|
19
|
+
const ObjectID_1 = __importDefault(require("../../Types/ObjectID"));
|
|
20
|
+
const RunbookStepType_1 = __importDefault(require("../../Types/Runbook/RunbookStepType"));
|
|
21
|
+
/*
|
|
22
|
+
* A FIX THAT WORKED, WRITTEN DOWN AS A RUNBOOK (issue #6801).
|
|
23
|
+
*
|
|
24
|
+
* OneUptime AI could run a runbook but never write one. When it fixes an
|
|
25
|
+
* incident or an alert itself - commands on a Runner, a change through a
|
|
26
|
+
* cluster's or a resource's AI agent, calls to an MCP server - and the fix
|
|
27
|
+
* is verified (the monitors recovered, or the subject was resolved, within
|
|
28
|
+
* the verification window), what it ran is exactly the procedure the team
|
|
29
|
+
* would want written down. Save as Runbook writes it: a runbook of the
|
|
30
|
+
* steps that ran, in the order they ran, each with why OneUptime AI ran it
|
|
31
|
+
* and how to undo it.
|
|
32
|
+
*
|
|
33
|
+
* - A command on a Runner becomes a Bash step on that Runner, as written,
|
|
34
|
+
* with the same time limit. One the policy made a person approve waits
|
|
35
|
+
* for an approval before it runs in the runbook too.
|
|
36
|
+
* - A change through a cluster's Kubernetes AI agent, through a
|
|
37
|
+
* resource's AI agent (Docker, a host, a cloud account ...) or through
|
|
38
|
+
* an MCP server becomes a manual step that holds the exact command or
|
|
39
|
+
* call: a runbook's own steps cannot reach those agents, and would go
|
|
40
|
+
* around the command policy if they could (as the OpenStack runbook
|
|
41
|
+
* templates do, OpenStackRunbookTemplates). The step says to ask
|
|
42
|
+
* OneUptime AI for the change, or to make it by hand.
|
|
43
|
+
* - A command or call that did not run, or failed, is left out: the
|
|
44
|
+
* runbook is what worked.
|
|
45
|
+
*
|
|
46
|
+
* The runbook starts turned off: OneUptime AI never picks it, no rule runs
|
|
47
|
+
* it, and nobody can start it until a person has read its steps and turned
|
|
48
|
+
* it on (RunbookService, RunbookStarter). Pure: the server builds the
|
|
49
|
+
* runbook with it, and the tests pin it.
|
|
50
|
+
*/
|
|
51
|
+
// Why a fix cannot be saved as a runbook.
|
|
52
|
+
var VerifiedFixRunbookRefusal;
|
|
53
|
+
(function (VerifiedFixRunbookRefusal) {
|
|
54
|
+
// The fix was not verified: only what worked is written down.
|
|
55
|
+
VerifiedFixRunbookRefusal["NotVerified"] = "NotVerified";
|
|
56
|
+
// The fix ran a runbook already.
|
|
57
|
+
VerifiedFixRunbookRefusal["RanARunbook"] = "RanARunbook";
|
|
58
|
+
// Nothing of the fix ran and succeeded.
|
|
59
|
+
VerifiedFixRunbookRefusal["NothingRan"] = "NothingRan";
|
|
60
|
+
// It was saved as a runbook already.
|
|
61
|
+
VerifiedFixRunbookRefusal["AlreadySaved"] = "AlreadySaved";
|
|
62
|
+
})(VerifiedFixRunbookRefusal || (exports.VerifiedFixRunbookRefusal = VerifiedFixRunbookRefusal = {}));
|
|
63
|
+
exports.VERIFIED_FIX_RUNBOOK_REFUSAL_MESSAGES = {
|
|
64
|
+
[VerifiedFixRunbookRefusal.NotVerified]: "Only a fix that worked can be saved as a runbook, and this one has not been verified. Wait for its verification, or write the runbook yourself under Runbooks.",
|
|
65
|
+
[VerifiedFixRunbookRefusal.RanARunbook]: "This fix ran a runbook already, so there is nothing new to save. Open the runbook from the fix to change it.",
|
|
66
|
+
[VerifiedFixRunbookRefusal.NothingRan]: "None of this fix's commands ran and succeeded, so there is nothing to save as a runbook.",
|
|
67
|
+
[VerifiedFixRunbookRefusal.AlreadySaved]: "This fix is saved as a runbook already. Open that runbook from the fix.",
|
|
68
|
+
};
|
|
69
|
+
// The longest step title the runbook editor shows on one line.
|
|
70
|
+
exports.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH = 120;
|
|
71
|
+
function cut(text, maxLength) {
|
|
72
|
+
const line = text.replace(/\s+/g, " ").trim();
|
|
73
|
+
return line.length > maxLength
|
|
74
|
+
? `${line.slice(0, maxLength - 1).trimEnd()}…`
|
|
75
|
+
: line;
|
|
76
|
+
}
|
|
77
|
+
// The commands of the fix that ran and succeeded, in the order they ran.
|
|
78
|
+
function getSucceededCommands(plan) {
|
|
79
|
+
return ((plan === null || plan === void 0 ? void 0 : plan.commands) || [])
|
|
80
|
+
.filter((command) => {
|
|
81
|
+
var _a;
|
|
82
|
+
return (!(0, AiRemediationCommandPlan_1.isRemovedSshCommand)(command) &&
|
|
83
|
+
((_a = command.execution) === null || _a === void 0 ? void 0 : _a.status) ===
|
|
84
|
+
AiRemediationCommandPlan_1.AiRemediationCommandExecutionStatus.Succeeded);
|
|
85
|
+
})
|
|
86
|
+
.sort((a, b) => {
|
|
87
|
+
return a.sequence - b.sequence;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// The MCP calls of the fix that were made and succeeded, in the order they were made.
|
|
91
|
+
function getSucceededMcpCalls(plan) {
|
|
92
|
+
return ((plan === null || plan === void 0 ? void 0 : plan.calls) || [])
|
|
93
|
+
.filter((call) => {
|
|
94
|
+
return call.status === ExternalMcpToolCallPlan_1.ExternalMcpToolCallStatus.Succeeded;
|
|
95
|
+
})
|
|
96
|
+
.sort((a, b) => {
|
|
97
|
+
return a.sequence - b.sequence;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Why a fix cannot be saved as a runbook, or null when it can.
|
|
101
|
+
function getVerifiedFixRunbookRefusal(input) {
|
|
102
|
+
if (input.suggestionType === AutoRemediationSuggestionType_1.default.Runbook) {
|
|
103
|
+
return VerifiedFixRunbookRefusal.RanARunbook;
|
|
104
|
+
}
|
|
105
|
+
if (input.savedAsRunbookId) {
|
|
106
|
+
return VerifiedFixRunbookRefusal.AlreadySaved;
|
|
107
|
+
}
|
|
108
|
+
if (input.verificationStatus !== AutoRemediationVerificationStatus_1.default.Verified) {
|
|
109
|
+
return VerifiedFixRunbookRefusal.NotVerified;
|
|
110
|
+
}
|
|
111
|
+
const ranSomething = input.suggestionType === AutoRemediationSuggestionType_1.default.McpToolCalls
|
|
112
|
+
? getSucceededMcpCalls(input.mcpToolCallPlan).length > 0
|
|
113
|
+
: getSucceededCommands(input.commandPlan).length > 0;
|
|
114
|
+
return ranSomething ? null : VerifiedFixRunbookRefusal.NothingRan;
|
|
115
|
+
}
|
|
116
|
+
// "incident #42", or "the incident" when it has no handle.
|
|
117
|
+
function nameSubject(subject) {
|
|
118
|
+
return subject.handle.trim()
|
|
119
|
+
? `${subject.kind} ${subject.handle.trim()}`
|
|
120
|
+
: `the ${subject.kind}`;
|
|
121
|
+
}
|
|
122
|
+
// What a step says under its title: why it ran, what it did, how to undo it.
|
|
123
|
+
function describeCommand(command, lead) {
|
|
124
|
+
var _a;
|
|
125
|
+
return [
|
|
126
|
+
lead,
|
|
127
|
+
command.rationale.trim() ? `Why: ${command.rationale.trim()}` : null,
|
|
128
|
+
command.expectedEffect.trim()
|
|
129
|
+
? `What it does: ${command.expectedEffect.trim()}`
|
|
130
|
+
: null,
|
|
131
|
+
((_a = command.rollbackCommand) === null || _a === void 0 ? void 0 : _a.trim())
|
|
132
|
+
? `To undo it: ${command.rollbackCommand.trim()}`
|
|
133
|
+
: null,
|
|
134
|
+
]
|
|
135
|
+
.filter((line) => {
|
|
136
|
+
return Boolean(line);
|
|
137
|
+
})
|
|
138
|
+
.join("\n\n");
|
|
139
|
+
}
|
|
140
|
+
// Where a change through an AI agent ran: "the prod cluster", "web-01".
|
|
141
|
+
function getAgentTarget(command) {
|
|
142
|
+
if (command.stepType === RunbookStepType_1.default.Kubectl) {
|
|
143
|
+
const cluster = (command.kubernetesClusterNameSnapshot || "").trim();
|
|
144
|
+
return cluster ? `the ${cluster} cluster` : "the cluster";
|
|
145
|
+
}
|
|
146
|
+
const resource = (command.resourceNameSnapshot || "").trim();
|
|
147
|
+
const agent = (command.runnerNameSnapshot || "").trim();
|
|
148
|
+
if (resource && agent) {
|
|
149
|
+
return `${resource} (${agent})`;
|
|
150
|
+
}
|
|
151
|
+
return resource || agent || "the resource";
|
|
152
|
+
}
|
|
153
|
+
function toRunbookSteps(input) {
|
|
154
|
+
const steps = [];
|
|
155
|
+
const add = (step) => {
|
|
156
|
+
steps.push(Object.assign({ id: ObjectID_1.default.generate().toString(), order: steps.length + 1 }, step));
|
|
157
|
+
};
|
|
158
|
+
for (const command of input.commands) {
|
|
159
|
+
if (command.stepType === RunbookStepType_1.default.Bash) {
|
|
160
|
+
add({
|
|
161
|
+
type: RunbookStepType_1.default.Bash,
|
|
162
|
+
title: cut(command.command, exports.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH),
|
|
163
|
+
description: describeCommand(command, null),
|
|
164
|
+
requireApprovalBeforeRunning: command.policyVerdict ===
|
|
165
|
+
AiRemediationCommandPolicyVerdict_1.AiRemediationCommandPolicyVerdict.RequiresApproval,
|
|
166
|
+
config: {
|
|
167
|
+
script: command.command,
|
|
168
|
+
agentId: command.runnerId,
|
|
169
|
+
timeoutInMs: command.timeoutInMs,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const target = getAgentTarget(command);
|
|
175
|
+
add({
|
|
176
|
+
type: RunbookStepType_1.default.Manual,
|
|
177
|
+
title: cut(`On ${target}: ${command.command}`, exports.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH),
|
|
178
|
+
description: describeCommand(command, `Run this on ${target}: ${command.command}\n\nOneUptime AI made this change through the AI agent there. Ask OneUptime AI to make it again, or make it yourself, then mark this step done.`),
|
|
179
|
+
config: {},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
for (const call of input.mcpCalls) {
|
|
183
|
+
const server = call.serverNameSnapshot.trim() || "the MCP server";
|
|
184
|
+
add({
|
|
185
|
+
type: RunbookStepType_1.default.Manual,
|
|
186
|
+
title: cut(`${call.toolName} on ${server}`, exports.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH),
|
|
187
|
+
description: `Call the tool ${call.toolName} on ${server} with these arguments:\n\n${JSON.stringify(call.arguments, null, 2)}\n\nOneUptime AI made this change through the MCP server. Ask OneUptime AI to make it again, or make it yourself, then mark this step done.`,
|
|
188
|
+
config: {},
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return steps;
|
|
192
|
+
}
|
|
193
|
+
/*
|
|
194
|
+
* The runbook a verified fix is written down as: named for what it fixed,
|
|
195
|
+
* said where it comes from, its steps what ran. Its name may be taken in
|
|
196
|
+
* the project already - the server makes it unique (getUniqueRunbookName).
|
|
197
|
+
*/
|
|
198
|
+
function buildVerifiedFixRunbook(input) {
|
|
199
|
+
const steps = toRunbookSteps({
|
|
200
|
+
commands: input.suggestionType === AutoRemediationSuggestionType_1.default.McpToolCalls
|
|
201
|
+
? []
|
|
202
|
+
: getSucceededCommands(input.commandPlan),
|
|
203
|
+
mcpCalls: input.suggestionType === AutoRemediationSuggestionType_1.default.McpToolCalls
|
|
204
|
+
? getSucceededMcpCalls(input.mcpToolCallPlan)
|
|
205
|
+
: [],
|
|
206
|
+
});
|
|
207
|
+
const subjectTitle = input.subject.title.trim();
|
|
208
|
+
const name = cut(subjectTitle ? `Fix: ${subjectTitle}` : "Verified fix", ColumnLength_1.default.ShortText);
|
|
209
|
+
const description = cut(`Written from the fix OneUptime AI ran for ${nameSubject(input.subject)}${subjectTitle ? ` (${subjectTitle})` : ""}, which was verified when it recovered. Turned off until someone reviews each step and turns it on.`, ColumnLength_1.default.LongText);
|
|
210
|
+
return { name, description, steps };
|
|
211
|
+
}
|
|
212
|
+
/*
|
|
213
|
+
* A name no runbook of the project has yet: the name itself, or with " (2)",
|
|
214
|
+
* " (3)" ... after it, cut so the whole stays within a runbook's name.
|
|
215
|
+
*/
|
|
216
|
+
function getUniqueRunbookName(name, takenNames) {
|
|
217
|
+
const taken = new Set(takenNames.map((taken) => {
|
|
218
|
+
return taken.trim().toLowerCase();
|
|
219
|
+
}));
|
|
220
|
+
if (!taken.has(name.trim().toLowerCase())) {
|
|
221
|
+
return name;
|
|
222
|
+
}
|
|
223
|
+
for (let number = 2; number < 1000; number++) {
|
|
224
|
+
const suffix = ` (${number.toString()})`;
|
|
225
|
+
const candidate = `${cut(name, ColumnLength_1.default.ShortText - suffix.length)}${suffix}`;
|
|
226
|
+
if (!taken.has(candidate.toLowerCase())) {
|
|
227
|
+
return candidate;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return `${cut(name, ColumnLength_1.default.ShortText - 37)} ${ObjectID_1.default.generate().toString()}`;
|
|
231
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import commonJsModule from "./VerifiedFixRunbook.js";
|
|
2
|
+
export const MAX_VERIFIED_FIX_STEP_TITLE_LENGTH = commonJsModule.MAX_VERIFIED_FIX_STEP_TITLE_LENGTH;
|
|
3
|
+
export const VERIFIED_FIX_RUNBOOK_REFUSAL_MESSAGES = commonJsModule.VERIFIED_FIX_RUNBOOK_REFUSAL_MESSAGES;
|
|
4
|
+
export const VerifiedFixRunbookRefusal = commonJsModule.VerifiedFixRunbookRefusal;
|
|
5
|
+
export const buildVerifiedFixRunbook = commonJsModule.buildVerifiedFixRunbook;
|
|
6
|
+
export const getSucceededCommands = commonJsModule.getSucceededCommands;
|
|
7
|
+
export const getSucceededMcpCalls = commonJsModule.getSucceededMcpCalls;
|
|
8
|
+
export const getUniqueRunbookName = commonJsModule.getUniqueRunbookName;
|
|
9
|
+
export const getVerifiedFixRunbookRefusal = commonJsModule.getVerifiedFixRunbookRefusal;
|
|
10
|
+
export const toRunbookSteps = commonJsModule.toRunbookSteps;
|
|
@@ -661,7 +661,12 @@ const DASHBOARD_WIDGET_SORT_SPECS = {
|
|
|
661
661
|
title: "Used / Provisioned",
|
|
662
662
|
path: "usedBytes",
|
|
663
663
|
}),
|
|
664
|
-
|
|
664
|
+
// The storage array's own key, as the header's (#7522, MeaningKeys).
|
|
665
|
+
textColumn({
|
|
666
|
+
key: "array",
|
|
667
|
+
title: "Array (storage array)",
|
|
668
|
+
path: "storageArray.name",
|
|
669
|
+
}),
|
|
665
670
|
],
|
|
666
671
|
defaultSort: NAME_ASCENDING,
|
|
667
672
|
thenBy: BY_NAME,
|
|
@@ -679,7 +684,11 @@ const DASHBOARD_WIDGET_SORT_SPECS = {
|
|
|
679
684
|
path: ["kind", "componentType"],
|
|
680
685
|
}),
|
|
681
686
|
storageHardwareStatusColumn(),
|
|
682
|
-
textColumn({
|
|
687
|
+
textColumn({
|
|
688
|
+
key: "array",
|
|
689
|
+
title: "Array (storage array)",
|
|
690
|
+
path: "storageArray.name",
|
|
691
|
+
}),
|
|
683
692
|
],
|
|
684
693
|
defaultSort: NAME_ASCENDING,
|
|
685
694
|
thenBy: BY_NAME,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Color from "../../Types/Color.mjs";
|
|
2
|
+
import ObjectID from "../../Types/ObjectID.mjs";
|
|
2
3
|
import { MonitoringOffFlags } from "../Monitor/MonitoringOff.mjs";
|
|
3
4
|
export declare const MONITOR_LIST_STATUS_FILTER_OPERATIONAL: string;
|
|
4
5
|
export declare const MONITOR_LIST_STATUS_FILTER_NON_OPERATIONAL: string;
|
|
@@ -10,7 +11,7 @@ export interface MonitorListFilter {
|
|
|
10
11
|
statusFilter?: string | undefined | null;
|
|
11
12
|
monitorStatusIds?: Array<string> | undefined | null;
|
|
12
13
|
}
|
|
13
|
-
export type GetMonitorListQueryFunction = (filter: MonitorListFilter) => Record<string, unknown>;
|
|
14
|
+
export type GetMonitorListQueryFunction = (filter: MonitorListFilter, projectId?: ObjectID | string | null | undefined) => Record<string, unknown>;
|
|
14
15
|
export declare const getMonitorListQuery: GetMonitorListQueryFunction;
|
|
15
16
|
export interface MonitorListRowData extends MonitoringOffFlags {
|
|
16
17
|
currentMonitorStatus?: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Color from "../../Types/Color";
|
|
2
|
+
import ObjectID from "../../Types/ObjectID";
|
|
2
3
|
import { MonitoringOffFlags } from "../Monitor/MonitoringOff";
|
|
3
4
|
export declare const MONITOR_LIST_STATUS_FILTER_OPERATIONAL: string;
|
|
4
5
|
export declare const MONITOR_LIST_STATUS_FILTER_NON_OPERATIONAL: string;
|
|
@@ -10,7 +11,7 @@ export interface MonitorListFilter {
|
|
|
10
11
|
statusFilter?: string | undefined | null;
|
|
11
12
|
monitorStatusIds?: Array<string> | undefined | null;
|
|
12
13
|
}
|
|
13
|
-
export type GetMonitorListQueryFunction = (filter: MonitorListFilter) => Record<string, unknown>;
|
|
14
|
+
export type GetMonitorListQueryFunction = (filter: MonitorListFilter, projectId?: ObjectID | string | null | undefined) => Record<string, unknown>;
|
|
14
15
|
export declare const getMonitorListQuery: GetMonitorListQueryFunction;
|
|
15
16
|
export interface MonitorListRowData extends MonitoringOffFlags {
|
|
16
17
|
currentMonitorStatus?: {
|
|
@@ -16,7 +16,9 @@ const NotOperationalMonitorQuery_1 = __importDefault(require("../Monitor/NotOper
|
|
|
16
16
|
* The widget in the browser and the public-dashboard policy on the server
|
|
17
17
|
* (Server/Utils/Dashboard/PublicDashboardResourceListPolicy) both build their
|
|
18
18
|
* query from getMonitorListQuery, so a board and its public page cannot list
|
|
19
|
-
* different monitors.
|
|
19
|
+
* different monitors. The board passes its project as well, which names the
|
|
20
|
+
* same monitors and reads them differently (getMonitorListQuery). React-free
|
|
21
|
+
* and server-safe.
|
|
20
22
|
*
|
|
21
23
|
* A monitor whose monitoring is turned off is not checked, so its status is
|
|
22
24
|
* frozen at what its last check saw (Utils/Monitor/MonitoringOff). The list
|
|
@@ -38,10 +40,10 @@ exports.MONITOR_LIST_MONITORING_OFF_STATUS_LABEL = (0, Translator_1.translationK
|
|
|
38
40
|
exports.MONITOR_LIST_MONITORING_OFF_STATUS_COLOR = BrandColors_1.Gray500;
|
|
39
41
|
// The same word the row has always drawn for a monitor read with no status.
|
|
40
42
|
exports.MONITOR_LIST_NO_STATUS_LABEL = "Unknown";
|
|
41
|
-
const getMonitorListQuery = (filter) => {
|
|
43
|
+
const getMonitorListQuery = (filter, projectId) => {
|
|
42
44
|
const query = { isArchived: false };
|
|
43
45
|
if (filter.statusFilter === exports.MONITOR_LIST_STATUS_FILTER_NON_OPERATIONAL) {
|
|
44
|
-
Object.assign(query, NotOperationalMonitorQuery_1.default.getQuery());
|
|
46
|
+
Object.assign(query, NotOperationalMonitorQuery_1.default.getQuery(projectId));
|
|
45
47
|
}
|
|
46
48
|
else if (filter.statusFilter === exports.MONITOR_LIST_STATUS_FILTER_OPERATIONAL) {
|
|
47
49
|
Object.assign(query, MonitoringOff_1.default.getMonitoredQuery(), {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TemplateValue, TermOptions, Translator } from "../Types/Translator.mjs";
|
|
2
|
+
export declare const getDefaultRecordNames: (tableName: string | null | undefined) => ReadonlyArray<string>;
|
|
3
|
+
export declare const isDefaultRecordName: (tableName: string | null | undefined, name: string | null | undefined) => boolean;
|
|
4
|
+
export declare const isRecordNameAsWritten: (tableName: string | null | undefined, name: string | null | undefined) => boolean;
|
|
5
|
+
export declare const translateRecordName: (translator: Translator, tableName: string | null | undefined, name: string | null | undefined) => string;
|
|
6
|
+
export declare const recordNameInSentence: (tableName: string | null | undefined, name: string | null | undefined, options?: TermOptions) => TemplateValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TemplateValue, TermOptions, Translator } from "../Types/Translator";
|
|
2
|
+
export declare const getDefaultRecordNames: (tableName: string | null | undefined) => ReadonlyArray<string>;
|
|
3
|
+
export declare const isDefaultRecordName: (tableName: string | null | undefined, name: string | null | undefined) => boolean;
|
|
4
|
+
export declare const isRecordNameAsWritten: (tableName: string | null | undefined, name: string | null | undefined) => boolean;
|
|
5
|
+
export declare const translateRecordName: (translator: Translator, tableName: string | null | undefined, name: string | null | undefined) => string;
|
|
6
|
+
export declare const recordNameInSentence: (tableName: string | null | undefined, name: string | null | undefined, options?: TermOptions) => TemplateValue;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordNameInSentence = exports.translateRecordName = exports.isRecordNameAsWritten = exports.isDefaultRecordName = exports.getDefaultRecordNames = void 0;
|
|
4
|
+
const DefaultStatusNames_1 = require("../Types/StatusPage/DefaultStatusNames");
|
|
5
|
+
const Translator_1 = require("../Types/Translator");
|
|
6
|
+
const StateListType_1 = require("./StateListType");
|
|
7
|
+
/*
|
|
8
|
+
* A RECORD'S NAME, AS ITS READER READS IT - ONE RULE, WHEREVER IT IS DRAWN.
|
|
9
|
+
*
|
|
10
|
+
* A record's name is its owner's: a label, a monitor, a probe, a template,
|
|
11
|
+
* a state or a severity a project made. It is drawn as written in every
|
|
12
|
+
* language - a label named "Network" is "Network" on a Spanish page, never
|
|
13
|
+
* "Red" - in a badge (Pill, StatusBubble), in a picker's options and in a
|
|
14
|
+
* filter's menu and chip (DropdownOption.isUserContent), as a line of text
|
|
15
|
+
* (translateRecordName) and in a sentence (recordNameInSentence).
|
|
16
|
+
*
|
|
17
|
+
* The records a new project starts with that OneUptime names itself
|
|
18
|
+
* (ProjectService) are the exception: its states, severities, monitor
|
|
19
|
+
* statuses, postmortem statuses and security case priorities and statuses,
|
|
20
|
+
* the lists a project orders (StateListType, whose values are the tables'
|
|
21
|
+
* names). Their default names are OneUptime's words, read in the reader's
|
|
22
|
+
* language - "Resolved" is "Resuelto" - for as long as a record keeps one.
|
|
23
|
+
* A name the project gave a record of its own, or gave a default one in its
|
|
24
|
+
* place, is the project's and reads as written: a state named "Open" stays
|
|
25
|
+
* "Open", never the verb "Abrir", and a severity renamed "Critical" stays
|
|
26
|
+
* "Critical", never "Kritisch".
|
|
27
|
+
*
|
|
28
|
+
* A name is a default by its record's table and by the whole name, as
|
|
29
|
+
* written: an alert severity named "High" is OneUptime's word, a monitor
|
|
30
|
+
* status named "High" the project's, and "Critical incident" is a severity
|
|
31
|
+
* the project renamed. Nothing a record carries says whether OneUptime or
|
|
32
|
+
* the project made it (a severity has no built-in flag, both get the same
|
|
33
|
+
* kind of slug, and a badge is handed a name and a colour), so a project's
|
|
34
|
+
* own record named exactly as a default of its list reads as that default
|
|
35
|
+
* does - the same word the status page and the notifications use for it.
|
|
36
|
+
* A status page (StatusPage/src/Utils/StatusTranslation), an on-call page
|
|
37
|
+
* (OnCallDutyPolicy/OnCallPageWords) and a status page's notifications
|
|
38
|
+
* (Server/Utils/StatusPage/SubscriberMessageText) decide by this rule too,
|
|
39
|
+
* each handed its record's list (#8066).
|
|
40
|
+
*/
|
|
41
|
+
/*
|
|
42
|
+
* Every list a project orders has the names it starts with. Only names:
|
|
43
|
+
* every form loads this, so it loads none of the lists' own modules
|
|
44
|
+
* (StateOrder, PostmortemStatus, SecurityCaseStatuses and _Priorities).
|
|
45
|
+
*/
|
|
46
|
+
const DEFAULT_NAMES_BY_TABLE = {
|
|
47
|
+
[StateListType_1.StateListType.IncidentState]: DefaultStatusNames_1.DEFAULT_INCIDENT_STATE_NAMES,
|
|
48
|
+
[StateListType_1.StateListType.AlertState]: DefaultStatusNames_1.DEFAULT_ALERT_STATE_NAMES,
|
|
49
|
+
[StateListType_1.StateListType.ScheduledMaintenanceState]: DefaultStatusNames_1.DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES,
|
|
50
|
+
[StateListType_1.StateListType.MonitorStatus]: DefaultStatusNames_1.DEFAULT_MONITOR_STATUS_NAMES,
|
|
51
|
+
[StateListType_1.StateListType.IncidentSeverity]: DefaultStatusNames_1.DEFAULT_INCIDENT_SEVERITY_NAMES,
|
|
52
|
+
[StateListType_1.StateListType.AlertSeverity]: DefaultStatusNames_1.DEFAULT_ALERT_SEVERITY_NAMES,
|
|
53
|
+
[StateListType_1.StateListType.IncidentPostmortemStatus]: DefaultStatusNames_1.DEFAULT_POSTMORTEM_STATUS_NAMES,
|
|
54
|
+
[StateListType_1.StateListType.SecurityCaseStatus]: DefaultStatusNames_1.DEFAULT_SECURITY_CASE_STATUS_NAMES,
|
|
55
|
+
[StateListType_1.StateListType.SecurityCasePriority]: DefaultStatusNames_1.DEFAULT_SECURITY_CASE_PRIORITY_NAMES,
|
|
56
|
+
};
|
|
57
|
+
/*
|
|
58
|
+
* The names OneUptime gives the records of a table: a StateListType, or a
|
|
59
|
+
* record's own tableName. None for any other table - a label's, a
|
|
60
|
+
* monitor's, a team's - whose names are all their owners'.
|
|
61
|
+
*/
|
|
62
|
+
const getDefaultRecordNames = (tableName) => {
|
|
63
|
+
if (!tableName ||
|
|
64
|
+
!Object.prototype.hasOwnProperty.call(DEFAULT_NAMES_BY_TABLE, tableName)) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
return DEFAULT_NAMES_BY_TABLE[tableName];
|
|
68
|
+
};
|
|
69
|
+
exports.getDefaultRecordNames = getDefaultRecordNames;
|
|
70
|
+
// Whether `name` is one of OneUptime's default names for its table's records.
|
|
71
|
+
const isDefaultRecordName = (tableName, name) => {
|
|
72
|
+
return (typeof name === "string" &&
|
|
73
|
+
(0, exports.getDefaultRecordNames)(tableName).includes(name.trim()));
|
|
74
|
+
};
|
|
75
|
+
exports.isDefaultRecordName = isDefaultRecordName;
|
|
76
|
+
/*
|
|
77
|
+
* Whether a record's name is drawn as written, never looked up: a Pill's
|
|
78
|
+
* or a StatusBubble's isUserContent, a DropdownOption's. True for a name its
|
|
79
|
+
* owner gave; false for one of OneUptime's default names, and for no name
|
|
80
|
+
* at all - a badge's "Unknown" in its place is the product's word.
|
|
81
|
+
*/
|
|
82
|
+
const isRecordNameAsWritten = (tableName, name) => {
|
|
83
|
+
return (typeof name === "string" &&
|
|
84
|
+
name.trim().length > 0 &&
|
|
85
|
+
!(0, exports.isDefaultRecordName)(tableName, name));
|
|
86
|
+
};
|
|
87
|
+
exports.isRecordNameAsWritten = isRecordNameAsWritten;
|
|
88
|
+
/*
|
|
89
|
+
* A record's name in `translator`'s reader's words, for where it is drawn
|
|
90
|
+
* as text: a default name in their language, any other name as written.
|
|
91
|
+
*/
|
|
92
|
+
const translateRecordName = (translator, tableName, name) => {
|
|
93
|
+
if (!name) {
|
|
94
|
+
return "";
|
|
95
|
+
}
|
|
96
|
+
if (!(0, exports.isDefaultRecordName)(tableName, name)) {
|
|
97
|
+
return name;
|
|
98
|
+
}
|
|
99
|
+
return translator.translateText(name.trim()) || name;
|
|
100
|
+
};
|
|
101
|
+
exports.translateRecordName = translateRecordName;
|
|
102
|
+
/*
|
|
103
|
+
* A record's name as a value of a sentence - "{{stateName}} in", "Mark as
|
|
104
|
+
* {{state}}", "Incident · {{severity}}" - by the same rule. One of
|
|
105
|
+
* OneUptime's default names of its table goes in as a term, translated
|
|
106
|
+
* with the sentence and only then (Types/Translator): a sentence the
|
|
107
|
+
* reader's language words reads "Marcar como Resuelto", one it does not
|
|
108
|
+
* yet reads "Mark as Resolved" whole, and `inSentence` cases the name for
|
|
109
|
+
* the middle of one ("Not yet resolved"). Any other name goes in as
|
|
110
|
+
* written, never looked up: a state a project named "Open" reads "Marcar
|
|
111
|
+
* como Open", never the verb "Abrir", in any language and in any case.
|
|
112
|
+
*/
|
|
113
|
+
const recordNameInSentence = (tableName, name, options) => {
|
|
114
|
+
if (!name) {
|
|
115
|
+
return "";
|
|
116
|
+
}
|
|
117
|
+
if (!(0, exports.isDefaultRecordName)(tableName, name)) {
|
|
118
|
+
return name;
|
|
119
|
+
}
|
|
120
|
+
return (0, Translator_1.translatableTerm)(name.trim(), options);
|
|
121
|
+
};
|
|
122
|
+
exports.recordNameInSentence = recordNameInSentence;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import commonJsModule from "./DefaultRecordNames.js";
|
|
2
|
+
export const getDefaultRecordNames = commonJsModule.getDefaultRecordNames;
|
|
3
|
+
export const isDefaultRecordName = commonJsModule.isDefaultRecordName;
|
|
4
|
+
export const isRecordNameAsWritten = commonJsModule.isRecordNameAsWritten;
|
|
5
|
+
export const recordNameInSentence = commonJsModule.recordNameInSentence;
|
|
6
|
+
export const translateRecordName = commonJsModule.translateRecordName;
|
package/Utils/Grok/Grok.js
CHANGED
|
@@ -15,6 +15,7 @@ const BadDataException_1 = __importDefault(require("../../Types/Exception/BadDat
|
|
|
15
15
|
const LinearRegExp_1 = __importDefault(require("../LinearRegExp/LinearRegExp"));
|
|
16
16
|
const PatternProblem_1 = require("../LinearRegExp/PatternProblem");
|
|
17
17
|
const PatternWork_1 = require("../LinearRegExp/PatternWork");
|
|
18
|
+
const LookupTable_1 = require("../LookupTable");
|
|
18
19
|
const GrokPatterns_1 = __importDefault(require("./GrokPatterns"));
|
|
19
20
|
/*
|
|
20
21
|
* Grok engine.
|
|
@@ -125,7 +126,8 @@ function resolveReference(match, context) {
|
|
|
125
126
|
if (context.expansions > exports.MAX_GROK_EXPANSIONS) {
|
|
126
127
|
throw new BadDataException_1.default(`This grok pattern expands to more than ${exports.MAX_GROK_EXPANSIONS} sub-patterns. Please simplify it.`);
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
+
// A library's own names only: %{constructor} names no pattern.
|
|
130
|
+
const definition = (0, LookupTable_1.readOwnValue)(context.patterns, patternName);
|
|
129
131
|
if (definition === undefined) {
|
|
130
132
|
throw new BadDataException_1.default(`Unknown grok pattern "%{${patternName}}". Check the list of supported patterns.`);
|
|
131
133
|
}
|
|
@@ -311,12 +313,13 @@ function matchGrokPattern(compiled, input) {
|
|
|
311
313
|
* The same field name can legitimately appear twice (alternation
|
|
312
314
|
* branches, or a library pattern that already names it). Whichever
|
|
313
315
|
* group actually matched first wins, so a later branch that did not
|
|
314
|
-
* participate cannot blank out a real value.
|
|
316
|
+
* participate cannot blank out a real value. Own fields only, and
|
|
317
|
+
* written as own: a field may be named constructor or __proto__.
|
|
315
318
|
*/
|
|
316
|
-
if (extracted
|
|
319
|
+
if (Object.prototype.hasOwnProperty.call(extracted, capture.fieldName)) {
|
|
317
320
|
continue;
|
|
318
321
|
}
|
|
319
|
-
extracted
|
|
322
|
+
(0, LookupTable_1.writeOwnValue)(extracted, capture.fieldName, coerceValue(raw, capture.fieldType));
|
|
320
323
|
}
|
|
321
324
|
return extracted;
|
|
322
325
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum ActionItemCodeTaskKind {
|
|
2
|
+
PullRequest = "PullRequest",
|
|
3
|
+
Test = "Test"
|
|
4
|
+
}
|
|
5
|
+
export declare const ALL_ACTION_ITEM_CODE_TASK_KINDS: ReadonlyArray<ActionItemCodeTaskKind>;
|
|
6
|
+
export declare const MAX_ACTION_ITEM_REQUEST_LENGTH: number;
|
|
7
|
+
export declare const MAX_ACTION_ITEM_DESCRIPTION_IN_REQUEST: number;
|
|
8
|
+
export declare const MAX_ACTION_ITEM_INSTRUCTIONS_LENGTH: number;
|
|
9
|
+
export declare const MAX_POSTMORTEM_IN_CONTEXT: number;
|
|
10
|
+
export interface ActionItemCodeTaskRequestInput {
|
|
11
|
+
kind: ActionItemCodeTaskKind;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string | null | undefined;
|
|
14
|
+
incidentNumber?: string | null | undefined;
|
|
15
|
+
incidentTitle?: string | null | undefined;
|
|
16
|
+
instructions?: string | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseActionItemCodeTaskKind(value: unknown): ActionItemCodeTaskKind | null;
|
|
19
|
+
export declare function buildActionItemCodeTaskRequest(input: ActionItemCodeTaskRequestInput): string;
|
|
20
|
+
export declare function getPostmortemContextNote(postmortemNote: string | null | undefined): string | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum ActionItemCodeTaskKind {
|
|
2
|
+
PullRequest = "PullRequest",
|
|
3
|
+
Test = "Test"
|
|
4
|
+
}
|
|
5
|
+
export declare const ALL_ACTION_ITEM_CODE_TASK_KINDS: ReadonlyArray<ActionItemCodeTaskKind>;
|
|
6
|
+
export declare const MAX_ACTION_ITEM_REQUEST_LENGTH: number;
|
|
7
|
+
export declare const MAX_ACTION_ITEM_DESCRIPTION_IN_REQUEST: number;
|
|
8
|
+
export declare const MAX_ACTION_ITEM_INSTRUCTIONS_LENGTH: number;
|
|
9
|
+
export declare const MAX_POSTMORTEM_IN_CONTEXT: number;
|
|
10
|
+
export interface ActionItemCodeTaskRequestInput {
|
|
11
|
+
kind: ActionItemCodeTaskKind;
|
|
12
|
+
title: string;
|
|
13
|
+
description?: string | null | undefined;
|
|
14
|
+
incidentNumber?: string | null | undefined;
|
|
15
|
+
incidentTitle?: string | null | undefined;
|
|
16
|
+
instructions?: string | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseActionItemCodeTaskKind(value: unknown): ActionItemCodeTaskKind | null;
|
|
19
|
+
export declare function buildActionItemCodeTaskRequest(input: ActionItemCodeTaskRequestInput): string;
|
|
20
|
+
export declare function getPostmortemContextNote(postmortemNote: string | null | undefined): string | null;
|