@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
|
@@ -1,50 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_STATUS_NAMES = exports.DEFAULT_SECURITY_CASE_PRIORITY_NAMES = exports.DEFAULT_SECURITY_CASE_STATUS_NAMES = exports.DEFAULT_POSTMORTEM_STATUS_NAMES = exports.DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES = exports.DEFAULT_MONITOR_STATUS_NAMES = exports.DEFAULT_ALERT_SEVERITY_NAMES = exports.DEFAULT_INCIDENT_SEVERITY_NAMES = exports.DEFAULT_ALERT_STATE_NAMES = exports.DEFAULT_INCIDENT_STATE_NAMES = void 0;
|
|
4
4
|
const Translator_1 = require("../Translator");
|
|
5
5
|
/*
|
|
6
6
|
* THE NAMES ONEUPTIME GIVES EVERY NEW PROJECT'S STATES, SEVERITIES AND
|
|
7
|
-
* STATUSES (ProjectService)
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (StatusPage/src/Utils/StatusTranslation), and so do its notifications to
|
|
12
|
-
* its subscribers (Server/Utils/StatusPage/SubscriberMessageText). A name
|
|
13
|
-
* the project changed is its own, and reads as written in every language.
|
|
7
|
+
* STATUSES (ProjectService), one list for each kind of record. They are
|
|
8
|
+
* OneUptime's words, read in the reader's language; a name the project
|
|
9
|
+
* changed is its own, and reads as written in every language. Which list a
|
|
10
|
+
* record's name is read against goes by its table (Utils/DefaultRecordNames).
|
|
14
11
|
*/
|
|
15
|
-
|
|
12
|
+
// A new project's incident states (addDefaultIncidentState).
|
|
13
|
+
exports.DEFAULT_INCIDENT_STATE_NAMES = [
|
|
16
14
|
(0, Translator_1.translationKey)("Identified"),
|
|
17
15
|
(0, Translator_1.translationKey)("Acknowledged"),
|
|
18
16
|
(0, Translator_1.translationKey)("Resolved"),
|
|
17
|
+
];
|
|
18
|
+
// Its alert states (addDefaultAlertState), named as its incident states are.
|
|
19
|
+
exports.DEFAULT_ALERT_STATE_NAMES = exports.DEFAULT_INCIDENT_STATE_NAMES;
|
|
20
|
+
// Its incident severities (addDefaultIncidentSeverity).
|
|
21
|
+
exports.DEFAULT_INCIDENT_SEVERITY_NAMES = [
|
|
19
22
|
(0, Translator_1.translationKey)("Critical Incident"),
|
|
20
23
|
(0, Translator_1.translationKey)("Major Incident"),
|
|
21
24
|
(0, Translator_1.translationKey)("Minor Incident"),
|
|
25
|
+
];
|
|
26
|
+
/*
|
|
27
|
+
* Its alert severities (addDefaultAlertSeverity). A status page never shows
|
|
28
|
+
* an alert, so they are not among the status page's names below; a
|
|
29
|
+
* person's on-call page shows them (OnCallDutyPolicy/OnCallPageWords).
|
|
30
|
+
*/
|
|
31
|
+
exports.DEFAULT_ALERT_SEVERITY_NAMES = [
|
|
32
|
+
(0, Translator_1.translationKey)("High"),
|
|
33
|
+
(0, Translator_1.translationKey)("Low"),
|
|
34
|
+
];
|
|
35
|
+
// Its monitor statuses (addDefaultMonitorStatus).
|
|
36
|
+
exports.DEFAULT_MONITOR_STATUS_NAMES = [
|
|
22
37
|
(0, Translator_1.translationKey)("Operational"),
|
|
23
38
|
(0, Translator_1.translationKey)("Degraded"),
|
|
24
39
|
(0, Translator_1.translationKey)("Offline"),
|
|
40
|
+
];
|
|
41
|
+
// Its scheduled maintenance states (addDefaultScheduledMaintenanceState).
|
|
42
|
+
exports.DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES = [
|
|
25
43
|
(0, Translator_1.translationKey)("Scheduled"),
|
|
26
44
|
(0, Translator_1.translationKey)("Ongoing"),
|
|
27
45
|
(0, Translator_1.translationKey)("Ended"),
|
|
28
46
|
(0, Translator_1.translationKey)("Completed"),
|
|
29
47
|
];
|
|
30
|
-
// Whether `name` is one of OneUptime's default names, as it gave it.
|
|
31
|
-
const isDefaultStatusName = (name) => {
|
|
32
|
-
return typeof name === "string" && exports.DEFAULT_STATUS_NAMES.includes(name.trim());
|
|
33
|
-
};
|
|
34
|
-
exports.isDefaultStatusName = isDefaultStatusName;
|
|
35
48
|
/*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
49
|
+
* The names of its postmortem statuses (DEFAULT_POSTMORTEM_STATUSES,
|
|
50
|
+
* Utils/Incident/PostmortemStatus) and of its security case statuses and
|
|
51
|
+
* priorities (DEFAULT_SECURITY_CASE_STATUSES and _PRIORITIES, in
|
|
52
|
+
* Utils/SecurityCase), and nothing else of them: DefaultRecordNames reads a
|
|
53
|
+
* record's name against them on every form, and loading those lists'
|
|
54
|
+
* colours, descriptions and rules would load them on every page that has
|
|
55
|
+
* one (packages/Common/Scripts/first-load-budgets.js). Tests/Utils/
|
|
56
|
+
* DefaultRecordNames holds each to its list's names. Written as those lists
|
|
57
|
+
* write them, not as lookups: no message the server sends names one.
|
|
39
58
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
exports.DEFAULT_POSTMORTEM_STATUS_NAMES = [
|
|
60
|
+
"Not Started",
|
|
61
|
+
"Draft",
|
|
62
|
+
"Completed",
|
|
63
|
+
"Not Needed",
|
|
64
|
+
];
|
|
65
|
+
exports.DEFAULT_SECURITY_CASE_STATUS_NAMES = [
|
|
66
|
+
"New",
|
|
67
|
+
"Investigating",
|
|
68
|
+
"Contained",
|
|
69
|
+
"Closed",
|
|
70
|
+
];
|
|
71
|
+
exports.DEFAULT_SECURITY_CASE_PRIORITY_NAMES = [
|
|
72
|
+
"Critical",
|
|
73
|
+
"High",
|
|
74
|
+
"Medium",
|
|
75
|
+
"Low",
|
|
76
|
+
"Informational",
|
|
77
|
+
];
|
|
78
|
+
/*
|
|
79
|
+
* The default names a status page shows, of all four lists. A status page
|
|
80
|
+
* shows these in its reader's language
|
|
81
|
+
* (StatusPage/src/Utils/StatusTranslation), and so do its notifications to
|
|
82
|
+
* its subscribers (Server/Utils/StatusPage/SubscriberMessageText).
|
|
83
|
+
*
|
|
84
|
+
* Whether a record's name is one of them is never decided against this
|
|
85
|
+
* union: an incident state a project named "Degraded" is the project's own,
|
|
86
|
+
* though Degraded is a default monitor status. It goes by the record's own
|
|
87
|
+
* list (Utils/DefaultRecordNames: isDefaultRecordName, translateRecordName),
|
|
88
|
+
* on the Dashboard, a status page, an on-call page and in every message
|
|
89
|
+
* (#8066).
|
|
90
|
+
*/
|
|
91
|
+
exports.DEFAULT_STATUS_NAMES = [
|
|
92
|
+
...exports.DEFAULT_INCIDENT_STATE_NAMES,
|
|
93
|
+
...exports.DEFAULT_INCIDENT_SEVERITY_NAMES,
|
|
94
|
+
...exports.DEFAULT_MONITOR_STATUS_NAMES,
|
|
95
|
+
...exports.DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES,
|
|
96
|
+
];
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import commonJsModule from "./DefaultStatusNames.js";
|
|
2
|
+
export const DEFAULT_ALERT_SEVERITY_NAMES = commonJsModule.DEFAULT_ALERT_SEVERITY_NAMES;
|
|
3
|
+
export const DEFAULT_ALERT_STATE_NAMES = commonJsModule.DEFAULT_ALERT_STATE_NAMES;
|
|
4
|
+
export const DEFAULT_INCIDENT_SEVERITY_NAMES = commonJsModule.DEFAULT_INCIDENT_SEVERITY_NAMES;
|
|
5
|
+
export const DEFAULT_INCIDENT_STATE_NAMES = commonJsModule.DEFAULT_INCIDENT_STATE_NAMES;
|
|
6
|
+
export const DEFAULT_MONITOR_STATUS_NAMES = commonJsModule.DEFAULT_MONITOR_STATUS_NAMES;
|
|
7
|
+
export const DEFAULT_POSTMORTEM_STATUS_NAMES = commonJsModule.DEFAULT_POSTMORTEM_STATUS_NAMES;
|
|
8
|
+
export const DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES = commonJsModule.DEFAULT_SCHEDULED_MAINTENANCE_STATE_NAMES;
|
|
9
|
+
export const DEFAULT_SECURITY_CASE_PRIORITY_NAMES = commonJsModule.DEFAULT_SECURITY_CASE_PRIORITY_NAMES;
|
|
10
|
+
export const DEFAULT_SECURITY_CASE_STATUS_NAMES = commonJsModule.DEFAULT_SECURITY_CASE_STATUS_NAMES;
|
|
2
11
|
export const DEFAULT_STATUS_NAMES = commonJsModule.DEFAULT_STATUS_NAMES;
|
|
3
|
-
export const isDefaultStatusName = commonJsModule.isDefaultStatusName;
|
|
4
|
-
export const translateStateName = commonJsModule.translateStateName;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MarkdownText } from "../../Utils/Markdown/FeedMarkdown.mjs";
|
|
2
2
|
import { ComposedValue, Translator } from "../Translator.mjs";
|
|
3
|
+
import { StatusPageNameList } from "./DefaultStatusNames.mjs";
|
|
3
4
|
export declare const StateChangeNoteText: {
|
|
4
5
|
readonly incidentEmailSubject: string;
|
|
5
6
|
readonly incidentCustomTemplateEmailSubject: string;
|
|
@@ -12,7 +13,7 @@ export declare const StateChangeNoteText: {
|
|
|
12
13
|
export default class StateChangeNoteMessage {
|
|
13
14
|
static readonly statusLabel: string;
|
|
14
15
|
static formatStateName(stateName: string): string;
|
|
15
|
-
static stateInSentence(stateName: string): ComposedValue;
|
|
16
|
+
static stateInSentence(list: StatusPageNameList, stateName: string): ComposedValue;
|
|
16
17
|
static getIncidentEmailSubject(data: {
|
|
17
18
|
stateName: string;
|
|
18
19
|
incidentTitle: string;
|
|
@@ -45,5 +46,5 @@ export default class StateChangeNoteMessage {
|
|
|
45
46
|
statusPageName: string;
|
|
46
47
|
translator?: Translator | undefined;
|
|
47
48
|
}): string;
|
|
48
|
-
static getChatStatusLine(stateName: string, translator?: Translator | undefined): MarkdownText;
|
|
49
|
+
static getChatStatusLine(list: StatusPageNameList, stateName: string, translator?: Translator | undefined): MarkdownText;
|
|
49
50
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MarkdownText } from "../../Utils/Markdown/FeedMarkdown";
|
|
2
2
|
import { ComposedValue, Translator } from "../Translator";
|
|
3
|
+
import { StatusPageNameList } from "./DefaultStatusNames";
|
|
3
4
|
export declare const StateChangeNoteText: {
|
|
4
5
|
readonly incidentEmailSubject: string;
|
|
5
6
|
readonly incidentCustomTemplateEmailSubject: string;
|
|
@@ -12,7 +13,7 @@ export declare const StateChangeNoteText: {
|
|
|
12
13
|
export default class StateChangeNoteMessage {
|
|
13
14
|
static readonly statusLabel: string;
|
|
14
15
|
static formatStateName(stateName: string): string;
|
|
15
|
-
static stateInSentence(stateName: string): ComposedValue;
|
|
16
|
+
static stateInSentence(list: StatusPageNameList, stateName: string): ComposedValue;
|
|
16
17
|
static getIncidentEmailSubject(data: {
|
|
17
18
|
stateName: string;
|
|
18
19
|
incidentTitle: string;
|
|
@@ -45,5 +46,5 @@ export default class StateChangeNoteMessage {
|
|
|
45
46
|
statusPageName: string;
|
|
46
47
|
translator?: Translator | undefined;
|
|
47
48
|
}): string;
|
|
48
|
-
static getChatStatusLine(stateName: string, translator?: Translator | undefined): MarkdownText;
|
|
49
|
+
static getChatStatusLine(list: StatusPageNameList, stateName: string, translator?: Translator | undefined): MarkdownText;
|
|
49
50
|
}
|
|
@@ -7,7 +7,8 @@ exports.StateChangeNoteText = void 0;
|
|
|
7
7
|
const Text_1 = __importDefault(require("../Text"));
|
|
8
8
|
const FeedMarkdown_1 = require("../../Utils/Markdown/FeedMarkdown");
|
|
9
9
|
const Translator_1 = require("../Translator");
|
|
10
|
-
const
|
|
10
|
+
const DefaultRecordNames_1 = require("../../Utils/DefaultRecordNames");
|
|
11
|
+
const StateOrder_1 = require("../../Utils/StateOrder");
|
|
11
12
|
/*
|
|
12
13
|
* WHAT A PUBLIC NOTE POSTED WITH A STATE CHANGE ADDS TO ITS MESSAGES.
|
|
13
14
|
*
|
|
@@ -35,7 +36,9 @@ const DefaultStatusNames_1 = require("./DefaultStatusNames");
|
|
|
35
36
|
* Each message is written in the language of the translator it is handed -
|
|
36
37
|
* a subscriber's (Server/Utils/StatusPage/SubscriberLanguage), with
|
|
37
38
|
* OneUptime's default state names in that language and a project's own as
|
|
38
|
-
* written
|
|
39
|
+
* written - an incident's state read against the incident states' defaults,
|
|
40
|
+
* a scheduled maintenance event's against the maintenance states' (#8066).
|
|
41
|
+
* Without one it is the English it always was.
|
|
39
42
|
*/
|
|
40
43
|
const ENGLISH = (0, Translator_1.createTranslator)(undefined, "en");
|
|
41
44
|
exports.StateChangeNoteText = {
|
|
@@ -54,17 +57,17 @@ class StateChangeNoteMessage {
|
|
|
54
57
|
}
|
|
55
58
|
/*
|
|
56
59
|
* A state as a sentence names it: as formatStateName writes it, with
|
|
57
|
-
* OneUptime's default names in the sentence's language.
|
|
60
|
+
* OneUptime's default names of its `list` in the sentence's language.
|
|
58
61
|
*/
|
|
59
|
-
static stateInSentence(stateName) {
|
|
62
|
+
static stateInSentence(list, stateName) {
|
|
60
63
|
return (0, Translator_1.composedValue)((translator) => {
|
|
61
|
-
return StateChangeNoteMessage.formatStateName((0,
|
|
64
|
+
return StateChangeNoteMessage.formatStateName((0, DefaultRecordNames_1.translateRecordName)(translator, list, stateName.trim()));
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
67
|
// The default incident email's subject: "[Resolved Incident] <title>".
|
|
65
68
|
static getIncidentEmailSubject(data) {
|
|
66
69
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.incidentEmailSubject, {
|
|
67
|
-
state: this.stateInSentence(data.stateName),
|
|
70
|
+
state: this.stateInSentence(StateOrder_1.StateListType.IncidentState, data.stateName),
|
|
68
71
|
title: data.incidentTitle,
|
|
69
72
|
});
|
|
70
73
|
}
|
|
@@ -74,7 +77,7 @@ class StateChangeNoteMessage {
|
|
|
74
77
|
*/
|
|
75
78
|
static getIncidentCustomTemplateEmailSubject(data) {
|
|
76
79
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.incidentCustomTemplateEmailSubject, {
|
|
77
|
-
state: this.stateInSentence(data.stateName),
|
|
80
|
+
state: this.stateInSentence(StateOrder_1.StateListType.IncidentState, data.stateName),
|
|
78
81
|
title: data.incidentTitle,
|
|
79
82
|
});
|
|
80
83
|
}
|
|
@@ -84,7 +87,7 @@ class StateChangeNoteMessage {
|
|
|
84
87
|
*/
|
|
85
88
|
static getScheduledMaintenanceEmailSubject(data) {
|
|
86
89
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.scheduledMaintenanceEmailSubject, {
|
|
87
|
-
state: this.stateInSentence(data.stateName),
|
|
90
|
+
state: this.stateInSentence(StateOrder_1.StateListType.ScheduledMaintenanceState, data.stateName),
|
|
88
91
|
title: data.eventTitle,
|
|
89
92
|
});
|
|
90
93
|
}
|
|
@@ -94,7 +97,7 @@ class StateChangeNoteMessage {
|
|
|
94
97
|
*/
|
|
95
98
|
static getScheduledMaintenanceCustomTemplateEmailSubject(data) {
|
|
96
99
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.scheduledMaintenanceCustomTemplateEmailSubject, {
|
|
97
|
-
state: this.stateInSentence(data.stateName),
|
|
100
|
+
state: this.stateInSentence(StateOrder_1.StateListType.ScheduledMaintenanceState, data.stateName),
|
|
98
101
|
title: data.eventTitle,
|
|
99
102
|
});
|
|
100
103
|
}
|
|
@@ -103,7 +106,7 @@ class StateChangeNoteMessage {
|
|
|
103
106
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.incidentSmsHeadline, {
|
|
104
107
|
title: data.incidentTitle,
|
|
105
108
|
statusPageName: data.statusPageName,
|
|
106
|
-
state: this.stateInSentence(data.stateName),
|
|
109
|
+
state: this.stateInSentence(StateOrder_1.StateListType.IncidentState, data.stateName),
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
112
|
/*
|
|
@@ -114,7 +117,7 @@ class StateChangeNoteMessage {
|
|
|
114
117
|
return (data.translator || ENGLISH).translateTemplate(exports.StateChangeNoteText.scheduledMaintenanceSmsHeadline, {
|
|
115
118
|
title: data.eventTitle,
|
|
116
119
|
statusPageName: data.statusPageName,
|
|
117
|
-
state: this.stateInSentence(data.stateName),
|
|
120
|
+
state: this.stateInSentence(StateOrder_1.StateListType.ScheduledMaintenanceState, data.stateName),
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
123
|
/*
|
|
@@ -123,11 +126,11 @@ class StateChangeNoteMessage {
|
|
|
123
126
|
* (mdText), so it reads as typed - OneUptime's default names in the
|
|
124
127
|
* reader's language, a project's own as written.
|
|
125
128
|
*/
|
|
126
|
-
static getChatStatusLine(stateName, translator) {
|
|
129
|
+
static getChatStatusLine(list, stateName, translator) {
|
|
127
130
|
const reader = translator || ENGLISH;
|
|
128
131
|
const label = reader.translateText(exports.StateChangeNoteText.chatStatusLabel) ||
|
|
129
132
|
exports.StateChangeNoteText.chatStatusLabel;
|
|
130
|
-
return (0, FeedMarkdown_1.mdText) `**${label}** ${(0,
|
|
133
|
+
return (0, FeedMarkdown_1.mdText) `**${label}** ${(0, DefaultRecordNames_1.translateRecordName)(reader, list, stateName.trim())}`;
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
// The label of the line every chat message and email names the state on.
|
|
@@ -13,12 +13,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
* historical behaviour and the DEFAULT, so every key that already exists
|
|
14
14
|
* keeps working exactly as before.
|
|
15
15
|
* - Browser keys are pasted into a public web page - the session-replay
|
|
16
|
-
* snippet, a browser OTLP exporter
|
|
17
|
-
* anyone who views source has it. They are
|
|
18
|
-
* write-only credentials and are constrained
|
|
19
|
-
* enforced server-side: a required origin
|
|
20
|
-
* a per-key rate limit, an expiry, a
|
|
21
|
-
* ingest surfaces (see
|
|
16
|
+
* snippet, a browser OTLP exporter, a Sentry browser SDK's DSN - which
|
|
17
|
+
* means "secret" is a fiction: anyone who views source has it. They are
|
|
18
|
+
* therefore treated as PUBLIC write-only credentials and are constrained
|
|
19
|
+
* on every axis that can be enforced server-side: a required origin
|
|
20
|
+
* allowlist, a pinned service.name, a per-key rate limit, an expiry, a
|
|
21
|
+
* kill switch, and a reduced set of ingest surfaces (see
|
|
22
|
+
* BROWSER_ALLOWED_INGEST_SURFACES).
|
|
22
23
|
*
|
|
23
24
|
* The type of a key is immutable after creation - see the keyType column on
|
|
24
25
|
* TelemetryIngestionKey for why.
|
package/Types/Translator.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ export interface PluralTemplate {
|
|
|
11
11
|
one: string;
|
|
12
12
|
other: string;
|
|
13
13
|
}
|
|
14
|
+
export declare const SAME_AS_ENGLISH_MARK: string;
|
|
14
15
|
export type TextLookup = (text: string) => string | undefined;
|
|
15
16
|
export interface TermOptions {
|
|
16
17
|
inSentence?: boolean | undefined;
|
package/Types/Translator.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface PluralTemplate {
|
|
|
11
11
|
one: string;
|
|
12
12
|
other: string;
|
|
13
13
|
}
|
|
14
|
+
export declare const SAME_AS_ENGLISH_MARK: string;
|
|
14
15
|
export type TextLookup = (text: string) => string | undefined;
|
|
15
16
|
export interface TermOptions {
|
|
16
17
|
inSentence?: boolean | undefined;
|
package/Types/Translator.js
CHANGED
|
@@ -3,10 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTemplateAround = exports.getSentencePartsAndLanguage = exports.getSentenceParts = exports.translateNamedAction = exports.getSentenceLanguage = exports.formatInline = exports.formatList = exports.getListSeparator = exports.createTranslator = exports.getInlineSeparator = exports.writesZeroAsADot = exports.DOT_ZERO_INLINE_SEPARATOR = exports.INLINE_SEPARATOR = exports.fillTemplate = exports.isOneFormOnlyForOne = exports.getTemplatePlaceholders = exports.getPluralCategory = exports.toLabelTerm = exports.toSentenceTerm = exports.DEFAULT_LANGUAGE = exports.translationKey = exports.isComposedValue = exports.composedValue = exports.isTranslatableTerm = exports.translatableTerm = void 0;
|
|
6
|
+
exports.getTemplateAround = exports.getSentencePartsAndLanguage = exports.getSentenceParts = exports.translateNamedAction = exports.getSentenceLanguage = exports.formatInline = exports.formatList = exports.getListSeparator = exports.createTranslator = exports.getInlineSeparator = exports.writesZeroAsADot = exports.DOT_ZERO_INLINE_SEPARATOR = exports.INLINE_SEPARATOR = exports.fillTemplate = exports.isOneFormOnlyForOne = exports.getTemplatePlaceholders = exports.getPluralCategory = exports.toLabelTerm = exports.toSentenceTerm = exports.DEFAULT_LANGUAGE = exports.translationKey = exports.isComposedValue = exports.composedValue = exports.isTranslatableTerm = exports.translatableTerm = exports.SAME_AS_ENGLISH_MARK = void 0;
|
|
7
7
|
const RegExpEscape_1 = __importDefault(require("../Utils/RegExpEscape"));
|
|
8
8
|
const DateLanguage_1 = require("./DateLanguage");
|
|
9
|
+
const MeaningKeys_1 = require("./MeaningKeys");
|
|
10
|
+
const NoBreakSpaces_1 = require("./NoBreakSpaces");
|
|
9
11
|
const ReadingDirection_1 = require("./ReadingDirection");
|
|
12
|
+
/*
|
|
13
|
+
* A plural's one form that a language words exactly as English does, on
|
|
14
|
+
* purpose - French "{{count}} signal" beside its "{{count}} signaux",
|
|
15
|
+
* Portuguese "{{count}} monitor" - is marked as the language's own by one
|
|
16
|
+
* more entry: the "_one" key plus this suffix, holding the same text.
|
|
17
|
+
* Unmarked, a one form that reads as English's is English left in the
|
|
18
|
+
* locale (isEnglishPlaceholder in createTranslator), and French at 0 or
|
|
19
|
+
* Russian at 21 read English's "0 signals". No locale file holds a mark:
|
|
20
|
+
* the language's same-as-English list says which forms are its own, and
|
|
21
|
+
* the lookup answers with them - the Dashboard's bundle carries them
|
|
22
|
+
* (UI/esbuild-locales.js), the server's translator reads its own list
|
|
23
|
+
* (Server/Utils/ServerTranslation).
|
|
24
|
+
*/
|
|
25
|
+
exports.SAME_AS_ENGLISH_MARK = "_sameAsEnglish";
|
|
10
26
|
const translatableTerm = (text, options) => {
|
|
11
27
|
return {
|
|
12
28
|
translatableTerm: text,
|
|
@@ -47,10 +63,42 @@ const getBaseLanguage = (language) => {
|
|
|
47
63
|
};
|
|
48
64
|
/*
|
|
49
65
|
* Languages that capitalize every noun, so a name keeps its capital in the
|
|
50
|
-
* middle of a sentence.
|
|
51
|
-
* Korean, Hindi, Persian) are unaffected by lower-casing either way.
|
|
66
|
+
* middle of a sentence.
|
|
52
67
|
*/
|
|
53
68
|
const LANGUAGES_THAT_CAPITALIZE_NOUNS = ["de", "lb"];
|
|
69
|
+
/*
|
|
70
|
+
* Languages whose own script has no letter case: Arabic, Persian, Hindi,
|
|
71
|
+
* Japanese, Korean and Chinese, the product's, and Hebrew, Urdu and Thai.
|
|
72
|
+
* Their words have no capital to lower, but their translations carry Latin
|
|
73
|
+
* words - "Kubernetes Pod", "Namespace", "Deployment", "AWS" - and write each
|
|
74
|
+
* one with the capital the translator chose for that sentence: Japanese
|
|
75
|
+
* writes "Pod" 408 times to once. Lowering those would write a Japanese
|
|
76
|
+
* reader "このKubernetes podには" (#7951), so a term in one of these
|
|
77
|
+
* languages is left as its translation writes it, as it is in German. The
|
|
78
|
+
* capitals of a label in English, a Latin-script language or Russian are
|
|
79
|
+
* title case, and a sentence there still lowers them.
|
|
80
|
+
*/
|
|
81
|
+
const LANGUAGES_WITHOUT_LETTER_CASE = [
|
|
82
|
+
"ar", // Arabic
|
|
83
|
+
"fa", // Persian
|
|
84
|
+
"he", // Hebrew
|
|
85
|
+
"hi", // Hindi
|
|
86
|
+
"ja", // Japanese
|
|
87
|
+
"ko", // Korean
|
|
88
|
+
"th", // Thai
|
|
89
|
+
"ur", // Urdu
|
|
90
|
+
"zh", // Chinese
|
|
91
|
+
];
|
|
92
|
+
/*
|
|
93
|
+
* Whether a term keeps the case its translation writes in the middle of a
|
|
94
|
+
* sentence in `language`: in a language that capitalizes every noun, and in
|
|
95
|
+
* one whose script has no letter case.
|
|
96
|
+
*/
|
|
97
|
+
const keepsTermsAsWritten = (language) => {
|
|
98
|
+
const base = getBaseLanguage(language);
|
|
99
|
+
return (LANGUAGES_THAT_CAPITALIZE_NOUNS.includes(base) ||
|
|
100
|
+
LANGUAGES_WITHOUT_LETTER_CASE.includes(base));
|
|
101
|
+
};
|
|
54
102
|
/*
|
|
55
103
|
* Proper nouns that keep their capital wherever they appear. Acronyms
|
|
56
104
|
* ("API", "SLOs") and words with a capital inside them ("OneUptime",
|
|
@@ -131,12 +179,13 @@ const keepsItsCase = (part) => {
|
|
|
131
179
|
/*
|
|
132
180
|
* A label as it is written in the middle of a sentence in `language`:
|
|
133
181
|
* "On-Call Duty Policies" -> "on-call duty policies", "API Keys" -> "API
|
|
134
|
-
* keys", "Kubernetes Clusters" -> "Kubernetes clusters"; unchanged in German
|
|
135
|
-
*
|
|
182
|
+
* keys", "Kubernetes Clusters" -> "Kubernetes clusters"; unchanged in German
|
|
183
|
+
* and in a language whose script has no letter case ("Kubernetes Pod" in
|
|
184
|
+
* Japanese). Runs of spaces collapse and the ends are trimmed.
|
|
136
185
|
*/
|
|
137
186
|
const toSentenceTerm = (text, language) => {
|
|
138
187
|
const words = text.trim().split(/\s+/).filter(Boolean);
|
|
139
|
-
if (
|
|
188
|
+
if (keepsTermsAsWritten(language)) {
|
|
140
189
|
return words.join(" ");
|
|
141
190
|
}
|
|
142
191
|
return words
|
|
@@ -536,9 +585,11 @@ const fillSentenceValues = (template, values, language) => {
|
|
|
536
585
|
// A value as the English sentence shows it.
|
|
537
586
|
const englishValue = (value) => {
|
|
538
587
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
588
|
+
// A key that names its meaning goes in as its word (MeaningKeys).
|
|
589
|
+
const term = (0, MeaningKeys_1.withMeaningKeyAsItsWord)(value.translatableTerm);
|
|
539
590
|
return value.inSentence
|
|
540
|
-
? (0, exports.toSentenceTerm)(
|
|
541
|
-
:
|
|
591
|
+
? (0, exports.toSentenceTerm)(term, exports.DEFAULT_LANGUAGE)
|
|
592
|
+
: term.trim();
|
|
542
593
|
}
|
|
543
594
|
if ((0, exports.isComposedValue)(value)) {
|
|
544
595
|
return value.compose(getEnglishTranslator());
|
|
@@ -705,6 +756,15 @@ const createTranslator = (lookup, language) => {
|
|
|
705
756
|
const punctuate = (words) => {
|
|
706
757
|
return punctuateInLanguage(words, activeLanguage);
|
|
707
758
|
};
|
|
759
|
+
/*
|
|
760
|
+
* The reader's language's own wording of `english`, as it sets a line:
|
|
761
|
+
* punctuated, each number kept with its unit, and French's marks kept
|
|
762
|
+
* with their words (Types/NoBreakSpaces). Never a value's: it is set
|
|
763
|
+
* before the values go in.
|
|
764
|
+
*/
|
|
765
|
+
const setWording = (wording, english) => {
|
|
766
|
+
return (0, NoBreakSpaces_1.withNoBreakSpaces)(punctuate(wording), english, activeLanguage);
|
|
767
|
+
};
|
|
708
768
|
// The stored wording for `key`, or undefined when nothing has one.
|
|
709
769
|
const find = (key) => {
|
|
710
770
|
if (!lookup || !key) {
|
|
@@ -712,7 +772,16 @@ const createTranslator = (lookup, language) => {
|
|
|
712
772
|
}
|
|
713
773
|
try {
|
|
714
774
|
const result = lookup(key);
|
|
715
|
-
|
|
775
|
+
/*
|
|
776
|
+
* Neither the key itself nor the word a key that names its meaning
|
|
777
|
+
* reads as (MeaningKeys) is a wording of its own: a lookup that
|
|
778
|
+
* already went back to the word (the front ends' translateString)
|
|
779
|
+
* leaves the key as untranslated as one that did not.
|
|
780
|
+
*/
|
|
781
|
+
return typeof result === "string" &&
|
|
782
|
+
result.length > 0 &&
|
|
783
|
+
result !== key &&
|
|
784
|
+
result !== (0, MeaningKeys_1.getWordOfMeaningKey)(key)
|
|
716
785
|
? result
|
|
717
786
|
: undefined;
|
|
718
787
|
}
|
|
@@ -724,26 +793,35 @@ const createTranslator = (lookup, language) => {
|
|
|
724
793
|
if (typeof text !== "string" || text.length === 0) {
|
|
725
794
|
return text;
|
|
726
795
|
}
|
|
727
|
-
|
|
796
|
+
/*
|
|
797
|
+
* A text with no wording of its own may be a value: as it is. A key
|
|
798
|
+
* that names its meaning reads as its word (MeaningKeys).
|
|
799
|
+
*/
|
|
728
800
|
const stored = find(text);
|
|
729
|
-
return stored === undefined
|
|
801
|
+
return stored === undefined
|
|
802
|
+
? (0, MeaningKeys_1.withMeaningKeyAsItsWord)(text)
|
|
803
|
+
: setWording(stored, text);
|
|
730
804
|
};
|
|
731
805
|
const hasTranslation = (text) => {
|
|
732
806
|
return find(text) !== undefined;
|
|
733
807
|
};
|
|
734
808
|
const translateTerm = (text, options) => {
|
|
735
|
-
var _a;
|
|
736
809
|
if (!text) {
|
|
737
810
|
return "";
|
|
738
811
|
}
|
|
739
|
-
const
|
|
812
|
+
const stored = find(text);
|
|
813
|
+
const translated = stored === undefined
|
|
814
|
+
? (0, MeaningKeys_1.withMeaningKeyAsItsWord)(text)
|
|
815
|
+
: (0, NoBreakSpaces_1.withNoBreakSpaces)(stored, text, activeLanguage);
|
|
740
816
|
if (!(options === null || options === void 0 ? void 0 : options.inSentence)) {
|
|
741
817
|
return translated.trim();
|
|
742
818
|
}
|
|
743
819
|
/*
|
|
744
820
|
* Cased the reader's way, translated or not: a German noun spelled as in
|
|
745
|
-
* English ("Labels", "Monitor") keeps its capital in a German sentence
|
|
746
|
-
*
|
|
821
|
+
* English ("Labels", "Monitor") keeps its capital in a German sentence,
|
|
822
|
+
* and so does Japanese's "Kubernetes Pod", which its file writes as
|
|
823
|
+
* English does. An English sentence never comes here - it is filled by
|
|
824
|
+
* fillTemplate.
|
|
747
825
|
*/
|
|
748
826
|
return (0, exports.toSentenceTerm)(translated, activeLanguage);
|
|
749
827
|
};
|
|
@@ -803,8 +881,8 @@ const createTranslator = (lookup, language) => {
|
|
|
803
881
|
: fillSentenceValues(punctuate(english), translatedValues(values), activeLanguage);
|
|
804
882
|
}
|
|
805
883
|
return setsValuesApart
|
|
806
|
-
? fillSettingValuesApart(
|
|
807
|
-
: fillSentenceValues(
|
|
884
|
+
? fillSettingValuesApart(setWording(stored, english), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
885
|
+
: fillSentenceValues(setWording(stored, english), translatedValues(values), activeLanguage);
|
|
808
886
|
};
|
|
809
887
|
const translateTemplate = (template, values = {}, options) => {
|
|
810
888
|
return fill(find(template), template, values, options);
|
|
@@ -859,7 +937,8 @@ const createTranslator = (lookup, language) => {
|
|
|
859
937
|
* same: the language then words the sentence alike for every count, and
|
|
860
938
|
* the form is its own - French's "0 VM". A general form left English is
|
|
861
939
|
* never that witness: the lookup gives nothing for a key that maps to
|
|
862
|
-
* itself.
|
|
940
|
+
* itself. Or unless the locale marks the form as its own
|
|
941
|
+
* (SAME_AS_ENGLISH_MARK): French says "0 signal" beside its "3 signaux".
|
|
863
942
|
* - Every other form - the general one, and a "_few", "_many", "_two" or
|
|
864
943
|
* "_zero" one, which en.json has none of - is English left in the
|
|
865
944
|
* locale when it reads as English's other form, what English writes for
|
|
@@ -870,7 +949,9 @@ const createTranslator = (lookup, language) => {
|
|
|
870
949
|
if (form.category !== "one") {
|
|
871
950
|
return form.text === template.other;
|
|
872
951
|
}
|
|
873
|
-
return form.text === template.one &&
|
|
952
|
+
return (form.text === template.one &&
|
|
953
|
+
find(template.other) !== form.text &&
|
|
954
|
+
find(`${template.other}_one${exports.SAME_AS_ENGLISH_MARK}`) !== form.text);
|
|
874
955
|
};
|
|
875
956
|
const translatePlural = (template, count, values = {}, options) => {
|
|
876
957
|
// English has two forms: exactly one, and everything else.
|
package/Types/Translator.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import commonJsModule from "./Translator.js";
|
|
|
2
2
|
export const DEFAULT_LANGUAGE = commonJsModule.DEFAULT_LANGUAGE;
|
|
3
3
|
export const DOT_ZERO_INLINE_SEPARATOR = commonJsModule.DOT_ZERO_INLINE_SEPARATOR;
|
|
4
4
|
export const INLINE_SEPARATOR = commonJsModule.INLINE_SEPARATOR;
|
|
5
|
+
export const SAME_AS_ENGLISH_MARK = commonJsModule.SAME_AS_ENGLISH_MARK;
|
|
5
6
|
export const composedValue = commonJsModule.composedValue;
|
|
6
7
|
export const createTranslator = commonJsModule.createTranslator;
|
|
7
8
|
export const fillTemplate = commonJsModule.fillTemplate;
|
|
@@ -86,3 +86,36 @@ export declare const getActivityAtRenewal: (data: {
|
|
|
86
86
|
reportedInactivityInSeconds: number | null;
|
|
87
87
|
now: Date;
|
|
88
88
|
}) => Date;
|
|
89
|
+
export declare const LONGEST_INACTIVITY_FIELD: string;
|
|
90
|
+
export interface ReportedInactivity {
|
|
91
|
+
forSeconds: number;
|
|
92
|
+
endedSecondsAgo: number;
|
|
93
|
+
}
|
|
94
|
+
export declare const readReportedLongestInactivity: (value: unknown) => ReportedInactivity | null;
|
|
95
|
+
export interface RenewalReport {
|
|
96
|
+
inactiveForInSeconds: number | null;
|
|
97
|
+
longestInactivity: ReportedInactivity | null;
|
|
98
|
+
}
|
|
99
|
+
export declare const NO_RENEWAL_REPORT: RenewalReport;
|
|
100
|
+
export type SessionRenewalOutcome = {
|
|
101
|
+
hasEnded: true;
|
|
102
|
+
reason: SessionEndReason;
|
|
103
|
+
lastActiveAt: Date;
|
|
104
|
+
} | {
|
|
105
|
+
hasEnded: false;
|
|
106
|
+
lastActiveAt: Date;
|
|
107
|
+
};
|
|
108
|
+
export declare const getUnknownInactivity: (data: {
|
|
109
|
+
storedLastActiveAt: Date;
|
|
110
|
+
longestInactivity: ReportedInactivity | null;
|
|
111
|
+
now: Date;
|
|
112
|
+
}) => {
|
|
113
|
+
fromMs: number;
|
|
114
|
+
toMs: number;
|
|
115
|
+
} | null;
|
|
116
|
+
export declare const decideSessionRenewal: (data: {
|
|
117
|
+
facts: SessionFacts;
|
|
118
|
+
lengths: SessionLengths | null | undefined;
|
|
119
|
+
report: RenewalReport;
|
|
120
|
+
now: Date;
|
|
121
|
+
}) => SessionRenewalOutcome;
|
|
@@ -86,3 +86,36 @@ export declare const getActivityAtRenewal: (data: {
|
|
|
86
86
|
reportedInactivityInSeconds: number | null;
|
|
87
87
|
now: Date;
|
|
88
88
|
}) => Date;
|
|
89
|
+
export declare const LONGEST_INACTIVITY_FIELD: string;
|
|
90
|
+
export interface ReportedInactivity {
|
|
91
|
+
forSeconds: number;
|
|
92
|
+
endedSecondsAgo: number;
|
|
93
|
+
}
|
|
94
|
+
export declare const readReportedLongestInactivity: (value: unknown) => ReportedInactivity | null;
|
|
95
|
+
export interface RenewalReport {
|
|
96
|
+
inactiveForInSeconds: number | null;
|
|
97
|
+
longestInactivity: ReportedInactivity | null;
|
|
98
|
+
}
|
|
99
|
+
export declare const NO_RENEWAL_REPORT: RenewalReport;
|
|
100
|
+
export type SessionRenewalOutcome = {
|
|
101
|
+
hasEnded: true;
|
|
102
|
+
reason: SessionEndReason;
|
|
103
|
+
lastActiveAt: Date;
|
|
104
|
+
} | {
|
|
105
|
+
hasEnded: false;
|
|
106
|
+
lastActiveAt: Date;
|
|
107
|
+
};
|
|
108
|
+
export declare const getUnknownInactivity: (data: {
|
|
109
|
+
storedLastActiveAt: Date;
|
|
110
|
+
longestInactivity: ReportedInactivity | null;
|
|
111
|
+
now: Date;
|
|
112
|
+
}) => {
|
|
113
|
+
fromMs: number;
|
|
114
|
+
toMs: number;
|
|
115
|
+
} | null;
|
|
116
|
+
export declare const decideSessionRenewal: (data: {
|
|
117
|
+
facts: SessionFacts;
|
|
118
|
+
lengths: SessionLengths | null | undefined;
|
|
119
|
+
report: RenewalReport;
|
|
120
|
+
now: Date;
|
|
121
|
+
}) => SessionRenewalOutcome;
|