@oneuptime/common 14.0.110 → 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/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.d.mts +1 -0
- package/Models/DatabaseModels/Alert.d.ts +1 -0
- package/Models/DatabaseModels/Alert.js +52 -2
- 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/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.d.mts +1 -0
- package/Models/DatabaseModels/Incident.d.ts +1 -0
- package/Models/DatabaseModels/Incident.js +53 -2
- 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/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/Index.js +6 -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/TelemetryIngestionKey.js +1 -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 +28 -2
- package/Types/AI/AIActionWords.d.ts +28 -2
- package/Types/AI/AIActionWords.js +235 -3
- package/Types/AI/AIActionWords.mjs +8 -0
- package/Types/AI/AIChatTypes.d.mts +3 -1
- package/Types/AI/AIChatTypes.d.ts +3 -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/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 +48 -0
- package/Types/AI/AiRunRefusal.d.ts +48 -0
- package/Types/AI/AiRunRefusal.js +208 -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/AI/ResourceAiAccessPermissions.js +7 -18
- 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/AuditLog/AuditLogActionLabel.js +19 -9
- package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
- package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +32 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +32 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.js +199 -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/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/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/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 +8 -1
- package/Types/Date.d.ts +8 -1
- package/Types/Date.js +61 -7
- package/Types/Date.mjs +1 -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/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/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/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- 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/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -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/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/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/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/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/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/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/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/OpenStack/OpenStackCapacity.js +12 -5
- package/Types/Permission.d.mts +4 -0
- package/Types/Permission.d.ts +4 -0
- package/Types/Permission.js +66 -10
- 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/Product/ProductUsage.js +2 -1
- package/Types/Product/ProjectProductsAnswer.js +2 -1
- 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/ResourceAiAgent/AiResourceType.d.mts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.js +12 -0
- package/Types/Rules/RuleRun.js +2 -2
- 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/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/SetupHealth/SetupHealth.d.mts +1 -0
- package/Types/SetupHealth/SetupHealth.d.ts +1 -0
- package/Types/SetupHealth/SetupHealth.js +13 -5
- package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
- 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/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/StatusPage/StateChangeNoteMessage.d.mts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
- 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/Telemetry/TelemetryIngestionKeyType.js +7 -6
- package/Types/TimezoneAlias.d.mts +1 -0
- package/Types/TimezoneAlias.d.ts +1 -0
- package/Types/TimezoneAlias.js +13 -0
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +470 -63
- 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/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +2 -2
- package/Types/Workflow/WorkflowStatus.js +21 -10
- 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/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/Dashboard/ValueWidgetSeries.d.mts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
- 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/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/Grok/Grok.js +7 -4
- 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/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/LinearRegExp/LinearRegExp.js +5 -1
- 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/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 +5 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +5 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +148 -5
- 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/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 +18 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +18 -0
- package/Utils/Monitor/ProbeFailureReading.js +166 -0
- package/Utils/Monitor/ProbeFailureReading.mjs +8 -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/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 +974 -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 +829 -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/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.d.mts +11 -0
- package/Utils/PromQL/PromQLLabels.d.ts +11 -0
- package/Utils/PromQL/PromQLLabels.js +219 -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 +205 -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 +836 -0
- package/Utils/PromQL/PromQLParser.mjs +4 -0
- package/Utils/PromQL/PromQLRegex.d.mts +20 -0
- package/Utils/PromQL/PromQLRegex.d.ts +20 -0
- package/Utils/PromQL/PromQLRegex.js +1014 -0
- package/Utils/PromQL/PromQLRegex.mjs +5 -0
- package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
- package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
- package/Utils/PromQL/PrometheusResponse.js +92 -0
- package/Utils/PromQL/PrometheusResponse.mjs +3 -0
- 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/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 +5 -1
- package/Utils/Rum/UrlScrubber.d.ts +5 -1
- package/Utils/Rum/UrlScrubber.js +153 -7
- package/Utils/Rum/UserFlow.d.mts +1 -1
- package/Utils/Rum/UserFlow.d.ts +1 -1
- package/Utils/Rum/UserFlow.js +202 -29
- 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/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/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/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 +50 -88
- package/Utils/StateOrder.mjs +2 -0
- package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
- 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.d.mts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.js +113 -26
- package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
- 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
package/Types/Translator.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
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
|
-
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
|
+
const RegExpEscape_1 = __importDefault(require("../Utils/RegExpEscape"));
|
|
4
8
|
const DateLanguage_1 = require("./DateLanguage");
|
|
9
|
+
const MeaningKeys_1 = require("./MeaningKeys");
|
|
10
|
+
const NoBreakSpaces_1 = require("./NoBreakSpaces");
|
|
5
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";
|
|
6
26
|
const translatableTerm = (text, options) => {
|
|
7
27
|
return {
|
|
8
28
|
translatableTerm: text,
|
|
@@ -43,48 +63,109 @@ const getBaseLanguage = (language) => {
|
|
|
43
63
|
};
|
|
44
64
|
/*
|
|
45
65
|
* Languages that capitalize every noun, so a name keeps its capital in the
|
|
46
|
-
* middle of a sentence.
|
|
47
|
-
* Korean, Hindi, Persian) are unaffected by lower-casing either way.
|
|
66
|
+
* middle of a sentence.
|
|
48
67
|
*/
|
|
49
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
|
+
};
|
|
50
102
|
/*
|
|
51
103
|
* Proper nouns that keep their capital wherever they appear. Acronyms
|
|
52
104
|
* ("API", "SLOs") and words with a capital inside them ("OneUptime",
|
|
53
105
|
* "GitHub", "IoT") are kept without being listed.
|
|
106
|
+
*
|
|
107
|
+
* Among them every vendor the product names (issue #7692): the cloud vendors
|
|
108
|
+
* of CloudPlatform, the network vendors of the device catalog (the SNMP
|
|
109
|
+
* vendor templates, the traffic and events setups, the Meraki dashboard) and
|
|
110
|
+
* the integrations - a name said in a sentence ("Meraki devices") is never
|
|
111
|
+
* "meraki". A word that is also a word of its own ("Extreme", "Elastic",
|
|
112
|
+
* "Alto" - "high" in Spanish and Italian) is not listed: it would keep its
|
|
113
|
+
* capital as that word too.
|
|
54
114
|
*/
|
|
55
115
|
const PROPER_NOUNS = [
|
|
116
|
+
"Alertmanager",
|
|
117
|
+
"Alibaba",
|
|
118
|
+
"Arista",
|
|
119
|
+
"Aruba",
|
|
56
120
|
"Azure",
|
|
121
|
+
"Cambium",
|
|
57
122
|
"Ceph",
|
|
123
|
+
"Cisco",
|
|
124
|
+
"Datadog",
|
|
125
|
+
"Dell",
|
|
58
126
|
"Discord",
|
|
59
127
|
"Docker",
|
|
128
|
+
"Fortinet",
|
|
60
129
|
"Google",
|
|
61
130
|
"Grafana",
|
|
131
|
+
"Huawei",
|
|
62
132
|
"Huntress",
|
|
63
133
|
"Jira",
|
|
134
|
+
"Juniper",
|
|
64
135
|
"Kubernetes",
|
|
65
136
|
"Linux",
|
|
66
137
|
"Mattermost",
|
|
138
|
+
"Meraki",
|
|
67
139
|
"Microsoft",
|
|
68
140
|
"Okta",
|
|
69
141
|
"OpenTelemetry",
|
|
142
|
+
"Opsgenie",
|
|
70
143
|
"Podman",
|
|
71
144
|
"Prometheus",
|
|
72
145
|
"Proxmox",
|
|
73
146
|
"OpenStack",
|
|
74
147
|
"Slack",
|
|
148
|
+
"Sophos",
|
|
149
|
+
"Splunk",
|
|
75
150
|
"Swarm",
|
|
76
151
|
"Telegram",
|
|
152
|
+
"Tencent",
|
|
77
153
|
"Terraform",
|
|
78
154
|
"Twilio",
|
|
155
|
+
"Ubiquiti",
|
|
156
|
+
"Vercel",
|
|
79
157
|
"Windows",
|
|
158
|
+
"Zabbix",
|
|
80
159
|
];
|
|
81
160
|
/*
|
|
82
161
|
* Proper nouns of two words: the second keeps its capital after the first
|
|
83
162
|
* ("Google Cloud project", but "cloud resources").
|
|
84
163
|
*/
|
|
85
164
|
const PROPER_NOUN_PAIRS = [
|
|
165
|
+
["Alibaba", "Cloud"],
|
|
86
166
|
["Google", "Cloud"],
|
|
87
167
|
["Microsoft", "Teams"],
|
|
168
|
+
["Tencent", "Cloud"],
|
|
88
169
|
];
|
|
89
170
|
// "API", "SLOs": two capitals in a row.
|
|
90
171
|
const ACRONYM_PATTERN = /\p{Lu}{2,}/u;
|
|
@@ -98,12 +179,13 @@ const keepsItsCase = (part) => {
|
|
|
98
179
|
/*
|
|
99
180
|
* A label as it is written in the middle of a sentence in `language`:
|
|
100
181
|
* "On-Call Duty Policies" -> "on-call duty policies", "API Keys" -> "API
|
|
101
|
-
* keys", "Kubernetes Clusters" -> "Kubernetes clusters"; unchanged in German
|
|
102
|
-
*
|
|
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.
|
|
103
185
|
*/
|
|
104
186
|
const toSentenceTerm = (text, language) => {
|
|
105
187
|
const words = text.trim().split(/\s+/).filter(Boolean);
|
|
106
|
-
if (
|
|
188
|
+
if (keepsTermsAsWritten(language)) {
|
|
107
189
|
return words.join(" ");
|
|
108
190
|
}
|
|
109
191
|
return words
|
|
@@ -245,12 +327,269 @@ const LETTER = /\p{L}/u;
|
|
|
245
327
|
const hasWords = (template) => {
|
|
246
328
|
return LETTER.test(template.replace(PLACEHOLDER, ""));
|
|
247
329
|
};
|
|
330
|
+
/*
|
|
331
|
+
* WHERE A VALUE STARTS A SENTENCE.
|
|
332
|
+
*
|
|
333
|
+
* A word cased for the middle of a sentence (an inSentence term: "le
|
|
334
|
+
* collecteur OneUptime", "monitors") takes a capital where the reader's
|
|
335
|
+
* sentence starts with it: French says "Configurez le collecteur OneUptime"
|
|
336
|
+
* and "Le collecteur OneUptime ne remonte plus de données", Dutch "Monitors
|
|
337
|
+
* zoeken…" (issue #7692). A language puts a value where its grammar wants
|
|
338
|
+
* it, so only the filled sentence knows where it starts one.
|
|
339
|
+
*
|
|
340
|
+
* A placeholder starts a sentence where, past any opening quote, bracket or
|
|
341
|
+
* Spanish opening mark, a line starts, or a sentence's end - ". ", "! ",
|
|
342
|
+
* "? ", "… ", with any closing quote or bracket - comes right before it; or
|
|
343
|
+
* where it starts the template, and the template reads as a sentence: it
|
|
344
|
+
* ends as one does (". ! ? … :"), or holds a sentence's end before more
|
|
345
|
+
* words. A template that does neither is a piece of another sentence -
|
|
346
|
+
* "{{kind}} {{name}}", "{{names}} and {{count}} more" - whose values are
|
|
347
|
+
* cased where that sentence puts them. The full stop of an abbreviation
|
|
348
|
+
* ends no sentence (NOT_A_SENTENCE_END).
|
|
349
|
+
*/
|
|
350
|
+
/*
|
|
351
|
+
* The words a language shortens before the value they introduce, in lower
|
|
352
|
+
* case: "pr. time" (per hour), "kl. 12" (at 12 o'clock), "ca. 5", "z. B.",
|
|
353
|
+
* "bijv.", "máx. 10", "Serienr. 123". Their full stop never ends a
|
|
354
|
+
* sentence: Danish fixes one resource "pr. hændelse", never with a capital.
|
|
355
|
+
* Not a unit after a number ("5 min.", "3 Std."), whose full stop may end
|
|
356
|
+
* one: "Checked every 5 min. 2 more checks are off."
|
|
357
|
+
*/
|
|
358
|
+
const SHORTENED_BEFORE_A_VALUE = [
|
|
359
|
+
"ad es", // Italian: for example ("es" alone is Spanish "is")
|
|
360
|
+
"aprox", // Spanish: about
|
|
361
|
+
"bijv", // Dutch: for example
|
|
362
|
+
"ca", // Danish: about
|
|
363
|
+
"col", // Spanish: column
|
|
364
|
+
"ex", // French, Portuguese: for example ("par ex.", "por ex.")
|
|
365
|
+
"gem", // Dutch: on average
|
|
366
|
+
"gns", // Danish: on average
|
|
367
|
+
"kl", // Danish, Norwegian, Swedish: at (a time)
|
|
368
|
+
"lín", // Spanish: line
|
|
369
|
+
"maks", // Danish, Norwegian: at most
|
|
370
|
+
"max", // German, French, Dutch: at most
|
|
371
|
+
"máx", // Spanish, Portuguese: at most
|
|
372
|
+
"moy", // French: on average
|
|
373
|
+
"n", // Italian: number
|
|
374
|
+
"nr", // Dutch: number
|
|
375
|
+
"pr", // Danish: per
|
|
376
|
+
"prom", // Spanish: on average
|
|
377
|
+
"serienr", // Danish, Dutch, Norwegian: serial number
|
|
378
|
+
"seriennr", // German: serial number
|
|
379
|
+
"z. b", // German: for example ("B." alone may end a sentence: "plan B.")
|
|
380
|
+
"админ", // Russian: administrative
|
|
381
|
+
"макс", // Russian: at most
|
|
382
|
+
"сред", // Russian: on average
|
|
383
|
+
];
|
|
384
|
+
// Those words as a pattern.
|
|
385
|
+
const SHORTENED_WORDS = SHORTENED_BEFORE_A_VALUE.map(RegExpEscape_1.default).join("|");
|
|
386
|
+
/*
|
|
387
|
+
* Right before a full stop that ends no sentence: an abbreviation with a
|
|
388
|
+
* full stop inside ("e.g.", "z.B.", "f.eks.", "т.е."), or one of the words
|
|
389
|
+
* above as a word of its own, in either case ("Ca. 5 timer").
|
|
390
|
+
*/
|
|
391
|
+
const NOT_A_SENTENCE_END = `(?<!\\p{L}\\.\\p{L}{1,3})(?<!(?:^|\\P{L})(?:${SHORTENED_WORDS}))`;
|
|
392
|
+
const SENTENCE_END = `(?:${NOT_A_SENTENCE_END}\\.|[!?…])["'»”’)\\]]*`;
|
|
393
|
+
// What a sentence may open with before its first word.
|
|
394
|
+
const OPENING_MARKS_AT_END = /["'«“„‘‚([¿¡]+$/u;
|
|
395
|
+
// A sentence's end and a space, or a line break, right before a placeholder.
|
|
396
|
+
const SENTENCE_END_BEFORE = new RegExp(`(?:${SENTENCE_END}\\s|\\n)\\s*$`, "iu");
|
|
397
|
+
// A template ending as a sentence does.
|
|
398
|
+
const ENDS_AS_A_SENTENCE = new RegExp(`(?:${SENTENCE_END}|:)\\s*$`, "iu");
|
|
399
|
+
// A sentence's end before more words, inside a template.
|
|
400
|
+
const SENTENCE_END_INSIDE = new RegExp(`${SENTENCE_END}\\s+\\S`, "iu");
|
|
401
|
+
const startsASentence = (template, at) => {
|
|
402
|
+
const before = template
|
|
403
|
+
.slice(0, at)
|
|
404
|
+
.replace(OPENING_MARKS_AT_END, "");
|
|
405
|
+
if (before.trim() === "") {
|
|
406
|
+
return (ENDS_AS_A_SENTENCE.test(template) || SENTENCE_END_INSIDE.test(template));
|
|
407
|
+
}
|
|
408
|
+
return SENTENCE_END_BEFORE.test(before);
|
|
409
|
+
};
|
|
410
|
+
/*
|
|
411
|
+
* `text`, the value as the middle of a sentence in `language` takes it, with
|
|
412
|
+
* its form where it starts one: an inSentence term takes a capital there
|
|
413
|
+
* (toLabelTerm); anything else - a name, a number, a term as written, a
|
|
414
|
+
* composed value - is the same wherever it goes.
|
|
415
|
+
*/
|
|
416
|
+
const toSentenceValue = (value, text, language) => {
|
|
417
|
+
return {
|
|
418
|
+
text,
|
|
419
|
+
atSentenceStart: (0, exports.isTranslatableTerm)(value) && value.inSentence
|
|
420
|
+
? (0, exports.toLabelTerm)(text, language)
|
|
421
|
+
: text,
|
|
422
|
+
isTerm: (0, exports.isTranslatableTerm)(value),
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
/*
|
|
426
|
+
* WHERE A TERM MEETS CHINESE OR JAPANESE WORDS.
|
|
427
|
+
*
|
|
428
|
+
* Chinese and Japanese write no space between their words. The Dashboard's
|
|
429
|
+
* zh-CN, zh-TW and ja files put one between their words and Latin text, a
|
|
430
|
+
* number or a {{placeholder}} (Dashboard/src/Locales/README.md), which reads
|
|
431
|
+
* right beside a name in Latin letters - "请设置 OneUptime Kubernetes
|
|
432
|
+
* Agent,只需几分钟。" - and wrong beside a term the language words in its
|
|
433
|
+
* own script: "请设置 设备或网关上的 OpenTelemetry 导出器,", "此操作会撤销
|
|
434
|
+
* 数据库 AI 代理 的密钥。" (issue #7864). One key can take a name of either
|
|
435
|
+
* kind - a host's collector is "OpenTelemetry Collector" or "OneUptime
|
|
436
|
+
* 收集器" - so no spacing written into the key reads right for both.
|
|
437
|
+
*
|
|
438
|
+
* So in a sentence of a language that writes no space between its words, a
|
|
439
|
+
* space the template puts between a term (translatableTerm) and a Chinese or
|
|
440
|
+
* Japanese letter is dropped where the term's own letter on that side is
|
|
441
|
+
* Chinese or Japanese too: "请设置设备或网关上的 OpenTelemetry 导出器,",
|
|
442
|
+
* "OneUptime 收集器已不再上报数据", "撤销数据库 AI 代理的密钥". A space
|
|
443
|
+
* beside a Latin letter, a digit or a sign stays ("请设置 OneUptime
|
|
444
|
+
* 收集器"), and so does one beside any other value - a name someone typed, a
|
|
445
|
+
* number, a date, a slot - which the space sets apart as the template wrote
|
|
446
|
+
* it. Two terms side by side meet the same way: "{{action}} {{itemName}}"
|
|
447
|
+
* reads "更新监控器". No space is ever added: a key that writes none reads
|
|
448
|
+
* as it is written.
|
|
449
|
+
*/
|
|
450
|
+
// The languages that write no space between their words: Chinese, Japanese.
|
|
451
|
+
const LANGUAGES_WITHOUT_WORD_SPACES = ["ja", "zh"];
|
|
452
|
+
/*
|
|
453
|
+
* One letter of Chinese or Japanese - a Han character or a kana - by the
|
|
454
|
+
* scripts that use it (its script extensions), as ReadingDirection reads a
|
|
455
|
+
* right-to-left letter: the prolonged sound mark that ends "コレクター"
|
|
456
|
+
* (U+30FC) is a letter of both kana scripts and of neither alone. Not their
|
|
457
|
+
* punctuation ("。", "、", "「"): the space beside it is the template's.
|
|
458
|
+
*/
|
|
459
|
+
const CHINESE_OR_JAPANESE_LETTER = /^(?=[\p{L}\p{Nl}])[\p{Script_Extensions=Han}\p{Script_Extensions=Hiragana}\p{Script_Extensions=Katakana}]$/u;
|
|
460
|
+
// Whether `text` starts with a letter of Chinese or Japanese.
|
|
461
|
+
const startsInChineseOrJapanese = (text) => {
|
|
462
|
+
const first = text.codePointAt(0);
|
|
463
|
+
return (first !== undefined &&
|
|
464
|
+
CHINESE_OR_JAPANESE_LETTER.test(String.fromCodePoint(first)));
|
|
465
|
+
};
|
|
466
|
+
// Whether `text` ends with a letter of Chinese or Japanese.
|
|
467
|
+
const endsInChineseOrJapanese = (text) => {
|
|
468
|
+
// Its last character, whole where it is a surrogate pair ("𠀀").
|
|
469
|
+
const last = Array.from(text.slice(-2)).pop() || "";
|
|
470
|
+
return CHINESE_OR_JAPANESE_LETTER.test(last);
|
|
471
|
+
};
|
|
472
|
+
// How many spaces `text` starts with, and how many it ends with.
|
|
473
|
+
const countLeadingSpaces = (text) => {
|
|
474
|
+
let count = 0;
|
|
475
|
+
while (text[count] === " ") {
|
|
476
|
+
count++;
|
|
477
|
+
}
|
|
478
|
+
return count;
|
|
479
|
+
};
|
|
480
|
+
const countTrailingSpaces = (text) => {
|
|
481
|
+
let count = 0;
|
|
482
|
+
while (count < text.length && text[text.length - 1 - count] === " ") {
|
|
483
|
+
count++;
|
|
484
|
+
}
|
|
485
|
+
return count;
|
|
486
|
+
};
|
|
487
|
+
/*
|
|
488
|
+
* The pieces of a filled template (fillPieces), in `language`: in one that
|
|
489
|
+
* writes no space between its words, each space its words put between a
|
|
490
|
+
* term and a letter of Chinese or Japanese is dropped where the term's own
|
|
491
|
+
* letter on that side is one too (WHERE A TERM MEETS CHINESE OR JAPANESE
|
|
492
|
+
* WORDS). The words beside any other value keep their spaces.
|
|
493
|
+
*/
|
|
494
|
+
const closeSpacesBesideTerms = (pieces, language) => {
|
|
495
|
+
if (!LANGUAGES_WITHOUT_WORD_SPACES.includes(getBaseLanguage(language))) {
|
|
496
|
+
return pieces;
|
|
497
|
+
}
|
|
498
|
+
return pieces.map((piece, index) => {
|
|
499
|
+
if (piece.isValue || !piece.text) {
|
|
500
|
+
return piece;
|
|
501
|
+
}
|
|
502
|
+
// The values either side of these words: pieces take turns.
|
|
503
|
+
const before = pieces[index - 1];
|
|
504
|
+
const after = pieces[index + 1];
|
|
505
|
+
const leading = countLeadingSpaces(piece.text);
|
|
506
|
+
// Spaces and nothing else, between two values: two terms meet.
|
|
507
|
+
if (leading === piece.text.length) {
|
|
508
|
+
const termsMeet = Boolean((before === null || before === void 0 ? void 0 : before.isTerm) &&
|
|
509
|
+
(after === null || after === void 0 ? void 0 : after.isTerm) &&
|
|
510
|
+
endsInChineseOrJapanese(before.text) &&
|
|
511
|
+
startsInChineseOrJapanese(after.text));
|
|
512
|
+
return termsMeet ? Object.assign(Object.assign({}, piece), { text: "" }) : piece;
|
|
513
|
+
}
|
|
514
|
+
let text = piece.text;
|
|
515
|
+
if (leading > 0 &&
|
|
516
|
+
(before === null || before === void 0 ? void 0 : before.isTerm) &&
|
|
517
|
+
endsInChineseOrJapanese(before.text) &&
|
|
518
|
+
startsInChineseOrJapanese(text.slice(leading))) {
|
|
519
|
+
text = text.slice(leading);
|
|
520
|
+
}
|
|
521
|
+
const trailing = countTrailingSpaces(text);
|
|
522
|
+
const words = text.slice(0, text.length - trailing);
|
|
523
|
+
if (trailing > 0 &&
|
|
524
|
+
(after === null || after === void 0 ? void 0 : after.isTerm) &&
|
|
525
|
+
startsInChineseOrJapanese(after.text) &&
|
|
526
|
+
endsInChineseOrJapanese(words)) {
|
|
527
|
+
text = words;
|
|
528
|
+
}
|
|
529
|
+
return text === piece.text ? piece : Object.assign(Object.assign({}, piece), { text });
|
|
530
|
+
});
|
|
531
|
+
};
|
|
532
|
+
/*
|
|
533
|
+
* `template` filled with `values`, in pieces: its words and its values by
|
|
534
|
+
* turns, words first and last (empty where a value starts or ends it). Each
|
|
535
|
+
* value goes in the form its place takes (startsASentence), literally; a
|
|
536
|
+
* placeholder with no value is left among the words as it is. Beside a
|
|
537
|
+
* term, the words keep only the spaces `language` writes
|
|
538
|
+
* (closeSpacesBesideTerms).
|
|
539
|
+
*/
|
|
540
|
+
const fillPieces = (template, values, language) => {
|
|
541
|
+
var _a;
|
|
542
|
+
const pieces = [];
|
|
543
|
+
let words = "";
|
|
544
|
+
let at = 0;
|
|
545
|
+
for (const match of template.matchAll(PLACEHOLDER)) {
|
|
546
|
+
const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
|
|
547
|
+
const name = match[1] || "";
|
|
548
|
+
words += template.slice(at, start);
|
|
549
|
+
at = start + match[0].length;
|
|
550
|
+
if (!Object.prototype.hasOwnProperty.call(values, name)) {
|
|
551
|
+
words += match[0];
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const value = values[name];
|
|
555
|
+
pieces.push({ text: words, isValue: false, isTerm: false });
|
|
556
|
+
pieces.push({
|
|
557
|
+
text: startsASentence(template, start)
|
|
558
|
+
? value.atSentenceStart
|
|
559
|
+
: value.text,
|
|
560
|
+
isValue: true,
|
|
561
|
+
isTerm: value.isTerm,
|
|
562
|
+
});
|
|
563
|
+
words = "";
|
|
564
|
+
}
|
|
565
|
+
pieces.push({
|
|
566
|
+
text: words + template.slice(at),
|
|
567
|
+
isValue: false,
|
|
568
|
+
isTerm: false,
|
|
569
|
+
});
|
|
570
|
+
return closeSpacesBesideTerms(pieces, language);
|
|
571
|
+
};
|
|
572
|
+
/*
|
|
573
|
+
* `template` with each {{placeholder}} filled from `values`, in the form its
|
|
574
|
+
* place takes (startsASentence), as a sentence in `language` holds it
|
|
575
|
+
* (closeSpacesBesideTerms). A placeholder with no value is left as it is,
|
|
576
|
+
* and each value goes in literally.
|
|
577
|
+
*/
|
|
578
|
+
const fillSentenceValues = (template, values, language) => {
|
|
579
|
+
return fillPieces(template, values, language)
|
|
580
|
+
.map((piece) => {
|
|
581
|
+
return piece.text;
|
|
582
|
+
})
|
|
583
|
+
.join("");
|
|
584
|
+
};
|
|
248
585
|
// A value as the English sentence shows it.
|
|
249
586
|
const englishValue = (value) => {
|
|
250
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);
|
|
251
590
|
return value.inSentence
|
|
252
|
-
? (0, exports.toSentenceTerm)(
|
|
253
|
-
:
|
|
591
|
+
? (0, exports.toSentenceTerm)(term, exports.DEFAULT_LANGUAGE)
|
|
592
|
+
: term.trim();
|
|
254
593
|
}
|
|
255
594
|
if ((0, exports.isComposedValue)(value)) {
|
|
256
595
|
return value.compose(getEnglishTranslator());
|
|
@@ -279,7 +618,8 @@ const englishTextValues = (values) => {
|
|
|
279
618
|
const dated = englishDateValues(values);
|
|
280
619
|
const result = {};
|
|
281
620
|
for (const key of Object.keys(dated)) {
|
|
282
|
-
|
|
621
|
+
const value = dated[key];
|
|
622
|
+
result[key] = toSentenceValue(value, englishValue(value), exports.DEFAULT_LANGUAGE);
|
|
283
623
|
}
|
|
284
624
|
return result;
|
|
285
625
|
};
|
|
@@ -300,30 +640,23 @@ const englishTextValues = (values) => {
|
|
|
300
640
|
* A slot's marker (TranslatedSentence, translateTemplateAround) is set
|
|
301
641
|
* apart in a sentence read right to left when asked to (SentenceOptions'
|
|
302
642
|
* setsSlotsApart), so what is drawn there as an element is too; otherwise
|
|
303
|
-
* it is left as it is. As in
|
|
304
|
-
*
|
|
643
|
+
* it is left as it is. As in fillSentenceValues, each value goes in the
|
|
644
|
+
* form its place takes (startsASentence), with the spaces beside a term
|
|
645
|
+
* that `language` writes (closeSpacesBesideTerms), a placeholder with no
|
|
646
|
+
* value is left as it is, and each value goes in literally.
|
|
305
647
|
*/
|
|
306
|
-
const fillSettingValuesApart = (template, values, direction, setsSlotsApart) => {
|
|
307
|
-
|
|
308
|
-
const pieces = [];
|
|
648
|
+
const fillSettingValuesApart = (template, values, direction, setsSlotsApart, language) => {
|
|
649
|
+
const pieces = fillPieces(template, values, language);
|
|
309
650
|
// The sentence with every value as it is: what a number's signs are read in.
|
|
310
651
|
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;
|
|
652
|
+
// Where each piece starts in it.
|
|
653
|
+
const starts = [];
|
|
654
|
+
for (const piece of pieces) {
|
|
655
|
+
starts.push(filled.length);
|
|
656
|
+
filled += piece.text;
|
|
323
657
|
}
|
|
324
|
-
addPiece(template.slice(at), false);
|
|
325
658
|
return pieces
|
|
326
|
-
.map((piece) => {
|
|
659
|
+
.map((piece, index) => {
|
|
327
660
|
if (!piece.isValue) {
|
|
328
661
|
return piece.text;
|
|
329
662
|
}
|
|
@@ -332,9 +665,10 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
332
665
|
? `${ReadingDirection_1.FIRST_STRONG_ISOLATE}${piece.text}${ReadingDirection_1.POP_DIRECTIONAL_ISOLATE}`
|
|
333
666
|
: piece.text;
|
|
334
667
|
}
|
|
335
|
-
const
|
|
668
|
+
const start = starts[index];
|
|
669
|
+
const end = start + piece.text.length;
|
|
336
670
|
if (direction === ReadingDirection_1.RIGHT_TO_LEFT &&
|
|
337
|
-
(0, ReadingDirection_1.isNumberJoinedToASign)(piece.text, filled.slice(Math.max(0,
|
|
671
|
+
(0, ReadingDirection_1.isNumberJoinedToASign)(piece.text, filled.slice(Math.max(0, start - 2), start), filled.slice(end, end + 2))) {
|
|
338
672
|
return piece.text;
|
|
339
673
|
}
|
|
340
674
|
return (0, ReadingDirection_1.setApartInSentence)(piece.text, direction);
|
|
@@ -342,16 +676,22 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
342
676
|
.join("");
|
|
343
677
|
};
|
|
344
678
|
/*
|
|
345
|
-
* Fills {{key}} placeholders from values
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
679
|
+
* Fills {{key}} placeholders from values, as an English sentence takes them:
|
|
680
|
+
* a word cased for the middle of a sentence takes a capital where it starts
|
|
681
|
+
* one (startsASentence). A placeholder with no value is left as it is, which
|
|
682
|
+
* a test notices and a reader at least recognises as a slot. Each value goes
|
|
683
|
+
* in literally: braces or "$t(" inside a name are never looked up again.
|
|
349
684
|
*/
|
|
350
685
|
const fillTemplate = (template, values = {}) => {
|
|
351
|
-
return template.replace(PLACEHOLDER, (match, key) => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
686
|
+
return template.replace(PLACEHOLDER, (match, key, at) => {
|
|
687
|
+
if (!Object.prototype.hasOwnProperty.call(values, key)) {
|
|
688
|
+
return match;
|
|
689
|
+
}
|
|
690
|
+
const value = values[key];
|
|
691
|
+
const text = englishValue(value);
|
|
692
|
+
return startsASentence(template, at)
|
|
693
|
+
? toSentenceValue(value, text, exports.DEFAULT_LANGUAGE).atSentenceStart
|
|
694
|
+
: text;
|
|
355
695
|
});
|
|
356
696
|
};
|
|
357
697
|
exports.fillTemplate = fillTemplate;
|
|
@@ -416,6 +756,15 @@ const createTranslator = (lookup, language) => {
|
|
|
416
756
|
const punctuate = (words) => {
|
|
417
757
|
return punctuateInLanguage(words, activeLanguage);
|
|
418
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
|
+
};
|
|
419
768
|
// The stored wording for `key`, or undefined when nothing has one.
|
|
420
769
|
const find = (key) => {
|
|
421
770
|
if (!lookup || !key) {
|
|
@@ -423,7 +772,16 @@ const createTranslator = (lookup, language) => {
|
|
|
423
772
|
}
|
|
424
773
|
try {
|
|
425
774
|
const result = lookup(key);
|
|
426
|
-
|
|
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)
|
|
427
785
|
? result
|
|
428
786
|
: undefined;
|
|
429
787
|
}
|
|
@@ -435,26 +793,35 @@ const createTranslator = (lookup, language) => {
|
|
|
435
793
|
if (typeof text !== "string" || text.length === 0) {
|
|
436
794
|
return text;
|
|
437
795
|
}
|
|
438
|
-
|
|
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
|
+
*/
|
|
439
800
|
const stored = find(text);
|
|
440
|
-
return stored === undefined
|
|
801
|
+
return stored === undefined
|
|
802
|
+
? (0, MeaningKeys_1.withMeaningKeyAsItsWord)(text)
|
|
803
|
+
: setWording(stored, text);
|
|
441
804
|
};
|
|
442
805
|
const hasTranslation = (text) => {
|
|
443
806
|
return find(text) !== undefined;
|
|
444
807
|
};
|
|
445
808
|
const translateTerm = (text, options) => {
|
|
446
|
-
var _a;
|
|
447
809
|
if (!text) {
|
|
448
810
|
return "";
|
|
449
811
|
}
|
|
450
|
-
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);
|
|
451
816
|
if (!(options === null || options === void 0 ? void 0 : options.inSentence)) {
|
|
452
817
|
return translated.trim();
|
|
453
818
|
}
|
|
454
819
|
/*
|
|
455
820
|
* Cased the reader's way, translated or not: a German noun spelled as in
|
|
456
|
-
* English ("Labels", "Monitor") keeps its capital in a German sentence
|
|
457
|
-
*
|
|
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.
|
|
458
825
|
*/
|
|
459
826
|
return (0, exports.toSentenceTerm)(translated, activeLanguage);
|
|
460
827
|
};
|
|
@@ -463,17 +830,19 @@ const createTranslator = (lookup, language) => {
|
|
|
463
830
|
const result = {};
|
|
464
831
|
for (const key of Object.keys(values)) {
|
|
465
832
|
const value = values[key];
|
|
833
|
+
let text;
|
|
466
834
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
467
|
-
|
|
835
|
+
text = translateTerm(value.translatableTerm, {
|
|
468
836
|
inSentence: value.inSentence,
|
|
469
837
|
});
|
|
470
838
|
}
|
|
471
839
|
else if ((0, exports.isComposedValue)(value)) {
|
|
472
|
-
|
|
840
|
+
text = value.compose(translator);
|
|
473
841
|
}
|
|
474
842
|
else {
|
|
475
|
-
|
|
843
|
+
text = String(value);
|
|
476
844
|
}
|
|
845
|
+
result[key] = toSentenceValue(value, text, activeLanguage);
|
|
477
846
|
}
|
|
478
847
|
return result;
|
|
479
848
|
};
|
|
@@ -484,7 +853,9 @@ const createTranslator = (lookup, language) => {
|
|
|
484
853
|
* English one; then its terms are translated too. Otherwise the English
|
|
485
854
|
* sentence is filled with the English terms - except for a template with no
|
|
486
855
|
* words of its own ("{{action}} {{itemName}}"), which belongs to no
|
|
487
|
-
* language and always takes the reader's words.
|
|
856
|
+
* language and always takes the reader's words. A word cased for the
|
|
857
|
+
* middle of a sentence takes a capital where the sentence starts with it
|
|
858
|
+
* (startsASentence).
|
|
488
859
|
*
|
|
489
860
|
* Asked to (SentenceOptions), each value is set apart from the sentence
|
|
490
861
|
* where it could move the words around it (fillSettingValuesApart), by the
|
|
@@ -501,16 +872,17 @@ const createTranslator = (lookup, language) => {
|
|
|
501
872
|
*/
|
|
502
873
|
if (hasWords(english)) {
|
|
503
874
|
return setsValuesApart
|
|
504
|
-
? fillSettingValuesApart(punctuate(english), englishTextValues(values), ReadingDirection_1.LEFT_TO_RIGHT, setsSlotsApart)
|
|
875
|
+
? fillSettingValuesApart(punctuate(english), englishTextValues(values), ReadingDirection_1.LEFT_TO_RIGHT, setsSlotsApart, exports.DEFAULT_LANGUAGE)
|
|
505
876
|
: (0, exports.fillTemplate)(punctuate(english), englishDateValues(values));
|
|
506
877
|
}
|
|
878
|
+
// No words of its own: the reader's words, as their sentence holds them.
|
|
507
879
|
return setsValuesApart
|
|
508
|
-
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart)
|
|
509
|
-
: (
|
|
880
|
+
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
881
|
+
: fillSentenceValues(punctuate(english), translatedValues(values), activeLanguage);
|
|
510
882
|
}
|
|
511
883
|
return setsValuesApart
|
|
512
|
-
? fillSettingValuesApart(
|
|
513
|
-
: (
|
|
884
|
+
? fillSettingValuesApart(setWording(stored, english), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
885
|
+
: fillSentenceValues(setWording(stored, english), translatedValues(values), activeLanguage);
|
|
514
886
|
};
|
|
515
887
|
const translateTemplate = (template, values = {}, options) => {
|
|
516
888
|
return fill(find(template), template, values, options);
|
|
@@ -527,7 +899,8 @@ const createTranslator = (lookup, language) => {
|
|
|
527
899
|
/*
|
|
528
900
|
* The form for `count` the way i18next resolves it: the language's own
|
|
529
901
|
* category ("few" for 3 in Russian) under the key plus "_few", else the key
|
|
530
|
-
* itself, which holds the language's general (other) form
|
|
902
|
+
* itself, which holds the language's general (other) form - with the
|
|
903
|
+
* category of the key it came from ("other" for the key itself).
|
|
531
904
|
*
|
|
532
905
|
* A language's "one" form is said for every count its language calls one
|
|
533
906
|
* - 21 and 31 in Russian, 0 in French. A one form that says exactly one
|
|
@@ -542,22 +915,56 @@ const createTranslator = (lookup, language) => {
|
|
|
542
915
|
if (category !== "other" && !saysOnlyOne) {
|
|
543
916
|
const form = find(`${key}_${category}`);
|
|
544
917
|
if (form !== undefined) {
|
|
545
|
-
return form;
|
|
918
|
+
return { text: form, category };
|
|
546
919
|
}
|
|
547
920
|
}
|
|
548
|
-
|
|
921
|
+
const general = find(key);
|
|
922
|
+
return general === undefined
|
|
923
|
+
? undefined
|
|
924
|
+
: { text: general, category: "other" };
|
|
925
|
+
};
|
|
926
|
+
/*
|
|
927
|
+
* Whether a plural form a locale holds is English left in it - a
|
|
928
|
+
* placeholder, not a translation. A form is read against the English text
|
|
929
|
+
* of its own key, never the other form's: a language's plural can read
|
|
930
|
+
* like English's singular - Italian's "{{count}} host" for 3 hosts, the
|
|
931
|
+
* "{{count}} VM" of French, Spanish, Hindi and Persian for 3 VMs.
|
|
932
|
+
*
|
|
933
|
+
* - A "_one" form is English left in the locale when it reads as
|
|
934
|
+
* English's one form, en.json's text for that key: Russian puts 21 in
|
|
935
|
+
* its "one" form, French puts 0 there, and neither may borrow the
|
|
936
|
+
* English "1 row" for it. Unless the language's general form reads the
|
|
937
|
+
* same: the language then words the sentence alike for every count, and
|
|
938
|
+
* the form is its own - French's "0 VM". A general form left English is
|
|
939
|
+
* never that witness: the lookup gives nothing for a key that maps to
|
|
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".
|
|
942
|
+
* - Every other form - the general one, and a "_few", "_many", "_two" or
|
|
943
|
+
* "_zero" one, which en.json has none of - is English left in the
|
|
944
|
+
* locale when it reads as English's other form, what English writes for
|
|
945
|
+
* every count but one. English's one form there is the language's own,
|
|
946
|
+
* as in its general form.
|
|
947
|
+
*/
|
|
948
|
+
const isEnglishPlaceholder = (form, template) => {
|
|
949
|
+
if (form.category !== "one") {
|
|
950
|
+
return form.text === template.other;
|
|
951
|
+
}
|
|
952
|
+
return (form.text === template.one &&
|
|
953
|
+
find(template.other) !== form.text &&
|
|
954
|
+
find(`${template.other}_one${exports.SAME_AS_ENGLISH_MARK}`) !== form.text);
|
|
549
955
|
};
|
|
550
956
|
const translatePlural = (template, count, values = {}, options) => {
|
|
551
957
|
// English has two forms: exactly one, and everything else.
|
|
552
958
|
const english = count === 1 ? template.one : template.other;
|
|
553
959
|
const stored = findPlural(template.other, count, (0, exports.isOneFormOnlyForOne)(template));
|
|
554
960
|
/*
|
|
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.
|
|
961
|
+
* An English form left in a locale is a placeholder, not a translation
|
|
962
|
+
* (isEnglishPlaceholder): the sentence is English, in English's form for
|
|
963
|
+
* the count.
|
|
559
964
|
*/
|
|
560
|
-
const translated = stored ===
|
|
965
|
+
const translated = stored === undefined || isEnglishPlaceholder(stored, template)
|
|
966
|
+
? undefined
|
|
967
|
+
: stored.text;
|
|
561
968
|
// {{count}} is written the reader's way unless the caller passes its own.
|
|
562
969
|
return fill(translated, english, Object.assign({ count: formatNumber(count) }, values), options);
|
|
563
970
|
};
|
|
@@ -716,7 +1123,7 @@ const getSentencePartsAndLanguage = (data) => {
|
|
|
716
1123
|
};
|
|
717
1124
|
}
|
|
718
1125
|
return {
|
|
719
|
-
parts: split(fillSettingValuesApart(englishTemplate, englishTextValues(englishValues), ReadingDirection_1.LEFT_TO_RIGHT, false)) || [
|
|
1126
|
+
parts: split(fillSettingValuesApart(englishTemplate, englishTextValues(englishValues), ReadingDirection_1.LEFT_TO_RIGHT, false, exports.DEFAULT_LANGUAGE)) || [
|
|
720
1127
|
{
|
|
721
1128
|
kind: "text",
|
|
722
1129
|
text: (0, exports.fillTemplate)(englishTemplate, englishDateValues(Object.assign(Object.assign({}, (isPlural ? { count: data.translator.formatNumber(count) } : {})), (data.values || {})))),
|