@oneuptime/common 14.0.110 → 14.1.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/AIRunRecording.d.mts +12 -0
- package/Models/DatabaseModels/AIRunRecording.d.ts +12 -0
- package/Models/DatabaseModels/AIRunRecording.js +181 -0
- package/Models/DatabaseModels/AIRunRecording.mjs +2 -0
- package/Models/DatabaseModels/Alert.js +18 -2
- package/Models/DatabaseModels/DataStore.js +9 -0
- package/Models/DatabaseModels/EmailLog.js +2 -2
- package/Models/DatabaseModels/Form.js +3 -3
- package/Models/DatabaseModels/FormSubmission.js +4 -4
- package/Models/DatabaseModels/GlobalConfig.js +46 -45
- package/Models/DatabaseModels/Incident.js +18 -2
- package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/Index.js +4 -0
- package/Models/DatabaseModels/InventoryItem.js +11 -0
- package/Models/DatabaseModels/Monitor.js +51 -17
- package/Models/DatabaseModels/MonitorNetworkDevice.d.mts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.d.ts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.js +189 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.mjs +2 -0
- package/Models/DatabaseModels/MonitorProbe.js +22 -5
- package/Models/DatabaseModels/NetworkDevice.js +23 -7
- package/Models/DatabaseModels/NetworkEndpoint.d.mts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.d.ts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.js +39 -7
- package/Models/DatabaseModels/NetworkInterface.js +5 -5
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +19 -5
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
- package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
- package/Models/DatabaseModels/Project.d.mts +1 -0
- package/Models/DatabaseModels/Project.d.ts +1 -0
- package/Models/DatabaseModels/Project.js +46 -3
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
- package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
- package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
- package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
- package/Models/DatabaseModels/RunbookExecution.js +2 -2
- package/Models/DatabaseModels/RunbookRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenance.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerTeam.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerUser.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
- package/Models/DatabaseModels/TeamMember.js +10 -1
- package/Models/DatabaseModels/WorkspaceNotificationRule.js +36 -1
- package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
- package/Models/DatabaseModels/WorkspacePublicNoteApprovalMessage.js +3 -3
- package/Server/Services/DatabaseService.d.mts +4 -1
- package/Server/Services/DatabaseService.d.ts +4 -1
- package/Server/Types/Database/CountBy.d.mts +1 -0
- package/Server/Types/Database/CountBy.d.ts +1 -0
- package/Server/Types/Database/UpdateLimit.d.mts +6 -0
- package/Server/Types/Database/UpdateLimit.d.ts +6 -0
- package/Types/AI/AIActionWords.d.mts +25 -1
- package/Types/AI/AIActionWords.d.ts +25 -1
- package/Types/AI/AIActionWords.js +166 -3
- package/Types/AI/AIActionWords.mjs +6 -0
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AiOutcomes.d.mts +57 -0
- package/Types/AI/AiOutcomes.d.ts +57 -0
- package/Types/AI/AiOutcomes.js +67 -0
- package/Types/AI/AiOutcomes.mjs +10 -0
- package/Types/AI/AiRunRefusal.d.mts +45 -0
- package/Types/AI/AiRunRefusal.d.ts +45 -0
- package/Types/AI/AiRunRefusal.js +187 -0
- package/Types/AI/AiRunRefusal.mjs +12 -0
- package/Types/AI/InvestigationRecording.d.mts +46 -0
- package/Types/AI/InvestigationRecording.d.ts +46 -0
- package/Types/AI/InvestigationRecording.js +42 -0
- package/Types/AI/InvestigationRecording.mjs +7 -0
- package/Types/API/HTTPResponse.d.mts +3 -0
- package/Types/API/HTTPResponse.d.ts +3 -0
- package/Types/API/HTTPResponse.js +15 -0
- package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
- package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.js +92 -2
- package/Types/BaseDatabase/ListResult.d.mts +1 -0
- package/Types/BaseDatabase/ListResult.d.ts +1 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.mts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.ts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.js +282 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.mjs +7 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.mts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.ts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.js +21 -0
- package/Types/Dashboard/DashboardAutoRefresh.mjs +1 -0
- package/Types/Date.d.mts +6 -1
- package/Types/Date.d.ts +6 -1
- package/Types/Date.js +39 -7
- package/Types/Date.mjs +1 -0
- package/Types/Email/ServerEmailEnvironment.d.mts +85 -0
- package/Types/Email/ServerEmailEnvironment.d.ts +85 -0
- package/Types/Email/ServerEmailEnvironment.js +793 -0
- package/Types/Email/ServerEmailEnvironment.mjs +14 -0
- package/Types/Exception/AiRunRefusalException.d.mts +6 -0
- package/Types/Exception/AiRunRefusalException.d.ts +6 -0
- package/Types/Exception/AiRunRefusalException.js +23 -0
- package/Types/Exception/AiRunRefusalException.mjs +2 -0
- package/Types/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- package/Types/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +9 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.mts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.ts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.js +36 -0
- package/Types/Monitor/MonitorNotCheckedReason.mjs +4 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.mts +6 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.ts +6 -0
- package/Types/Monitor/UptimeHistoryLabels.js +2 -2
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.mts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.ts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.js +12 -9
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +24 -6
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.mts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.ts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.mts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.ts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.js +38 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.mjs +3 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.mts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.ts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.js +512 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.mjs +7 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.mts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.ts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.js +105 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.mjs +6 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.mts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.ts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.js +237 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.mjs +14 -0
- package/Types/Permission.js +2 -2
- package/Types/Probe/ProbeCapability.d.mts +2 -1
- package/Types/Probe/ProbeCapability.d.ts +2 -1
- package/Types/Probe/ProbeCapability.js +10 -0
- package/Types/ReaderLanguage.d.mts +1 -0
- package/Types/ReaderLanguage.d.ts +1 -0
- package/Types/ReaderLanguage.js +13 -1
- package/Types/ReaderLanguage.mjs +1 -0
- package/Types/Rules/RuleRun.js +2 -2
- package/Types/ScheduledMaintenance/MaintenanceCalendar.js +1 -1
- package/Types/ServerSending/ServerSendingStatus.d.mts +7 -0
- package/Types/ServerSending/ServerSendingStatus.d.ts +7 -0
- package/Types/ServerSending/ServerSendingStatus.js +49 -2
- package/Types/ServerSetup/ServerSetupChecklist.js +3 -3
- package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.mts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.ts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.js +50 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.mjs +3 -0
- package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +1 -1
- package/Types/Telemetry/CompatibleIngest.d.mts +20 -0
- package/Types/Telemetry/CompatibleIngest.d.ts +20 -0
- package/Types/Telemetry/CompatibleIngest.js +123 -0
- package/Types/Telemetry/CompatibleIngest.mjs +21 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.mts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.ts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.js +48 -7
- package/Types/TimezoneAlias.d.mts +1 -0
- package/Types/TimezoneAlias.d.ts +1 -0
- package/Types/TimezoneAlias.js +13 -0
- package/Types/Translator.js +374 -48
- package/Types/Workflow/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +2 -2
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.mts +2 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.ts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.mts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.ts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.js +456 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.mjs +5 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.mts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/GuidedSetup/StatusPageRecords.d.mts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.ts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.js +27 -2
- package/Utils/GuidedSetup/StatusPageRecords.mjs +1 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.js +6 -0
- package/Utils/HostAddressUtil.d.mts +1 -0
- package/Utils/HostAddressUtil.d.ts +1 -0
- package/Utils/HostAddressUtil.js +30 -0
- package/Utils/LinearRegExp/LinearRegExp.js +5 -1
- package/Utils/Milliseconds.d.mts +7 -0
- package/Utils/Milliseconds.d.ts +7 -0
- package/Utils/Milliseconds.js +60 -0
- package/Utils/Milliseconds.mjs +4 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +91 -21
- package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.mts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.ts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.js +217 -5
- package/Utils/Monitor/InterfaceInventoryUtil.mjs +8 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +63 -29
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +13 -2
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +58 -4
- package/Utils/Monitor/MonitoringOff.d.mts +2 -0
- package/Utils/Monitor/MonitoringOff.d.ts +2 -0
- package/Utils/Monitor/MonitoringOff.js +21 -0
- package/Utils/Monitor/NetworkTopologyUtil.d.mts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.d.ts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.js +10 -0
- package/Utils/Monitor/NotOperationalMonitorQuery.d.mts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.d.ts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.js +23 -4
- package/Utils/Monitor/ProbeFailureReading.d.mts +14 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +14 -0
- package/Utils/Monitor/ProbeFailureReading.js +137 -0
- package/Utils/Monitor/ProbeFailureReading.mjs +7 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.mts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.ts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.js +15 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.mjs +2 -0
- package/Utils/Project/NextNumber.js +1 -1
- package/Utils/PromQL/PromQLAst.d.mts +159 -0
- package/Utils/PromQL/PromQLAst.d.ts +159 -0
- package/Utils/PromQL/PromQLAst.js +118 -0
- package/Utils/PromQL/PromQLAst.mjs +12 -0
- package/Utils/PromQL/PromQLDuration.d.mts +2 -0
- package/Utils/PromQL/PromQLDuration.d.ts +2 -0
- package/Utils/PromQL/PromQLDuration.js +78 -0
- package/Utils/PromQL/PromQLDuration.mjs +3 -0
- package/Utils/PromQL/PromQLEngine.d.mts +15 -0
- package/Utils/PromQL/PromQLEngine.d.ts +15 -0
- package/Utils/PromQL/PromQLEngine.js +965 -0
- package/Utils/PromQL/PromQLEngine.mjs +7 -0
- package/Utils/PromQL/PromQLEngineTypes.d.mts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.d.ts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.js +10 -0
- package/Utils/PromQL/PromQLEngineTypes.mjs +2 -0
- package/Utils/PromQL/PromQLError.d.mts +11 -0
- package/Utils/PromQL/PromQLError.d.ts +11 -0
- package/Utils/PromQL/PromQLError.js +27 -0
- package/Utils/PromQL/PromQLError.mjs +3 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.mts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.ts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.js +773 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.mjs +3 -0
- package/Utils/PromQL/PromQLFunctions.d.mts +10 -0
- package/Utils/PromQL/PromQLFunctions.d.ts +10 -0
- package/Utils/PromQL/PromQLFunctions.js +127 -0
- package/Utils/PromQL/PromQLFunctions.mjs +4 -0
- package/Utils/PromQL/PromQLLabels.d.mts +11 -0
- package/Utils/PromQL/PromQLLabels.d.ts +11 -0
- package/Utils/PromQL/PromQLLabels.js +218 -0
- package/Utils/PromQL/PromQLLabels.mjs +9 -0
- package/Utils/PromQL/PromQLLexer.d.mts +39 -0
- package/Utils/PromQL/PromQLLexer.d.ts +39 -0
- package/Utils/PromQL/PromQLLexer.js +391 -0
- package/Utils/PromQL/PromQLLexer.mjs +3 -0
- package/Utils/PromQL/PromQLMath.d.mts +19 -0
- package/Utils/PromQL/PromQLMath.d.ts +19 -0
- package/Utils/PromQL/PromQLMath.js +200 -0
- package/Utils/PromQL/PromQLMath.mjs +9 -0
- package/Utils/PromQL/PromQLMetricNames.d.mts +21 -0
- package/Utils/PromQL/PromQLMetricNames.d.ts +21 -0
- package/Utils/PromQL/PromQLMetricNames.js +199 -0
- package/Utils/PromQL/PromQLMetricNames.mjs +8 -0
- package/Utils/PromQL/PromQLParser.d.mts +4 -0
- package/Utils/PromQL/PromQLParser.d.ts +4 -0
- package/Utils/PromQL/PromQLParser.js +831 -0
- package/Utils/PromQL/PromQLParser.mjs +4 -0
- package/Utils/PromQL/PromQLRegex.d.mts +9 -0
- package/Utils/PromQL/PromQLRegex.d.ts +9 -0
- package/Utils/PromQL/PromQLRegex.js +74 -0
- package/Utils/PromQL/PromQLRegex.mjs +2 -0
- package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
- package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
- package/Utils/PromQL/PrometheusResponse.js +90 -0
- package/Utils/PromQL/PrometheusResponse.mjs +3 -0
- package/Utils/Rum/PathInSentence.d.mts +5 -0
- package/Utils/Rum/PathInSentence.d.ts +5 -0
- package/Utils/Rum/PathInSentence.js +46 -0
- package/Utils/Rum/PathInSentence.mjs +6 -0
- package/Utils/Rum/UrlScrubber.d.mts +4 -0
- package/Utils/Rum/UrlScrubber.d.ts +4 -0
- package/Utils/Rum/UrlScrubber.js +143 -3
- package/Utils/Rum/UserFlow.d.mts +1 -1
- package/Utils/Rum/UserFlow.d.ts +1 -1
- package/Utils/Rum/UserFlow.js +180 -25
- package/Utils/Rum/UserFlow.mjs +1 -1
- package/Utils/Runbook/RunbookStepsSignature.d.mts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.d.ts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.js +30 -0
- package/Utils/Runbook/RunbookStepsSignature.mjs +3 -0
- package/Utils/Schema/TypeSchemas.js +6 -0
- package/Utils/Slo/SloDuration.d.mts +5 -2
- package/Utils/Slo/SloDuration.d.ts +5 -2
- package/Utils/Slo/SloDuration.js +11 -6
- package/Utils/Slo/SloHealth.js +1 -1
- package/Utils/StateOrder.js +1 -4
- package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
- package/Utils/Telemetry/HeartbeatAvailability.d.mts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.js +118 -26
- package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
- package/package.json +1 -1
package/Types/Translator.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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;
|
|
7
|
+
const RegExpEscape_1 = __importDefault(require("../Utils/RegExpEscape"));
|
|
4
8
|
const DateLanguage_1 = require("./DateLanguage");
|
|
5
9
|
const ReadingDirection_1 = require("./ReadingDirection");
|
|
6
10
|
const translatableTerm = (text, options) => {
|
|
@@ -51,40 +55,69 @@ const LANGUAGES_THAT_CAPITALIZE_NOUNS = ["de", "lb"];
|
|
|
51
55
|
* Proper nouns that keep their capital wherever they appear. Acronyms
|
|
52
56
|
* ("API", "SLOs") and words with a capital inside them ("OneUptime",
|
|
53
57
|
* "GitHub", "IoT") are kept without being listed.
|
|
58
|
+
*
|
|
59
|
+
* Among them every vendor the product names (issue #7692): the cloud vendors
|
|
60
|
+
* of CloudPlatform, the network vendors of the device catalog (the SNMP
|
|
61
|
+
* vendor templates, the traffic and events setups, the Meraki dashboard) and
|
|
62
|
+
* the integrations - a name said in a sentence ("Meraki devices") is never
|
|
63
|
+
* "meraki". A word that is also a word of its own ("Extreme", "Elastic",
|
|
64
|
+
* "Alto" - "high" in Spanish and Italian) is not listed: it would keep its
|
|
65
|
+
* capital as that word too.
|
|
54
66
|
*/
|
|
55
67
|
const PROPER_NOUNS = [
|
|
68
|
+
"Alertmanager",
|
|
69
|
+
"Alibaba",
|
|
70
|
+
"Arista",
|
|
71
|
+
"Aruba",
|
|
56
72
|
"Azure",
|
|
73
|
+
"Cambium",
|
|
57
74
|
"Ceph",
|
|
75
|
+
"Cisco",
|
|
76
|
+
"Datadog",
|
|
77
|
+
"Dell",
|
|
58
78
|
"Discord",
|
|
59
79
|
"Docker",
|
|
80
|
+
"Fortinet",
|
|
60
81
|
"Google",
|
|
61
82
|
"Grafana",
|
|
83
|
+
"Huawei",
|
|
62
84
|
"Huntress",
|
|
63
85
|
"Jira",
|
|
86
|
+
"Juniper",
|
|
64
87
|
"Kubernetes",
|
|
65
88
|
"Linux",
|
|
66
89
|
"Mattermost",
|
|
90
|
+
"Meraki",
|
|
67
91
|
"Microsoft",
|
|
68
92
|
"Okta",
|
|
69
93
|
"OpenTelemetry",
|
|
94
|
+
"Opsgenie",
|
|
70
95
|
"Podman",
|
|
71
96
|
"Prometheus",
|
|
72
97
|
"Proxmox",
|
|
73
98
|
"OpenStack",
|
|
74
99
|
"Slack",
|
|
100
|
+
"Sophos",
|
|
101
|
+
"Splunk",
|
|
75
102
|
"Swarm",
|
|
76
103
|
"Telegram",
|
|
104
|
+
"Tencent",
|
|
77
105
|
"Terraform",
|
|
78
106
|
"Twilio",
|
|
107
|
+
"Ubiquiti",
|
|
108
|
+
"Vercel",
|
|
79
109
|
"Windows",
|
|
110
|
+
"Zabbix",
|
|
80
111
|
];
|
|
81
112
|
/*
|
|
82
113
|
* Proper nouns of two words: the second keeps its capital after the first
|
|
83
114
|
* ("Google Cloud project", but "cloud resources").
|
|
84
115
|
*/
|
|
85
116
|
const PROPER_NOUN_PAIRS = [
|
|
117
|
+
["Alibaba", "Cloud"],
|
|
86
118
|
["Google", "Cloud"],
|
|
87
119
|
["Microsoft", "Teams"],
|
|
120
|
+
["Tencent", "Cloud"],
|
|
88
121
|
];
|
|
89
122
|
// "API", "SLOs": two capitals in a row.
|
|
90
123
|
const ACRONYM_PATTERN = /\p{Lu}{2,}/u;
|
|
@@ -245,6 +278,261 @@ const LETTER = /\p{L}/u;
|
|
|
245
278
|
const hasWords = (template) => {
|
|
246
279
|
return LETTER.test(template.replace(PLACEHOLDER, ""));
|
|
247
280
|
};
|
|
281
|
+
/*
|
|
282
|
+
* WHERE A VALUE STARTS A SENTENCE.
|
|
283
|
+
*
|
|
284
|
+
* A word cased for the middle of a sentence (an inSentence term: "le
|
|
285
|
+
* collecteur OneUptime", "monitors") takes a capital where the reader's
|
|
286
|
+
* sentence starts with it: French says "Configurez le collecteur OneUptime"
|
|
287
|
+
* and "Le collecteur OneUptime ne remonte plus de données", Dutch "Monitors
|
|
288
|
+
* zoeken…" (issue #7692). A language puts a value where its grammar wants
|
|
289
|
+
* it, so only the filled sentence knows where it starts one.
|
|
290
|
+
*
|
|
291
|
+
* A placeholder starts a sentence where, past any opening quote, bracket or
|
|
292
|
+
* Spanish opening mark, a line starts, or a sentence's end - ". ", "! ",
|
|
293
|
+
* "? ", "… ", with any closing quote or bracket - comes right before it; or
|
|
294
|
+
* where it starts the template, and the template reads as a sentence: it
|
|
295
|
+
* ends as one does (". ! ? … :"), or holds a sentence's end before more
|
|
296
|
+
* words. A template that does neither is a piece of another sentence -
|
|
297
|
+
* "{{kind}} {{name}}", "{{names}} and {{count}} more" - whose values are
|
|
298
|
+
* cased where that sentence puts them. The full stop of an abbreviation
|
|
299
|
+
* ends no sentence (NOT_A_SENTENCE_END).
|
|
300
|
+
*/
|
|
301
|
+
/*
|
|
302
|
+
* The words a language shortens before the value they introduce, in lower
|
|
303
|
+
* case: "pr. time" (per hour), "kl. 12" (at 12 o'clock), "ca. 5", "z. B.",
|
|
304
|
+
* "bijv.", "máx. 10", "Serienr. 123". Their full stop never ends a
|
|
305
|
+
* sentence: Danish fixes one resource "pr. hændelse", never with a capital.
|
|
306
|
+
* Not a unit after a number ("5 min.", "3 Std."), whose full stop may end
|
|
307
|
+
* one: "Checked every 5 min. 2 more checks are off."
|
|
308
|
+
*/
|
|
309
|
+
const SHORTENED_BEFORE_A_VALUE = [
|
|
310
|
+
"ad es", // Italian: for example ("es" alone is Spanish "is")
|
|
311
|
+
"aprox", // Spanish: about
|
|
312
|
+
"bijv", // Dutch: for example
|
|
313
|
+
"ca", // Danish: about
|
|
314
|
+
"col", // Spanish: column
|
|
315
|
+
"ex", // French, Portuguese: for example ("par ex.", "por ex.")
|
|
316
|
+
"gem", // Dutch: on average
|
|
317
|
+
"gns", // Danish: on average
|
|
318
|
+
"kl", // Danish, Norwegian, Swedish: at (a time)
|
|
319
|
+
"lín", // Spanish: line
|
|
320
|
+
"maks", // Danish, Norwegian: at most
|
|
321
|
+
"max", // German, French, Dutch: at most
|
|
322
|
+
"máx", // Spanish, Portuguese: at most
|
|
323
|
+
"moy", // French: on average
|
|
324
|
+
"n", // Italian: number
|
|
325
|
+
"nr", // Dutch: number
|
|
326
|
+
"pr", // Danish: per
|
|
327
|
+
"prom", // Spanish: on average
|
|
328
|
+
"serienr", // Danish, Dutch, Norwegian: serial number
|
|
329
|
+
"seriennr", // German: serial number
|
|
330
|
+
"z. b", // German: for example ("B." alone may end a sentence: "plan B.")
|
|
331
|
+
"админ", // Russian: administrative
|
|
332
|
+
"макс", // Russian: at most
|
|
333
|
+
"сред", // Russian: on average
|
|
334
|
+
];
|
|
335
|
+
// Those words as a pattern.
|
|
336
|
+
const SHORTENED_WORDS = SHORTENED_BEFORE_A_VALUE.map(RegExpEscape_1.default).join("|");
|
|
337
|
+
/*
|
|
338
|
+
* Right before a full stop that ends no sentence: an abbreviation with a
|
|
339
|
+
* full stop inside ("e.g.", "z.B.", "f.eks.", "т.е."), or one of the words
|
|
340
|
+
* above as a word of its own, in either case ("Ca. 5 timer").
|
|
341
|
+
*/
|
|
342
|
+
const NOT_A_SENTENCE_END = `(?<!\\p{L}\\.\\p{L}{1,3})(?<!(?:^|\\P{L})(?:${SHORTENED_WORDS}))`;
|
|
343
|
+
const SENTENCE_END = `(?:${NOT_A_SENTENCE_END}\\.|[!?…])["'»”’)\\]]*`;
|
|
344
|
+
// What a sentence may open with before its first word.
|
|
345
|
+
const OPENING_MARKS_AT_END = /["'«“„‘‚([¿¡]+$/u;
|
|
346
|
+
// A sentence's end and a space, or a line break, right before a placeholder.
|
|
347
|
+
const SENTENCE_END_BEFORE = new RegExp(`(?:${SENTENCE_END}\\s|\\n)\\s*$`, "iu");
|
|
348
|
+
// A template ending as a sentence does.
|
|
349
|
+
const ENDS_AS_A_SENTENCE = new RegExp(`(?:${SENTENCE_END}|:)\\s*$`, "iu");
|
|
350
|
+
// A sentence's end before more words, inside a template.
|
|
351
|
+
const SENTENCE_END_INSIDE = new RegExp(`${SENTENCE_END}\\s+\\S`, "iu");
|
|
352
|
+
const startsASentence = (template, at) => {
|
|
353
|
+
const before = template
|
|
354
|
+
.slice(0, at)
|
|
355
|
+
.replace(OPENING_MARKS_AT_END, "");
|
|
356
|
+
if (before.trim() === "") {
|
|
357
|
+
return (ENDS_AS_A_SENTENCE.test(template) || SENTENCE_END_INSIDE.test(template));
|
|
358
|
+
}
|
|
359
|
+
return SENTENCE_END_BEFORE.test(before);
|
|
360
|
+
};
|
|
361
|
+
/*
|
|
362
|
+
* `text`, the value as the middle of a sentence in `language` takes it, with
|
|
363
|
+
* its form where it starts one: an inSentence term takes a capital there
|
|
364
|
+
* (toLabelTerm); anything else - a name, a number, a term as written, a
|
|
365
|
+
* composed value - is the same wherever it goes.
|
|
366
|
+
*/
|
|
367
|
+
const toSentenceValue = (value, text, language) => {
|
|
368
|
+
return {
|
|
369
|
+
text,
|
|
370
|
+
atSentenceStart: (0, exports.isTranslatableTerm)(value) && value.inSentence
|
|
371
|
+
? (0, exports.toLabelTerm)(text, language)
|
|
372
|
+
: text,
|
|
373
|
+
isTerm: (0, exports.isTranslatableTerm)(value),
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
/*
|
|
377
|
+
* WHERE A TERM MEETS CHINESE OR JAPANESE WORDS.
|
|
378
|
+
*
|
|
379
|
+
* Chinese and Japanese write no space between their words. The Dashboard's
|
|
380
|
+
* zh-CN, zh-TW and ja files put one between their words and Latin text, a
|
|
381
|
+
* number or a {{placeholder}} (Dashboard/src/Locales/README.md), which reads
|
|
382
|
+
* right beside a name in Latin letters - "请设置 OneUptime Kubernetes
|
|
383
|
+
* Agent,只需几分钟。" - and wrong beside a term the language words in its
|
|
384
|
+
* own script: "请设置 设备或网关上的 OpenTelemetry 导出器,", "此操作会撤销
|
|
385
|
+
* 数据库 AI 代理 的密钥。" (issue #7864). One key can take a name of either
|
|
386
|
+
* kind - a host's collector is "OpenTelemetry Collector" or "OneUptime
|
|
387
|
+
* 收集器" - so no spacing written into the key reads right for both.
|
|
388
|
+
*
|
|
389
|
+
* So in a sentence of a language that writes no space between its words, a
|
|
390
|
+
* space the template puts between a term (translatableTerm) and a Chinese or
|
|
391
|
+
* Japanese letter is dropped where the term's own letter on that side is
|
|
392
|
+
* Chinese or Japanese too: "请设置设备或网关上的 OpenTelemetry 导出器,",
|
|
393
|
+
* "OneUptime 收集器已不再上报数据", "撤销数据库 AI 代理的密钥". A space
|
|
394
|
+
* beside a Latin letter, a digit or a sign stays ("请设置 OneUptime
|
|
395
|
+
* 收集器"), and so does one beside any other value - a name someone typed, a
|
|
396
|
+
* number, a date, a slot - which the space sets apart as the template wrote
|
|
397
|
+
* it. Two terms side by side meet the same way: "{{action}} {{itemName}}"
|
|
398
|
+
* reads "更新监控器". No space is ever added: a key that writes none reads
|
|
399
|
+
* as it is written.
|
|
400
|
+
*/
|
|
401
|
+
// The languages that write no space between their words: Chinese, Japanese.
|
|
402
|
+
const LANGUAGES_WITHOUT_WORD_SPACES = ["ja", "zh"];
|
|
403
|
+
/*
|
|
404
|
+
* One letter of Chinese or Japanese - a Han character or a kana - by the
|
|
405
|
+
* scripts that use it (its script extensions), as ReadingDirection reads a
|
|
406
|
+
* right-to-left letter: the prolonged sound mark that ends "コレクター"
|
|
407
|
+
* (U+30FC) is a letter of both kana scripts and of neither alone. Not their
|
|
408
|
+
* punctuation ("。", "、", "「"): the space beside it is the template's.
|
|
409
|
+
*/
|
|
410
|
+
const CHINESE_OR_JAPANESE_LETTER = /^(?=[\p{L}\p{Nl}])[\p{Script_Extensions=Han}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}]$/u;
|
|
411
|
+
// Whether `text` starts with a letter of Chinese or Japanese.
|
|
412
|
+
const startsInChineseOrJapanese = (text) => {
|
|
413
|
+
const first = text.codePointAt(0);
|
|
414
|
+
return (first !== undefined &&
|
|
415
|
+
CHINESE_OR_JAPANESE_LETTER.test(String.fromCodePoint(first)));
|
|
416
|
+
};
|
|
417
|
+
// Whether `text` ends with a letter of Chinese or Japanese.
|
|
418
|
+
const endsInChineseOrJapanese = (text) => {
|
|
419
|
+
// Its last character, whole where it is a surrogate pair ("𠀀").
|
|
420
|
+
const last = Array.from(text.slice(-2)).pop() || "";
|
|
421
|
+
return CHINESE_OR_JAPANESE_LETTER.test(last);
|
|
422
|
+
};
|
|
423
|
+
// How many spaces `text` starts with, and how many it ends with.
|
|
424
|
+
const countLeadingSpaces = (text) => {
|
|
425
|
+
let count = 0;
|
|
426
|
+
while (text[count] === " ") {
|
|
427
|
+
count++;
|
|
428
|
+
}
|
|
429
|
+
return count;
|
|
430
|
+
};
|
|
431
|
+
const countTrailingSpaces = (text) => {
|
|
432
|
+
let count = 0;
|
|
433
|
+
while (count < text.length && text[text.length - 1 - count] === " ") {
|
|
434
|
+
count++;
|
|
435
|
+
}
|
|
436
|
+
return count;
|
|
437
|
+
};
|
|
438
|
+
/*
|
|
439
|
+
* The pieces of a filled template (fillPieces), in `language`: in one that
|
|
440
|
+
* writes no space between its words, each space its words put between a
|
|
441
|
+
* term and a letter of Chinese or Japanese is dropped where the term's own
|
|
442
|
+
* letter on that side is one too (WHERE A TERM MEETS CHINESE OR JAPANESE
|
|
443
|
+
* WORDS). The words beside any other value keep their spaces.
|
|
444
|
+
*/
|
|
445
|
+
const closeSpacesBesideTerms = (pieces, language) => {
|
|
446
|
+
if (!LANGUAGES_WITHOUT_WORD_SPACES.includes(getBaseLanguage(language))) {
|
|
447
|
+
return pieces;
|
|
448
|
+
}
|
|
449
|
+
return pieces.map((piece, index) => {
|
|
450
|
+
if (piece.isValue || !piece.text) {
|
|
451
|
+
return piece;
|
|
452
|
+
}
|
|
453
|
+
// The values either side of these words: pieces take turns.
|
|
454
|
+
const before = pieces[index - 1];
|
|
455
|
+
const after = pieces[index + 1];
|
|
456
|
+
const leading = countLeadingSpaces(piece.text);
|
|
457
|
+
// Spaces and nothing else, between two values: two terms meet.
|
|
458
|
+
if (leading === piece.text.length) {
|
|
459
|
+
const termsMeet = Boolean((before === null || before === void 0 ? void 0 : before.isTerm) &&
|
|
460
|
+
(after === null || after === void 0 ? void 0 : after.isTerm) &&
|
|
461
|
+
endsInChineseOrJapanese(before.text) &&
|
|
462
|
+
startsInChineseOrJapanese(after.text));
|
|
463
|
+
return termsMeet ? Object.assign(Object.assign({}, piece), { text: "" }) : piece;
|
|
464
|
+
}
|
|
465
|
+
let text = piece.text;
|
|
466
|
+
if (leading > 0 &&
|
|
467
|
+
(before === null || before === void 0 ? void 0 : before.isTerm) &&
|
|
468
|
+
endsInChineseOrJapanese(before.text) &&
|
|
469
|
+
startsInChineseOrJapanese(text.slice(leading))) {
|
|
470
|
+
text = text.slice(leading);
|
|
471
|
+
}
|
|
472
|
+
const trailing = countTrailingSpaces(text);
|
|
473
|
+
const words = text.slice(0, text.length - trailing);
|
|
474
|
+
if (trailing > 0 &&
|
|
475
|
+
(after === null || after === void 0 ? void 0 : after.isTerm) &&
|
|
476
|
+
startsInChineseOrJapanese(after.text) &&
|
|
477
|
+
endsInChineseOrJapanese(words)) {
|
|
478
|
+
text = words;
|
|
479
|
+
}
|
|
480
|
+
return text === piece.text ? piece : Object.assign(Object.assign({}, piece), { text });
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
/*
|
|
484
|
+
* `template` filled with `values`, in pieces: its words and its values by
|
|
485
|
+
* turns, words first and last (empty where a value starts or ends it). Each
|
|
486
|
+
* value goes in the form its place takes (startsASentence), literally; a
|
|
487
|
+
* placeholder with no value is left among the words as it is. Beside a
|
|
488
|
+
* term, the words keep only the spaces `language` writes
|
|
489
|
+
* (closeSpacesBesideTerms).
|
|
490
|
+
*/
|
|
491
|
+
const fillPieces = (template, values, language) => {
|
|
492
|
+
var _a;
|
|
493
|
+
const pieces = [];
|
|
494
|
+
let words = "";
|
|
495
|
+
let at = 0;
|
|
496
|
+
for (const match of template.matchAll(PLACEHOLDER)) {
|
|
497
|
+
const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
|
|
498
|
+
const name = match[1] || "";
|
|
499
|
+
words += template.slice(at, start);
|
|
500
|
+
at = start + match[0].length;
|
|
501
|
+
if (!Object.prototype.hasOwnProperty.call(values, name)) {
|
|
502
|
+
words += match[0];
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
const value = values[name];
|
|
506
|
+
pieces.push({ text: words, isValue: false, isTerm: false });
|
|
507
|
+
pieces.push({
|
|
508
|
+
text: startsASentence(template, start)
|
|
509
|
+
? value.atSentenceStart
|
|
510
|
+
: value.text,
|
|
511
|
+
isValue: true,
|
|
512
|
+
isTerm: value.isTerm,
|
|
513
|
+
});
|
|
514
|
+
words = "";
|
|
515
|
+
}
|
|
516
|
+
pieces.push({
|
|
517
|
+
text: words + template.slice(at),
|
|
518
|
+
isValue: false,
|
|
519
|
+
isTerm: false,
|
|
520
|
+
});
|
|
521
|
+
return closeSpacesBesideTerms(pieces, language);
|
|
522
|
+
};
|
|
523
|
+
/*
|
|
524
|
+
* `template` with each {{placeholder}} filled from `values`, in the form its
|
|
525
|
+
* place takes (startsASentence), as a sentence in `language` holds it
|
|
526
|
+
* (closeSpacesBesideTerms). A placeholder with no value is left as it is,
|
|
527
|
+
* and each value goes in literally.
|
|
528
|
+
*/
|
|
529
|
+
const fillSentenceValues = (template, values, language) => {
|
|
530
|
+
return fillPieces(template, values, language)
|
|
531
|
+
.map((piece) => {
|
|
532
|
+
return piece.text;
|
|
533
|
+
})
|
|
534
|
+
.join("");
|
|
535
|
+
};
|
|
248
536
|
// A value as the English sentence shows it.
|
|
249
537
|
const englishValue = (value) => {
|
|
250
538
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
@@ -279,7 +567,8 @@ const englishTextValues = (values) => {
|
|
|
279
567
|
const dated = englishDateValues(values);
|
|
280
568
|
const result = {};
|
|
281
569
|
for (const key of Object.keys(dated)) {
|
|
282
|
-
|
|
570
|
+
const value = dated[key];
|
|
571
|
+
result[key] = toSentenceValue(value, englishValue(value), exports.DEFAULT_LANGUAGE);
|
|
283
572
|
}
|
|
284
573
|
return result;
|
|
285
574
|
};
|
|
@@ -300,30 +589,23 @@ const englishTextValues = (values) => {
|
|
|
300
589
|
* A slot's marker (TranslatedSentence, translateTemplateAround) is set
|
|
301
590
|
* apart in a sentence read right to left when asked to (SentenceOptions'
|
|
302
591
|
* setsSlotsApart), so what is drawn there as an element is too; otherwise
|
|
303
|
-
* it is left as it is. As in
|
|
304
|
-
*
|
|
592
|
+
* it is left as it is. As in fillSentenceValues, each value goes in the
|
|
593
|
+
* form its place takes (startsASentence), with the spaces beside a term
|
|
594
|
+
* that `language` writes (closeSpacesBesideTerms), a placeholder with no
|
|
595
|
+
* value is left as it is, and each value goes in literally.
|
|
305
596
|
*/
|
|
306
|
-
const fillSettingValuesApart = (template, values, direction, setsSlotsApart) => {
|
|
307
|
-
|
|
308
|
-
const pieces = [];
|
|
597
|
+
const fillSettingValuesApart = (template, values, direction, setsSlotsApart, language) => {
|
|
598
|
+
const pieces = fillPieces(template, values, language);
|
|
309
599
|
// The sentence with every value as it is: what a number's signs are read in.
|
|
310
600
|
let filled = "";
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
filled
|
|
315
|
-
|
|
316
|
-
for (const match of template.matchAll(PLACEHOLDER)) {
|
|
317
|
-
const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
|
|
318
|
-
const name = match[1] || "";
|
|
319
|
-
const isFilled = Object.prototype.hasOwnProperty.call(values, name);
|
|
320
|
-
addPiece(template.slice(at, start), false);
|
|
321
|
-
addPiece(isFilled ? values[name] : match[0], isFilled);
|
|
322
|
-
at = start + match[0].length;
|
|
601
|
+
// Where each piece starts in it.
|
|
602
|
+
const starts = [];
|
|
603
|
+
for (const piece of pieces) {
|
|
604
|
+
starts.push(filled.length);
|
|
605
|
+
filled += piece.text;
|
|
323
606
|
}
|
|
324
|
-
addPiece(template.slice(at), false);
|
|
325
607
|
return pieces
|
|
326
|
-
.map((piece) => {
|
|
608
|
+
.map((piece, index) => {
|
|
327
609
|
if (!piece.isValue) {
|
|
328
610
|
return piece.text;
|
|
329
611
|
}
|
|
@@ -332,9 +614,10 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
332
614
|
? `${ReadingDirection_1.FIRST_STRONG_ISOLATE}${piece.text}${ReadingDirection_1.POP_DIRECTIONAL_ISOLATE}`
|
|
333
615
|
: piece.text;
|
|
334
616
|
}
|
|
335
|
-
const
|
|
617
|
+
const start = starts[index];
|
|
618
|
+
const end = start + piece.text.length;
|
|
336
619
|
if (direction === ReadingDirection_1.RIGHT_TO_LEFT &&
|
|
337
|
-
(0, ReadingDirection_1.isNumberJoinedToASign)(piece.text, filled.slice(Math.max(0,
|
|
620
|
+
(0, ReadingDirection_1.isNumberJoinedToASign)(piece.text, filled.slice(Math.max(0, start - 2), start), filled.slice(end, end + 2))) {
|
|
338
621
|
return piece.text;
|
|
339
622
|
}
|
|
340
623
|
return (0, ReadingDirection_1.setApartInSentence)(piece.text, direction);
|
|
@@ -342,16 +625,22 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
342
625
|
.join("");
|
|
343
626
|
};
|
|
344
627
|
/*
|
|
345
|
-
* Fills {{key}} placeholders from values
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
628
|
+
* Fills {{key}} placeholders from values, as an English sentence takes them:
|
|
629
|
+
* a word cased for the middle of a sentence takes a capital where it starts
|
|
630
|
+
* one (startsASentence). A placeholder with no value is left as it is, which
|
|
631
|
+
* a test notices and a reader at least recognises as a slot. Each value goes
|
|
632
|
+
* in literally: braces or "$t(" inside a name are never looked up again.
|
|
349
633
|
*/
|
|
350
634
|
const fillTemplate = (template, values = {}) => {
|
|
351
|
-
return template.replace(PLACEHOLDER, (match, key) => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
635
|
+
return template.replace(PLACEHOLDER, (match, key, at) => {
|
|
636
|
+
if (!Object.prototype.hasOwnProperty.call(values, key)) {
|
|
637
|
+
return match;
|
|
638
|
+
}
|
|
639
|
+
const value = values[key];
|
|
640
|
+
const text = englishValue(value);
|
|
641
|
+
return startsASentence(template, at)
|
|
642
|
+
? toSentenceValue(value, text, exports.DEFAULT_LANGUAGE).atSentenceStart
|
|
643
|
+
: text;
|
|
355
644
|
});
|
|
356
645
|
};
|
|
357
646
|
exports.fillTemplate = fillTemplate;
|
|
@@ -463,17 +752,19 @@ const createTranslator = (lookup, language) => {
|
|
|
463
752
|
const result = {};
|
|
464
753
|
for (const key of Object.keys(values)) {
|
|
465
754
|
const value = values[key];
|
|
755
|
+
let text;
|
|
466
756
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
467
|
-
|
|
757
|
+
text = translateTerm(value.translatableTerm, {
|
|
468
758
|
inSentence: value.inSentence,
|
|
469
759
|
});
|
|
470
760
|
}
|
|
471
761
|
else if ((0, exports.isComposedValue)(value)) {
|
|
472
|
-
|
|
762
|
+
text = value.compose(translator);
|
|
473
763
|
}
|
|
474
764
|
else {
|
|
475
|
-
|
|
765
|
+
text = String(value);
|
|
476
766
|
}
|
|
767
|
+
result[key] = toSentenceValue(value, text, activeLanguage);
|
|
477
768
|
}
|
|
478
769
|
return result;
|
|
479
770
|
};
|
|
@@ -484,7 +775,9 @@ const createTranslator = (lookup, language) => {
|
|
|
484
775
|
* English one; then its terms are translated too. Otherwise the English
|
|
485
776
|
* sentence is filled with the English terms - except for a template with no
|
|
486
777
|
* words of its own ("{{action}} {{itemName}}"), which belongs to no
|
|
487
|
-
* language and always takes the reader's words.
|
|
778
|
+
* language and always takes the reader's words. A word cased for the
|
|
779
|
+
* middle of a sentence takes a capital where the sentence starts with it
|
|
780
|
+
* (startsASentence).
|
|
488
781
|
*
|
|
489
782
|
* Asked to (SentenceOptions), each value is set apart from the sentence
|
|
490
783
|
* where it could move the words around it (fillSettingValuesApart), by the
|
|
@@ -501,16 +794,17 @@ const createTranslator = (lookup, language) => {
|
|
|
501
794
|
*/
|
|
502
795
|
if (hasWords(english)) {
|
|
503
796
|
return setsValuesApart
|
|
504
|
-
? fillSettingValuesApart(punctuate(english), englishTextValues(values), ReadingDirection_1.LEFT_TO_RIGHT, setsSlotsApart)
|
|
797
|
+
? fillSettingValuesApart(punctuate(english), englishTextValues(values), ReadingDirection_1.LEFT_TO_RIGHT, setsSlotsApart, exports.DEFAULT_LANGUAGE)
|
|
505
798
|
: (0, exports.fillTemplate)(punctuate(english), englishDateValues(values));
|
|
506
799
|
}
|
|
800
|
+
// No words of its own: the reader's words, as their sentence holds them.
|
|
507
801
|
return setsValuesApart
|
|
508
|
-
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart)
|
|
509
|
-
: (
|
|
802
|
+
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
803
|
+
: fillSentenceValues(punctuate(english), translatedValues(values), activeLanguage);
|
|
510
804
|
}
|
|
511
805
|
return setsValuesApart
|
|
512
|
-
? fillSettingValuesApart(punctuate(stored), translatedValues(values), readerDirection, setsSlotsApart)
|
|
513
|
-
: (
|
|
806
|
+
? fillSettingValuesApart(punctuate(stored), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
807
|
+
: fillSentenceValues(punctuate(stored), translatedValues(values), activeLanguage);
|
|
514
808
|
};
|
|
515
809
|
const translateTemplate = (template, values = {}, options) => {
|
|
516
810
|
return fill(find(template), template, values, options);
|
|
@@ -527,7 +821,8 @@ const createTranslator = (lookup, language) => {
|
|
|
527
821
|
/*
|
|
528
822
|
* The form for `count` the way i18next resolves it: the language's own
|
|
529
823
|
* category ("few" for 3 in Russian) under the key plus "_few", else the key
|
|
530
|
-
* itself, which holds the language's general (other) form
|
|
824
|
+
* itself, which holds the language's general (other) form - with the
|
|
825
|
+
* category of the key it came from ("other" for the key itself).
|
|
531
826
|
*
|
|
532
827
|
* A language's "one" form is said for every count its language calls one
|
|
533
828
|
* - 21 and 31 in Russian, 0 in French. A one form that says exactly one
|
|
@@ -542,22 +837,53 @@ const createTranslator = (lookup, language) => {
|
|
|
542
837
|
if (category !== "other" && !saysOnlyOne) {
|
|
543
838
|
const form = find(`${key}_${category}`);
|
|
544
839
|
if (form !== undefined) {
|
|
545
|
-
return form;
|
|
840
|
+
return { text: form, category };
|
|
546
841
|
}
|
|
547
842
|
}
|
|
548
|
-
|
|
843
|
+
const general = find(key);
|
|
844
|
+
return general === undefined
|
|
845
|
+
? undefined
|
|
846
|
+
: { text: general, category: "other" };
|
|
847
|
+
};
|
|
848
|
+
/*
|
|
849
|
+
* Whether a plural form a locale holds is English left in it - a
|
|
850
|
+
* placeholder, not a translation. A form is read against the English text
|
|
851
|
+
* of its own key, never the other form's: a language's plural can read
|
|
852
|
+
* like English's singular - Italian's "{{count}} host" for 3 hosts, the
|
|
853
|
+
* "{{count}} VM" of French, Spanish, Hindi and Persian for 3 VMs.
|
|
854
|
+
*
|
|
855
|
+
* - A "_one" form is English left in the locale when it reads as
|
|
856
|
+
* English's one form, en.json's text for that key: Russian puts 21 in
|
|
857
|
+
* its "one" form, French puts 0 there, and neither may borrow the
|
|
858
|
+
* English "1 row" for it. Unless the language's general form reads the
|
|
859
|
+
* same: the language then words the sentence alike for every count, and
|
|
860
|
+
* the form is its own - French's "0 VM". A general form left English is
|
|
861
|
+
* never that witness: the lookup gives nothing for a key that maps to
|
|
862
|
+
* itself.
|
|
863
|
+
* - Every other form - the general one, and a "_few", "_many", "_two" or
|
|
864
|
+
* "_zero" one, which en.json has none of - is English left in the
|
|
865
|
+
* locale when it reads as English's other form, what English writes for
|
|
866
|
+
* every count but one. English's one form there is the language's own,
|
|
867
|
+
* as in its general form.
|
|
868
|
+
*/
|
|
869
|
+
const isEnglishPlaceholder = (form, template) => {
|
|
870
|
+
if (form.category !== "one") {
|
|
871
|
+
return form.text === template.other;
|
|
872
|
+
}
|
|
873
|
+
return form.text === template.one && find(template.other) !== form.text;
|
|
549
874
|
};
|
|
550
875
|
const translatePlural = (template, count, values = {}, options) => {
|
|
551
876
|
// English has two forms: exactly one, and everything else.
|
|
552
877
|
const english = count === 1 ? template.one : template.other;
|
|
553
878
|
const stored = findPlural(template.other, count, (0, exports.isOneFormOnlyForOne)(template));
|
|
554
879
|
/*
|
|
555
|
-
* An English form left in a locale is a placeholder, not a translation
|
|
556
|
-
* the sentence is English, in English's form for
|
|
557
|
-
*
|
|
558
|
-
* English "1 row" for it.
|
|
880
|
+
* An English form left in a locale is a placeholder, not a translation
|
|
881
|
+
* (isEnglishPlaceholder): the sentence is English, in English's form for
|
|
882
|
+
* the count.
|
|
559
883
|
*/
|
|
560
|
-
const translated = stored ===
|
|
884
|
+
const translated = stored === undefined || isEnglishPlaceholder(stored, template)
|
|
885
|
+
? undefined
|
|
886
|
+
: stored.text;
|
|
561
887
|
// {{count}} is written the reader's way unless the caller passes its own.
|
|
562
888
|
return fill(translated, english, Object.assign({ count: formatNumber(count) }, values), options);
|
|
563
889
|
};
|
|
@@ -716,7 +1042,7 @@ const getSentencePartsAndLanguage = (data) => {
|
|
|
716
1042
|
};
|
|
717
1043
|
}
|
|
718
1044
|
return {
|
|
719
|
-
parts: split(fillSettingValuesApart(englishTemplate, englishTextValues(englishValues), ReadingDirection_1.LEFT_TO_RIGHT, false)) || [
|
|
1045
|
+
parts: split(fillSettingValuesApart(englishTemplate, englishTextValues(englishValues), ReadingDirection_1.LEFT_TO_RIGHT, false, exports.DEFAULT_LANGUAGE)) || [
|
|
720
1046
|
{
|
|
721
1047
|
kind: "text",
|
|
722
1048
|
text: (0, exports.fillTemplate)(englishTemplate, englishDateValues(Object.assign(Object.assign({}, (isPlural ? { count: data.translator.formatNumber(count) } : {})), (data.values || {})))),
|
|
@@ -272,7 +272,7 @@ const getRunRecordArgument = (metadata) => {
|
|
|
272
272
|
exports.getRunRecordArgument = getRunRecordArgument;
|
|
273
273
|
const CAPITALIZED_WORD_PATTERN = /^\p{Lu}\p{Ll}+$/u;
|
|
274
274
|
/*
|
|
275
|
-
* A model's name in the middle of a sentence: "
|
|
275
|
+
* A model's name in the middle of a sentence: "maintenance event",
|
|
276
276
|
* keeping a word that is not simply capitalized as it is ("IoT Fleet" keeps
|
|
277
277
|
* IoT).
|
|
278
278
|
*/
|
|
@@ -7087,7 +7087,7 @@ const TEMPLATE_DEFINITIONS = [
|
|
|
7087
7087
|
category: WorkflowTemplateCategory.ScheduledMaintenance,
|
|
7088
7088
|
icon: IconProp_1.default.Calendar,
|
|
7089
7089
|
workflowName: "Announce maintenance in Slack",
|
|
7090
|
-
workflowDescription: "Posts to Slack whenever a
|
|
7090
|
+
workflowDescription: "Posts to Slack whenever a maintenance event is created.",
|
|
7091
7091
|
variables: [SLACK_WEBHOOK_URL],
|
|
7092
7092
|
graph: {
|
|
7093
7093
|
nodes: [
|
|
@@ -7139,7 +7139,7 @@ const TEMPLATE_DEFINITIONS = [
|
|
|
7139
7139
|
category: WorkflowTemplateCategory.ScheduledMaintenance,
|
|
7140
7140
|
icon: IconProp_1.default.Calendar,
|
|
7141
7141
|
workflowName: "Announce maintenance in Mattermost",
|
|
7142
|
-
workflowDescription: "Posts to Mattermost whenever a
|
|
7142
|
+
workflowDescription: "Posts to Mattermost whenever a maintenance event is created.",
|
|
7143
7143
|
variables: [MATTERMOST_WEBHOOK_URL],
|
|
7144
7144
|
graph: {
|
|
7145
7145
|
nodes: [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import FilterCondition from "../../Filter/FilterCondition.mjs";
|
|
2
2
|
import NotificationRuleCondition from "./NotificationRuleCondition.mjs";
|
|
3
|
+
import { NotificationRuleUpdateKind } from "./NotificationRuleUpdates.mjs";
|
|
3
4
|
export default interface BaseNotificationRule {
|
|
4
5
|
_type: string;
|
|
5
6
|
filterCondition: FilterCondition;
|
|
@@ -9,4 +10,5 @@ export default interface BaseNotificationRule {
|
|
|
9
10
|
existingTeam?: string;
|
|
10
11
|
shouldPostToExistingChat?: boolean;
|
|
11
12
|
existingChatIds?: Array<string>;
|
|
13
|
+
updatesToPost?: Array<NotificationRuleUpdateKind> | undefined;
|
|
12
14
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import FilterCondition from "../../Filter/FilterCondition";
|
|
2
2
|
import NotificationRuleCondition from "./NotificationRuleCondition";
|
|
3
|
+
import { NotificationRuleUpdateKind } from "./NotificationRuleUpdates";
|
|
3
4
|
export default interface BaseNotificationRule {
|
|
4
5
|
_type: string;
|
|
5
6
|
filterCondition: FilterCondition;
|
|
@@ -9,4 +10,5 @@ export default interface BaseNotificationRule {
|
|
|
9
10
|
existingTeam?: string;
|
|
10
11
|
shouldPostToExistingChat?: boolean;
|
|
11
12
|
existingChatIds?: Array<string>;
|
|
13
|
+
updatesToPost?: Array<NotificationRuleUpdateKind> | undefined;
|
|
12
14
|
}
|