@oneuptime/common 14.0.102 → 14.0.103
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/Index.js +6 -0
- package/Models/DatabaseModels/LogSavedView.d.mts +1 -0
- package/Models/DatabaseModels/LogSavedView.d.ts +1 -0
- package/Models/DatabaseModels/LogSavedView.js +43 -1
- package/Models/DatabaseModels/NetworkControllerConnection.d.mts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.d.ts +1 -0
- package/Models/DatabaseModels/NetworkControllerConnection.js +21 -0
- package/Models/DatabaseModels/Project.d.mts +3 -0
- package/Models/DatabaseModels/Project.d.ts +3 -0
- package/Models/DatabaseModels/Project.js +124 -0
- package/Models/DatabaseModels/Runner.d.mts +1 -0
- package/Models/DatabaseModels/Runner.d.ts +1 -0
- package/Models/DatabaseModels/Runner.js +40 -0
- package/Models/DatabaseModels/SecurityCase.d.mts +2 -1
- package/Models/DatabaseModels/SecurityCase.d.ts +2 -1
- package/Models/DatabaseModels/SecurityCase.js +27 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.mts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.d.ts +20 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.js +387 -0
- package/Models/DatabaseModels/SecurityCaseCustomField.mjs +2 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.mts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.ts +15 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.js +309 -0
- package/Models/DatabaseModels/SecurityCaseNoteTemplate.mjs +2 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.mts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.d.ts +11 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.js +186 -0
- package/Models/DatabaseModels/WorkspaceHomeChoice.mjs +2 -0
- package/Types/AI/AIFixReadiness.d.mts +2 -0
- package/Types/AI/AIFixReadiness.d.ts +2 -0
- package/Types/AI/AIFixReadiness.js +0 -6
- package/Types/AI/CodeTask.d.mts +3 -1
- package/Types/AI/CodeTask.d.ts +3 -1
- package/Types/AI/CodeTask.js +12 -0
- package/Types/CustomField/CustomFieldRecordKinds.js +5 -0
- package/Types/CustomField/CustomFieldSavedViews.js +2 -0
- package/Types/DateLanguage.js +3 -2
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.mts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.ts +1 -0
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.js +84 -6
- package/Types/DockerSwarm/DockerSwarmInventoryExtractor.mjs +1 -0
- package/Types/InstallScripts/InstallScripts.d.mts +1 -0
- package/Types/InstallScripts/InstallScripts.d.ts +1 -0
- package/Types/InstallScripts/InstallScripts.js +14 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.mts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.d.ts +15 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.js +168 -0
- package/Types/Monitor/DockerSwarmAlertTemplates.mjs +1 -0
- package/Types/Monitor/DockerSwarmMetricCatalog.d.mts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.d.ts +1 -1
- package/Types/Monitor/DockerSwarmMetricCatalog.js +43 -11
- package/Types/Monitor/SeriesContext/SeriesDebugHints.js +19 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.mts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.d.ts +70 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.js +389 -0
- package/Types/NetworkController/NetworkControllerDeviceAdd.mjs +26 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.js +6 -1
- package/Types/NetworkDevice/NetworkTopologyLayout.d.mts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.d.ts +8 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.js +49 -0
- package/Types/NetworkDevice/NetworkTopologyLayout.mjs +3 -0
- package/Types/Permission.d.mts +8 -0
- package/Types/Permission.d.ts +8 -0
- package/Types/Permission.js +87 -3
- package/Types/PushNotification/PushNotificationCategory.d.mts +3 -0
- package/Types/PushNotification/PushNotificationCategory.d.ts +3 -0
- package/Types/PushNotification/PushNotificationCategory.js +38 -0
- package/Types/PushNotification/PushNotificationCategory.mjs +4 -0
- package/Types/PushNotification/PushNotificationMessage.d.mts +1 -0
- package/Types/PushNotification/PushNotificationMessage.d.ts +1 -0
- package/Types/Runner/RunnerCodeFixes.d.mts +22 -0
- package/Types/Runner/RunnerCodeFixes.d.ts +22 -0
- package/Types/Runner/RunnerCodeFixes.js +129 -0
- package/Types/Runner/RunnerCodeFixes.mjs +9 -0
- package/Types/SecurityCase/SecurityCaseNumber.js +8 -4
- package/Types/SecurityEvent/MitreAttack.d.mts +2 -0
- package/Types/SecurityEvent/MitreAttack.d.ts +2 -0
- package/Types/SecurityEvent/MitreAttack.js +26 -0
- package/Types/SecurityEvent/MitreAttack.mjs +2 -0
- package/Types/SecurityEvent/OcsfSeverity.js +10 -1
- package/Types/Telemetry/TelemetrySearchQuery.js +14 -2
- package/Types/Workspace/WorkspaceMessagePayload.d.mts +7 -0
- package/Types/Workspace/WorkspaceMessagePayload.d.ts +7 -0
- package/Utils/CronScheduleText.d.mts +3 -0
- package/Utils/CronScheduleText.d.ts +3 -0
- package/Utils/CronScheduleText.js +307 -0
- package/Utils/CronScheduleText.mjs +3 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.mts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.d.ts +2 -0
- package/Utils/Dashboard/DashboardBoardLayout.js +17 -4
- package/Utils/Dashboard/DashboardBoardLayout.mjs +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.mts +114 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +114 -0
- package/Utils/DeveloperDocs/CliCommands.js +750 -0
- package/Utils/DeveloperDocs/CliCommands.mjs +37 -0
- package/Utils/DeveloperDocs/CliExamples.d.mts +59 -0
- package/Utils/DeveloperDocs/CliExamples.d.ts +59 -0
- package/Utils/DeveloperDocs/CliExamples.js +348 -0
- package/Utils/DeveloperDocs/CliExamples.mjs +17 -0
- package/Utils/DeveloperDocs/CliResources.d.mts +18 -0
- package/Utils/DeveloperDocs/CliResources.d.ts +18 -0
- package/Utils/DeveloperDocs/CliResources.js +129 -0
- package/Utils/DeveloperDocs/CliResources.mjs +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.mts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.d.ts +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +27 -2
- package/Utils/DeveloperDocs/ExampleBuilder.mjs +1 -0
- package/Utils/DeveloperDocs/PageLookups.d.mts +1 -1
- package/Utils/DeveloperDocs/PageLookups.d.ts +1 -1
- package/Utils/DeveloperDocs/PageLookups.js +9 -2
- package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +44 -0
- package/Utils/LookupTable.mjs +4 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +62 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.js +484 -0
- package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +39 -0
- package/Utils/Monitor/MonitorOverviewFamily.js +207 -0
- package/Utils/Monitor/MonitorOverviewFamily.mjs +4 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +192 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +1659 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +5 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +112 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +640 -0
- package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +3 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +1 -1
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +1 -1
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +27 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +132 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +2 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +44 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +487 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +2 -0
- package/Utils/OldestKeyMap.d.mts +10 -0
- package/Utils/OldestKeyMap.d.ts +10 -0
- package/Utils/OldestKeyMap.js +91 -0
- package/Utils/OldestKeyMap.mjs +2 -0
- package/Utils/Project/NextNumber.d.mts +4 -3
- package/Utils/Project/NextNumber.d.ts +4 -3
- package/Utils/Project/NextNumber.js +11 -2
- package/Utils/Project/NumberPrefix.d.mts +1 -1
- package/Utils/Project/NumberPrefix.d.ts +1 -1
- package/Utils/Project/NumberPrefix.js +12 -0
- package/Utils/Schema/AnalyticsModelSchema.d.mts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.d.ts +48 -0
- package/Utils/Schema/AnalyticsModelSchema.js +767 -0
- package/Utils/Schema/AnalyticsModelSchema.mjs +2 -0
- package/Utils/Schema/BaseSchema.d.mts +117 -0
- package/Utils/Schema/BaseSchema.d.ts +117 -0
- package/Utils/Schema/BaseSchema.js +257 -0
- package/Utils/Schema/BaseSchema.mjs +3 -0
- package/Utils/Schema/ModelSchema.d.mts +80 -0
- package/Utils/Schema/ModelSchema.d.ts +80 -0
- package/Utils/Schema/ModelSchema.js +1727 -0
- package/Utils/Schema/ModelSchema.mjs +2 -0
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.mts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.ts +0 -1
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.js +9 -25
- package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.mjs +0 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.js +10 -9
- package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.js +4 -3
- package/Utils/SecurityEvent/Connectors/MicrosoftDefenderXdrNormalizer.js +12 -28
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.mts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.ts +1 -1
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.js +13 -24
- package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.mjs +1 -1
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.mts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.ts +2 -2
- package/Utils/SecurityEvent/Connectors/OktaNormalizer.js +7 -6
- package/Utils/SecurityEvent/Connectors/SplunkNormalizer.js +7 -26
- package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.js +4 -3
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.mts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.ts +2 -2
- package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.js +26 -16
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.mts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.ts +1 -1
- package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.js +10 -6
- package/Utils/SecurityEvent/SecurityEventNormalizer.js +17 -11
- package/Utils/SecurityEvent/SecurityEventSearch.js +8 -1
- package/Utils/SecurityEvent/Sigma/SigmaRuleSetParser.js +4 -5
- package/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js +7 -3
- package/Utils/SecurityEvent/UdmNormalizer.js +10 -6
- package/Utils/Telemetry/SavedViewDefault.js +4 -3
- package/Utils/Telemetry/SavedViewScope.d.mts +33 -0
- package/Utils/Telemetry/SavedViewScope.d.ts +33 -0
- package/Utils/Telemetry/SavedViewScope.js +105 -0
- package/Utils/Telemetry/SavedViewScope.mjs +7 -0
- package/package.json +1 -11
- package/UI/Utils/TranslateTemplate.d.mts +0 -8
- package/UI/Utils/TranslateTemplate.d.ts +0 -8
|
@@ -0,0 +1,307 @@
|
|
|
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.describeCronSchedule = exports.MAX_YEARLY_DATES_IN_WORDS = void 0;
|
|
7
|
+
const CronTab_1 = __importDefault(require("./CronTab"));
|
|
8
|
+
const DateLanguage_1 = require("../Types/DateLanguage");
|
|
9
|
+
const Translator_1 = require("../Types/Translator");
|
|
10
|
+
/*
|
|
11
|
+
* A cron schedule in words, in a reader's language: "Alle 5 Minuten", "Jede
|
|
12
|
+
* Woche am Montag und Freitag um 09:30 (UTC)".
|
|
13
|
+
*
|
|
14
|
+
* CronTab says what shape a schedule has (getScheduleShape) and words it in
|
|
15
|
+
* English (getHumanReadableDescription). Here each shape's sentence is looked
|
|
16
|
+
* up whole in the reader's locale, the way every other sentence is
|
|
17
|
+
* (Common/Types/Translator), and the names in it - weekdays, the
|
|
18
|
+
* days of a month - are written the way the sentence's language writes them,
|
|
19
|
+
* from the browser's Intl data, as dates are (Common/Types/DateLanguage). A
|
|
20
|
+
* sentence the reader's language has not worded yet reads in English, names
|
|
21
|
+
* and all.
|
|
22
|
+
*
|
|
23
|
+
* A schedule on given days of given months ("Jedes Jahr am 1. Januar um
|
|
24
|
+
* 00:00 (UTC)") names its dates as the language writes a date, so the day
|
|
25
|
+
* and the month take the case and order the language gives them; one that
|
|
26
|
+
* names more than MAX_YEARLY_DATES_IN_WORDS dates reads in English, as does
|
|
27
|
+
* one CronTab can only list field by field ("minute 5, 35, hour 3 (UTC)"),
|
|
28
|
+
* which is cron's own terms rather than a sentence.
|
|
29
|
+
*
|
|
30
|
+
* Without a translator, and in English, this is getHumanReadableDescription
|
|
31
|
+
* word for word. Null when the expression cannot be parsed.
|
|
32
|
+
*/
|
|
33
|
+
// 1 January 2023 was a Sunday: weekday 0.
|
|
34
|
+
const A_SUNDAY_MS = Date.UTC(2023, 0, 1);
|
|
35
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
36
|
+
const formatEach = (data) => {
|
|
37
|
+
try {
|
|
38
|
+
const format = new Intl.DateTimeFormat(data.locale, Object.assign(Object.assign({}, data.options), { timeZone: "UTC" }));
|
|
39
|
+
return data.values.map((value) => {
|
|
40
|
+
return format.format(data.toDate(value));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (_a) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// "Montag und Freitag", "lundi et vendredi", "月曜日と金曜日".
|
|
48
|
+
const joinInLocale = (items, locale) => {
|
|
49
|
+
try {
|
|
50
|
+
const ListFormat = Intl.ListFormat;
|
|
51
|
+
if (ListFormat) {
|
|
52
|
+
return new ListFormat(locale, {
|
|
53
|
+
type: "conjunction",
|
|
54
|
+
style: "long",
|
|
55
|
+
}).format(items);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (_a) {
|
|
59
|
+
// Joined with commas below.
|
|
60
|
+
}
|
|
61
|
+
return items.join(", ");
|
|
62
|
+
};
|
|
63
|
+
/*
|
|
64
|
+
* A list of names in the sentence's language: English as CronTab writes it
|
|
65
|
+
* when the sentence is English, the language's own names otherwise (and the
|
|
66
|
+
* English again where Intl cannot write them).
|
|
67
|
+
*/
|
|
68
|
+
const namesInSentence = (data) => {
|
|
69
|
+
return (0, Translator_1.composedValue)((sentence) => {
|
|
70
|
+
if ((0, DateLanguage_1.isEnglishDateLanguage)(sentence.language)) {
|
|
71
|
+
return data.english;
|
|
72
|
+
}
|
|
73
|
+
const locale = (0, DateLanguage_1.getDateLocale)(sentence.language);
|
|
74
|
+
// A language Intl does not know reads English.
|
|
75
|
+
if (locale.startsWith("en-")) {
|
|
76
|
+
return data.english;
|
|
77
|
+
}
|
|
78
|
+
const names = data.localized(locale);
|
|
79
|
+
return names && names.length > 0
|
|
80
|
+
? joinInLocale(names, locale)
|
|
81
|
+
: data.english;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/*
|
|
85
|
+
* A time of day or a minute as CronTab writes it ("09:00", "05"), in the
|
|
86
|
+
* digits of the sentence it is in: "۰۹:۰۰" in a Persian one, as the dates
|
|
87
|
+
* and counts beside it are written. English, or a language Intl does not
|
|
88
|
+
* know, keeps CronTab's own.
|
|
89
|
+
*/
|
|
90
|
+
const figuresInSentence = (english) => {
|
|
91
|
+
return (0, Translator_1.composedValue)((sentence) => {
|
|
92
|
+
if ((0, DateLanguage_1.isEnglishDateLanguage)(sentence.language)) {
|
|
93
|
+
return english;
|
|
94
|
+
}
|
|
95
|
+
const locale = (0, DateLanguage_1.getDateLocale)(sentence.language);
|
|
96
|
+
return locale.startsWith("en-")
|
|
97
|
+
? english
|
|
98
|
+
: (0, DateLanguage_1.writeDigitsInLocale)(english, locale);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
// "Monday and Friday", "Montag und Freitag".
|
|
102
|
+
const weekdaysInSentence = (weekdays) => {
|
|
103
|
+
return namesInSentence({
|
|
104
|
+
english: CronTab_1.default.describeWeekdays(weekdays),
|
|
105
|
+
localized: (locale) => {
|
|
106
|
+
return formatEach({
|
|
107
|
+
values: weekdays,
|
|
108
|
+
locale: locale,
|
|
109
|
+
options: { weekday: "long" },
|
|
110
|
+
toDate: (weekday) => {
|
|
111
|
+
return new Date(A_SUNDAY_MS + weekday * DAY_MS);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
/*
|
|
118
|
+
* What follows a day of the month where a language writes one: German's
|
|
119
|
+
* "15.", Japanese and Chinese "15日", Korean "15일". Spanish "15 de" and the
|
|
120
|
+
* like are a date's words, not the day's, and stay out.
|
|
121
|
+
*/
|
|
122
|
+
const DAY_OF_MONTH_MARKER = /^(\.|日|일)$/u;
|
|
123
|
+
/*
|
|
124
|
+
* A day of the month as the language writes it in a date: "15." in German,
|
|
125
|
+
* "15日" in Japanese, "15" in French. Intl has no format for a day on its
|
|
126
|
+
* own that does this ("15" in German), so the day is read out of a whole
|
|
127
|
+
* date with its marker.
|
|
128
|
+
*/
|
|
129
|
+
const formatDayOfMonth = (day, locale) => {
|
|
130
|
+
try {
|
|
131
|
+
const parts = new Intl.DateTimeFormat(locale, { day: "numeric", month: "long", timeZone: "UTC" }).formatToParts(new Date(Date.UTC(2023, 0, day)));
|
|
132
|
+
const index = parts.findIndex((part) => {
|
|
133
|
+
return part.type === "day";
|
|
134
|
+
});
|
|
135
|
+
if (index < 0) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const after = parts[index + 1];
|
|
139
|
+
const marker = after && after.type === "literal" ? after.value.trim() : "";
|
|
140
|
+
return (parts[index].value + (DAY_OF_MONTH_MARKER.test(marker) ? marker : ""));
|
|
141
|
+
}
|
|
142
|
+
catch (_a) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/*
|
|
147
|
+
* The most dates a yearly schedule names in another language before it is
|
|
148
|
+
* read in English, as CronTab lists it ("On the 1st and 15th of January
|
|
149
|
+
* and July"): a sentence that names eight dates is no easier to read.
|
|
150
|
+
*/
|
|
151
|
+
exports.MAX_YEARLY_DATES_IN_WORDS = 6;
|
|
152
|
+
// The sentence a yearly schedule is worded in, in a language that has it.
|
|
153
|
+
const EVERY_YEAR = (0, Translator_1.translationKey)("Every year on {{dates}} at {{time}} (UTC)");
|
|
154
|
+
/*
|
|
155
|
+
* A yearly schedule's dates as the language writes a day of a month:
|
|
156
|
+
* "1. Januar", "1 января", "1 de enero", "1月1日" - Intl puts the day and
|
|
157
|
+
* the month in the case and order the language's dates take, which a
|
|
158
|
+
* sentence built from a day and a month name could not. Every day of each
|
|
159
|
+
* month the schedule names, month by month; null when there are more than
|
|
160
|
+
* MAX_YEARLY_DATES_IN_WORDS of them, or Intl cannot write one.
|
|
161
|
+
*/
|
|
162
|
+
const yearlyDatesInLocale = (data) => {
|
|
163
|
+
if (data.daysOfMonth.length * data.months.length >
|
|
164
|
+
exports.MAX_YEARLY_DATES_IN_WORDS) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
const dates = [];
|
|
168
|
+
for (const month of data.months) {
|
|
169
|
+
for (const day of data.daysOfMonth) {
|
|
170
|
+
// A leap year, so a schedule on 29 February can be named.
|
|
171
|
+
const date = new Date(Date.UTC(2024, month - 1, day));
|
|
172
|
+
// A day the month does not have (31 April) never runs: no sentence.
|
|
173
|
+
if (date.getUTCMonth() !== month - 1) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
dates.push(date);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return formatEach({
|
|
180
|
+
values: dates.map((date) => {
|
|
181
|
+
return date.getTime();
|
|
182
|
+
}),
|
|
183
|
+
locale: data.locale,
|
|
184
|
+
options: { day: "numeric", month: "long" },
|
|
185
|
+
toDate: (time) => {
|
|
186
|
+
return new Date(time);
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
// "1st and 15th", "1. und 15.", "1日と15日".
|
|
191
|
+
const daysOfMonthInSentence = (days) => {
|
|
192
|
+
return namesInSentence({
|
|
193
|
+
english: CronTab_1.default.describeDaysOfMonth(days),
|
|
194
|
+
localized: (locale) => {
|
|
195
|
+
const names = [];
|
|
196
|
+
for (const day of days) {
|
|
197
|
+
const name = formatDayOfMonth(day, locale);
|
|
198
|
+
if (!name) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
names.push(name);
|
|
202
|
+
}
|
|
203
|
+
return names;
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
const describeShape = (data) => {
|
|
208
|
+
const shape = data.shape;
|
|
209
|
+
const t = data.translator;
|
|
210
|
+
switch (shape.kind) {
|
|
211
|
+
case "everyMinute":
|
|
212
|
+
return t.translateTemplate("Every minute");
|
|
213
|
+
case "everyMinutes":
|
|
214
|
+
/*
|
|
215
|
+
* Never 1 here (that is "Every minute"), but a language's "one" form
|
|
216
|
+
* also covers counts like 21 (Russian): "Каждую 21 минуту".
|
|
217
|
+
*/
|
|
218
|
+
return t.translatePlural({
|
|
219
|
+
one: "Every {{count}} minute",
|
|
220
|
+
other: "Every {{count}} minutes",
|
|
221
|
+
}, shape.step);
|
|
222
|
+
case "everyHourOnTheHour":
|
|
223
|
+
return t.translateTemplate("Every hour, on the hour");
|
|
224
|
+
case "everyHours": {
|
|
225
|
+
// "at minute 05", as CronTab writes it.
|
|
226
|
+
const minute = figuresInSentence(shape.minute < 10 ? `0${shape.minute}` : `${shape.minute}`);
|
|
227
|
+
if (shape.step === 1) {
|
|
228
|
+
return shape.minute === 0
|
|
229
|
+
? t.translateTemplate("Every hour")
|
|
230
|
+
: t.translateTemplate("Every hour at minute {{minute}}", {
|
|
231
|
+
minute: minute,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return shape.minute === 0
|
|
235
|
+
? t.translatePlural({ one: "Every {{count}} hour", other: "Every {{count}} hours" }, shape.step)
|
|
236
|
+
: t.translatePlural({
|
|
237
|
+
one: "Every {{count}} hour at minute {{minute}}",
|
|
238
|
+
other: "Every {{count}} hours at minute {{minute}}",
|
|
239
|
+
}, shape.step, { minute: minute });
|
|
240
|
+
}
|
|
241
|
+
case "daily":
|
|
242
|
+
return t.translateTemplate("Every day at {{time}} (UTC)", {
|
|
243
|
+
time: figuresInSentence(CronTab_1.default.describeTimeOfDay(shape.hour, shape.minute)),
|
|
244
|
+
});
|
|
245
|
+
case "weekly":
|
|
246
|
+
return t.translateTemplate("Every week on {{days}} at {{time}} (UTC)", {
|
|
247
|
+
days: weekdaysInSentence(shape.weekdays),
|
|
248
|
+
time: figuresInSentence(CronTab_1.default.describeTimeOfDay(shape.hour, shape.minute)),
|
|
249
|
+
});
|
|
250
|
+
case "monthly": {
|
|
251
|
+
const values = {
|
|
252
|
+
days: daysOfMonthInSentence(shape.daysOfMonth),
|
|
253
|
+
time: figuresInSentence(CronTab_1.default.describeTimeOfDay(shape.hour, shape.minute)),
|
|
254
|
+
};
|
|
255
|
+
return shape.monthStep === 1
|
|
256
|
+
? t.translateTemplate("Every month on the {{days}} at {{time}} (UTC)", values)
|
|
257
|
+
: t.translatePlural({
|
|
258
|
+
one: "Every {{count}} month on the {{days}} at {{time}} (UTC)",
|
|
259
|
+
other: "Every {{count}} months on the {{days}} at {{time}} (UTC)",
|
|
260
|
+
}, shape.monthStep, values);
|
|
261
|
+
}
|
|
262
|
+
case "yearly": {
|
|
263
|
+
/*
|
|
264
|
+
* Only in a language that words the sentence, and Intl writes the
|
|
265
|
+
* dates in: CronTab's English otherwise ("On the 1st of January at
|
|
266
|
+
* 00:00 (UTC)"), the dates English too.
|
|
267
|
+
*/
|
|
268
|
+
const locale = (0, DateLanguage_1.getDateLocale)(t.language);
|
|
269
|
+
if (!t.hasTranslation(EVERY_YEAR) ||
|
|
270
|
+
(0, DateLanguage_1.isEnglishDateLanguage)(t.language) ||
|
|
271
|
+
locale.startsWith("en-")) {
|
|
272
|
+
return data.english;
|
|
273
|
+
}
|
|
274
|
+
const dates = yearlyDatesInLocale({
|
|
275
|
+
daysOfMonth: shape.daysOfMonth,
|
|
276
|
+
months: shape.months,
|
|
277
|
+
locale: locale,
|
|
278
|
+
});
|
|
279
|
+
if (!dates || dates.length === 0) {
|
|
280
|
+
return data.english;
|
|
281
|
+
}
|
|
282
|
+
return t.translateTemplate(EVERY_YEAR, {
|
|
283
|
+
dates: joinInLocale(dates, locale),
|
|
284
|
+
time: (0, DateLanguage_1.writeDigitsInLocale)(CronTab_1.default.describeTimeOfDay(shape.hour, shape.minute), locale),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
default:
|
|
288
|
+
// Field by field: cron's own terms, in English.
|
|
289
|
+
return data.english;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const describeCronSchedule = (expression, translator) => {
|
|
293
|
+
const english = CronTab_1.default.getHumanReadableDescription(expression);
|
|
294
|
+
if (english === null || !translator) {
|
|
295
|
+
return english;
|
|
296
|
+
}
|
|
297
|
+
const shape = CronTab_1.default.getScheduleShape(expression);
|
|
298
|
+
if (!shape) {
|
|
299
|
+
return english;
|
|
300
|
+
}
|
|
301
|
+
return describeShape({
|
|
302
|
+
shape: shape,
|
|
303
|
+
english: english,
|
|
304
|
+
translator: translator,
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
exports.describeCronSchedule = describeCronSchedule;
|
|
@@ -7,6 +7,7 @@ export declare const DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX: number;
|
|
|
7
7
|
export declare const DASHBOARD_STACKED_BELOW_WIDTH_IN_PX: number;
|
|
8
8
|
export declare const DASHBOARD_MIN_EDIT_GRID_WIDTH_IN_PX: number;
|
|
9
9
|
export declare const DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX: number;
|
|
10
|
+
export declare const DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS: number;
|
|
10
11
|
export declare const DASHBOARD_CHART_COMPONENT_TYPES: ReadonlyArray<DashboardComponentType>;
|
|
11
12
|
export declare enum DashboardBoardArrangement {
|
|
12
13
|
Grid = "grid",
|
|
@@ -29,6 +30,7 @@ export interface DashboardBoardBox {
|
|
|
29
30
|
export interface DashboardStackedWidget {
|
|
30
31
|
heightInUnits: number;
|
|
31
32
|
componentType?: DashboardComponentType | string | undefined;
|
|
33
|
+
isPlaceholder?: boolean | undefined;
|
|
32
34
|
}
|
|
33
35
|
export default class DashboardBoardLayoutUtil {
|
|
34
36
|
static getLayout(data: {
|
|
@@ -7,6 +7,7 @@ export declare const DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX: number;
|
|
|
7
7
|
export declare const DASHBOARD_STACKED_BELOW_WIDTH_IN_PX: number;
|
|
8
8
|
export declare const DASHBOARD_MIN_EDIT_GRID_WIDTH_IN_PX: number;
|
|
9
9
|
export declare const DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX: number;
|
|
10
|
+
export declare const DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS: number;
|
|
10
11
|
export declare const DASHBOARD_CHART_COMPONENT_TYPES: ReadonlyArray<DashboardComponentType>;
|
|
11
12
|
export declare enum DashboardBoardArrangement {
|
|
12
13
|
Grid = "grid",
|
|
@@ -29,6 +30,7 @@ export interface DashboardBoardBox {
|
|
|
29
30
|
export interface DashboardStackedWidget {
|
|
30
31
|
heightInUnits: number;
|
|
31
32
|
componentType?: DashboardComponentType | string | undefined;
|
|
33
|
+
isPlaceholder?: boolean | undefined;
|
|
32
34
|
}
|
|
33
35
|
export default class DashboardBoardLayoutUtil {
|
|
34
36
|
static getLayout(data: {
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.DashboardBoardArrangement = exports.DASHBOARD_CHART_COMPONENT_TYPES = exports.DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX = exports.DASHBOARD_MIN_EDIT_GRID_WIDTH_IN_PX = exports.DASHBOARD_STACKED_BELOW_WIDTH_IN_PX = exports.DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX = exports.DASHBOARD_MIN_ROW_HEIGHT_IN_PX = exports.DASHBOARD_BOARD_COLUMNS = exports.DASHBOARD_BOARD_GAP_IN_PX = void 0;
|
|
39
|
+
exports.DashboardBoardArrangement = exports.DASHBOARD_CHART_COMPONENT_TYPES = exports.DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS = exports.DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX = exports.DASHBOARD_MIN_EDIT_GRID_WIDTH_IN_PX = exports.DASHBOARD_STACKED_BELOW_WIDTH_IN_PX = exports.DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX = exports.DASHBOARD_MIN_ROW_HEIGHT_IN_PX = exports.DASHBOARD_BOARD_COLUMNS = exports.DASHBOARD_BOARD_GAP_IN_PX = void 0;
|
|
40
40
|
const DashboardSize_1 = __importStar(require("../../Types/Dashboard/DashboardSize"));
|
|
41
41
|
const DashboardComponentType_1 = __importDefault(require("../../Types/Dashboard/DashboardComponentType"));
|
|
42
42
|
/*
|
|
@@ -105,6 +105,14 @@ exports.DASHBOARD_MIN_EDIT_GRID_WIDTH_IN_PX = exports.DASHBOARD_STACKED_BELOW_WI
|
|
|
105
105
|
* phone has the room to give it.
|
|
106
106
|
*/
|
|
107
107
|
exports.DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX = 400;
|
|
108
|
+
/*
|
|
109
|
+
* The most rows a widget that is not drawn - only a sentence where it would
|
|
110
|
+
* be (isPlaceholder) - takes when the widgets are stacked: room for its
|
|
111
|
+
* title, an icon and two lines of words (150px), whatever its rows on the
|
|
112
|
+
* grid. A phone has no arrangement to keep, and a 390px card for one line
|
|
113
|
+
* of words is a page of scrolling past nothing.
|
|
114
|
+
*/
|
|
115
|
+
exports.DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS = 2;
|
|
108
116
|
// The widgets that draw a chart over time.
|
|
109
117
|
exports.DASHBOARD_CHART_COMPONENT_TYPES = [
|
|
110
118
|
DashboardComponentType_1.default.Chart,
|
|
@@ -200,14 +208,19 @@ class DashboardBoardLayoutUtil {
|
|
|
200
208
|
/*
|
|
201
209
|
* A widget's height when the board stacks its widgets: the height it has
|
|
202
210
|
* on the narrowest grid - its rows, and the gaps between them - and a
|
|
203
|
-
* chart at least DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX.
|
|
211
|
+
* chart at least DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX. A widget that
|
|
212
|
+
* is not drawn there (isPlaceholder) takes at most
|
|
213
|
+
* DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS rows, a chart's floor none.
|
|
204
214
|
*/
|
|
205
215
|
static getStackedHeightInPx(widget) {
|
|
206
216
|
const rows = Number.isFinite(widget.heightInUnits) && widget.heightInUnits >= 1
|
|
207
217
|
? Math.round(widget.heightInUnits)
|
|
208
218
|
: 1;
|
|
209
|
-
const heightInPx = DashboardBoardLayoutUtil.unitsToSizeInPx(
|
|
210
|
-
|
|
219
|
+
const heightInPx = DashboardBoardLayoutUtil.unitsToSizeInPx(widget.isPlaceholder
|
|
220
|
+
? Math.min(rows, exports.DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS)
|
|
221
|
+
: rows, exports.DASHBOARD_MIN_ROW_HEIGHT_IN_PX, exports.DASHBOARD_BOARD_GAP_IN_PX);
|
|
222
|
+
return DashboardBoardLayoutUtil.isChart(widget.componentType) &&
|
|
223
|
+
!widget.isPlaceholder
|
|
211
224
|
? Math.max(heightInPx, exports.DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX)
|
|
212
225
|
: heightInPx;
|
|
213
226
|
}
|
|
@@ -8,4 +8,5 @@ export const DASHBOARD_MIN_ROW_HEIGHT_IN_PX = commonJsModule.DASHBOARD_MIN_ROW_H
|
|
|
8
8
|
export const DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX = commonJsModule.DASHBOARD_SQUARE_GRID_MIN_WIDTH_IN_PX;
|
|
9
9
|
export const DASHBOARD_STACKED_BELOW_WIDTH_IN_PX = commonJsModule.DASHBOARD_STACKED_BELOW_WIDTH_IN_PX;
|
|
10
10
|
export const DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX = commonJsModule.DASHBOARD_STACKED_CHART_MIN_HEIGHT_IN_PX;
|
|
11
|
+
export const DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS = commonJsModule.DASHBOARD_STACKED_PLACEHOLDER_MAX_ROWS;
|
|
11
12
|
export const DashboardBoardArrangement = commonJsModule.DashboardBoardArrangement;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import AnalyticsBaseModel, { AnalyticsBaseModelType } from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel.mjs";
|
|
2
|
+
import DatabaseBaseModel, { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.mjs";
|
|
3
|
+
import TableColumnType from "../../Types/Database/TableColumnType.mjs";
|
|
4
|
+
import { JSONValue } from "../../Types/JSON.mjs";
|
|
5
|
+
import Permission from "../../Types/Permission.mjs";
|
|
6
|
+
import { StateListType } from "../StateOrder.mjs";
|
|
7
|
+
import { TerraformValueKind } from "./TerraformSchema.mjs";
|
|
8
|
+
export declare const ONEUPTIME_CLI_COMMAND: string;
|
|
9
|
+
export declare const ONEUPTIME_CLI_PACKAGE: string;
|
|
10
|
+
export declare const ONEUPTIME_URL_ENVIRONMENT_VARIABLE: string;
|
|
11
|
+
export declare const CLI_MINIMUM_NODE_MAJOR_VERSION: number;
|
|
12
|
+
export type CliResourceType = "database" | "analytics";
|
|
13
|
+
export declare enum CliOperation {
|
|
14
|
+
List = "list",
|
|
15
|
+
Get = "get",
|
|
16
|
+
Create = "create",
|
|
17
|
+
Update = "update",
|
|
18
|
+
Delete = "delete",
|
|
19
|
+
Count = "count"
|
|
20
|
+
}
|
|
21
|
+
export declare const CLI_OPERATIONS: ReadonlyArray<CliOperation>;
|
|
22
|
+
export declare const CLI_FIELDS_SUBCOMMAND: string;
|
|
23
|
+
export declare enum CliAction {
|
|
24
|
+
Acknowledge = "acknowledge",
|
|
25
|
+
Resolve = "resolve",
|
|
26
|
+
Start = "start",
|
|
27
|
+
End = "end",
|
|
28
|
+
AddNote = "add-note"
|
|
29
|
+
}
|
|
30
|
+
export declare const CLI_ACTIONS: ReadonlyArray<CliAction>;
|
|
31
|
+
export declare function toCliCommandName(singularName: string): string;
|
|
32
|
+
export declare function getCliResourceName(model: {
|
|
33
|
+
tableName: string | null | undefined;
|
|
34
|
+
singularName: string | null | undefined;
|
|
35
|
+
}): string;
|
|
36
|
+
export declare function toCliFlag(columnName: string): string;
|
|
37
|
+
export declare function toCommanderAttributeName(flag: string): string;
|
|
38
|
+
export declare const CLI_RESERVED_FLAGS: ReadonlyArray<string>;
|
|
39
|
+
export declare function isCliServerSetColumn(columnName: string): boolean;
|
|
40
|
+
export declare function getCliDatabaseOperations(modelType: DatabaseBaseModelType): Array<CliOperation>;
|
|
41
|
+
export declare function getCliDatabaseOperationsOf(model: DatabaseBaseModel): Array<CliOperation>;
|
|
42
|
+
export declare function isAnalyticsModelInPublicApi(modelType: AnalyticsBaseModelType): boolean;
|
|
43
|
+
export declare function getCliAnalyticsOperations(modelType: AnalyticsBaseModelType): Array<CliOperation>;
|
|
44
|
+
export declare function getCliAnalyticsOperationsOf(model: AnalyticsBaseModel): Array<CliOperation>;
|
|
45
|
+
export interface CliStateChange {
|
|
46
|
+
action: CliAction;
|
|
47
|
+
stateFlag: string;
|
|
48
|
+
description: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CliStateMachine {
|
|
51
|
+
tableName: string;
|
|
52
|
+
stateModelType: DatabaseBaseModelType;
|
|
53
|
+
timelineModelType: DatabaseBaseModelType;
|
|
54
|
+
recordColumn: string;
|
|
55
|
+
stateColumn: string;
|
|
56
|
+
currentStateRelation: string;
|
|
57
|
+
stateList: StateListType;
|
|
58
|
+
changes: Array<CliStateChange>;
|
|
59
|
+
}
|
|
60
|
+
export declare const CLI_STATE_MACHINES: ReadonlyArray<CliStateMachine>;
|
|
61
|
+
export interface CliNoteTarget {
|
|
62
|
+
tableName: string;
|
|
63
|
+
internalNoteModelType: DatabaseBaseModelType;
|
|
64
|
+
publicNoteModelType?: DatabaseBaseModelType | undefined;
|
|
65
|
+
recordColumn: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const CLI_NOTE_COLUMN: string;
|
|
68
|
+
export declare const CLI_NOTE_TARGETS: ReadonlyArray<CliNoteTarget>;
|
|
69
|
+
export declare function getCliStateMachine(tableName: string): CliStateMachine | undefined;
|
|
70
|
+
export declare function getCliNoteTarget(tableName: string): CliNoteTarget | undefined;
|
|
71
|
+
export declare function getModelApiPathOf(modelType: DatabaseBaseModelType): string;
|
|
72
|
+
export declare function getCliActions(tableName: string): Array<CliAction>;
|
|
73
|
+
export interface CliPersonFlag {
|
|
74
|
+
columnName: string;
|
|
75
|
+
flag: string;
|
|
76
|
+
valueName: string;
|
|
77
|
+
isList: boolean;
|
|
78
|
+
invitesByEmail: boolean;
|
|
79
|
+
description: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CliFieldFlag {
|
|
82
|
+
columnName: string;
|
|
83
|
+
flag: string;
|
|
84
|
+
valueName: string;
|
|
85
|
+
kind: TerraformValueKind;
|
|
86
|
+
columnType: TableColumnType;
|
|
87
|
+
isRequired: boolean;
|
|
88
|
+
inCreate: boolean;
|
|
89
|
+
inUpdate: boolean;
|
|
90
|
+
description: string;
|
|
91
|
+
relatedResource?: string | undefined;
|
|
92
|
+
isSecret: boolean;
|
|
93
|
+
person?: CliPersonFlag | undefined;
|
|
94
|
+
}
|
|
95
|
+
export declare function isCliFieldFlagAllowed(flag: string): boolean;
|
|
96
|
+
export declare function getCliFieldFlags(modelType: DatabaseBaseModelType): Array<CliFieldFlag>;
|
|
97
|
+
export declare function getCliFieldFlagsFor(modelType: DatabaseBaseModelType, operation: CliOperation.Create | CliOperation.Update): Array<CliFieldFlag>;
|
|
98
|
+
export declare function getCliFieldFlagHelp(flag: CliFieldFlag, operation: CliOperation.Create | CliOperation.Update): string;
|
|
99
|
+
export declare class CliValueError extends Error {
|
|
100
|
+
}
|
|
101
|
+
export declare function parseCliList(flag: string, raw: string): Array<string>;
|
|
102
|
+
export declare function parseCliFieldValue(flag: CliFieldFlag, raw: string | boolean): JSONValue;
|
|
103
|
+
export interface CliAnalyticsField {
|
|
104
|
+
columnName: string;
|
|
105
|
+
title: string;
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
isRequired: boolean;
|
|
109
|
+
inCreate: boolean;
|
|
110
|
+
inUpdate: boolean;
|
|
111
|
+
isReadable: boolean;
|
|
112
|
+
}
|
|
113
|
+
export declare function getCliAnalyticsFields(modelType: AnalyticsBaseModelType): Array<CliAnalyticsField>;
|
|
114
|
+
export declare function isAnalyticsColumnReadable(columnName: string, read: Array<Permission> | undefined): boolean;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import AnalyticsBaseModel, { AnalyticsBaseModelType } from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel";
|
|
2
|
+
import DatabaseBaseModel, { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
|
|
3
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
4
|
+
import { JSONValue } from "../../Types/JSON";
|
|
5
|
+
import Permission from "../../Types/Permission";
|
|
6
|
+
import { StateListType } from "../StateOrder";
|
|
7
|
+
import { TerraformValueKind } from "./TerraformSchema";
|
|
8
|
+
export declare const ONEUPTIME_CLI_COMMAND: string;
|
|
9
|
+
export declare const ONEUPTIME_CLI_PACKAGE: string;
|
|
10
|
+
export declare const ONEUPTIME_URL_ENVIRONMENT_VARIABLE: string;
|
|
11
|
+
export declare const CLI_MINIMUM_NODE_MAJOR_VERSION: number;
|
|
12
|
+
export type CliResourceType = "database" | "analytics";
|
|
13
|
+
export declare enum CliOperation {
|
|
14
|
+
List = "list",
|
|
15
|
+
Get = "get",
|
|
16
|
+
Create = "create",
|
|
17
|
+
Update = "update",
|
|
18
|
+
Delete = "delete",
|
|
19
|
+
Count = "count"
|
|
20
|
+
}
|
|
21
|
+
export declare const CLI_OPERATIONS: ReadonlyArray<CliOperation>;
|
|
22
|
+
export declare const CLI_FIELDS_SUBCOMMAND: string;
|
|
23
|
+
export declare enum CliAction {
|
|
24
|
+
Acknowledge = "acknowledge",
|
|
25
|
+
Resolve = "resolve",
|
|
26
|
+
Start = "start",
|
|
27
|
+
End = "end",
|
|
28
|
+
AddNote = "add-note"
|
|
29
|
+
}
|
|
30
|
+
export declare const CLI_ACTIONS: ReadonlyArray<CliAction>;
|
|
31
|
+
export declare function toCliCommandName(singularName: string): string;
|
|
32
|
+
export declare function getCliResourceName(model: {
|
|
33
|
+
tableName: string | null | undefined;
|
|
34
|
+
singularName: string | null | undefined;
|
|
35
|
+
}): string;
|
|
36
|
+
export declare function toCliFlag(columnName: string): string;
|
|
37
|
+
export declare function toCommanderAttributeName(flag: string): string;
|
|
38
|
+
export declare const CLI_RESERVED_FLAGS: ReadonlyArray<string>;
|
|
39
|
+
export declare function isCliServerSetColumn(columnName: string): boolean;
|
|
40
|
+
export declare function getCliDatabaseOperations(modelType: DatabaseBaseModelType): Array<CliOperation>;
|
|
41
|
+
export declare function getCliDatabaseOperationsOf(model: DatabaseBaseModel): Array<CliOperation>;
|
|
42
|
+
export declare function isAnalyticsModelInPublicApi(modelType: AnalyticsBaseModelType): boolean;
|
|
43
|
+
export declare function getCliAnalyticsOperations(modelType: AnalyticsBaseModelType): Array<CliOperation>;
|
|
44
|
+
export declare function getCliAnalyticsOperationsOf(model: AnalyticsBaseModel): Array<CliOperation>;
|
|
45
|
+
export interface CliStateChange {
|
|
46
|
+
action: CliAction;
|
|
47
|
+
stateFlag: string;
|
|
48
|
+
description: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CliStateMachine {
|
|
51
|
+
tableName: string;
|
|
52
|
+
stateModelType: DatabaseBaseModelType;
|
|
53
|
+
timelineModelType: DatabaseBaseModelType;
|
|
54
|
+
recordColumn: string;
|
|
55
|
+
stateColumn: string;
|
|
56
|
+
currentStateRelation: string;
|
|
57
|
+
stateList: StateListType;
|
|
58
|
+
changes: Array<CliStateChange>;
|
|
59
|
+
}
|
|
60
|
+
export declare const CLI_STATE_MACHINES: ReadonlyArray<CliStateMachine>;
|
|
61
|
+
export interface CliNoteTarget {
|
|
62
|
+
tableName: string;
|
|
63
|
+
internalNoteModelType: DatabaseBaseModelType;
|
|
64
|
+
publicNoteModelType?: DatabaseBaseModelType | undefined;
|
|
65
|
+
recordColumn: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const CLI_NOTE_COLUMN: string;
|
|
68
|
+
export declare const CLI_NOTE_TARGETS: ReadonlyArray<CliNoteTarget>;
|
|
69
|
+
export declare function getCliStateMachine(tableName: string): CliStateMachine | undefined;
|
|
70
|
+
export declare function getCliNoteTarget(tableName: string): CliNoteTarget | undefined;
|
|
71
|
+
export declare function getModelApiPathOf(modelType: DatabaseBaseModelType): string;
|
|
72
|
+
export declare function getCliActions(tableName: string): Array<CliAction>;
|
|
73
|
+
export interface CliPersonFlag {
|
|
74
|
+
columnName: string;
|
|
75
|
+
flag: string;
|
|
76
|
+
valueName: string;
|
|
77
|
+
isList: boolean;
|
|
78
|
+
invitesByEmail: boolean;
|
|
79
|
+
description: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CliFieldFlag {
|
|
82
|
+
columnName: string;
|
|
83
|
+
flag: string;
|
|
84
|
+
valueName: string;
|
|
85
|
+
kind: TerraformValueKind;
|
|
86
|
+
columnType: TableColumnType;
|
|
87
|
+
isRequired: boolean;
|
|
88
|
+
inCreate: boolean;
|
|
89
|
+
inUpdate: boolean;
|
|
90
|
+
description: string;
|
|
91
|
+
relatedResource?: string | undefined;
|
|
92
|
+
isSecret: boolean;
|
|
93
|
+
person?: CliPersonFlag | undefined;
|
|
94
|
+
}
|
|
95
|
+
export declare function isCliFieldFlagAllowed(flag: string): boolean;
|
|
96
|
+
export declare function getCliFieldFlags(modelType: DatabaseBaseModelType): Array<CliFieldFlag>;
|
|
97
|
+
export declare function getCliFieldFlagsFor(modelType: DatabaseBaseModelType, operation: CliOperation.Create | CliOperation.Update): Array<CliFieldFlag>;
|
|
98
|
+
export declare function getCliFieldFlagHelp(flag: CliFieldFlag, operation: CliOperation.Create | CliOperation.Update): string;
|
|
99
|
+
export declare class CliValueError extends Error {
|
|
100
|
+
}
|
|
101
|
+
export declare function parseCliList(flag: string, raw: string): Array<string>;
|
|
102
|
+
export declare function parseCliFieldValue(flag: CliFieldFlag, raw: string | boolean): JSONValue;
|
|
103
|
+
export interface CliAnalyticsField {
|
|
104
|
+
columnName: string;
|
|
105
|
+
title: string;
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
isRequired: boolean;
|
|
109
|
+
inCreate: boolean;
|
|
110
|
+
inUpdate: boolean;
|
|
111
|
+
isReadable: boolean;
|
|
112
|
+
}
|
|
113
|
+
export declare function getCliAnalyticsFields(modelType: AnalyticsBaseModelType): Array<CliAnalyticsField>;
|
|
114
|
+
export declare function isAnalyticsColumnReadable(columnName: string, read: Array<Permission> | undefined): boolean;
|