@oneuptime/common 14.0.109 → 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/AnalyticsModels/SecurityEvent.js +1 -1
- package/Models/DatabaseModels/AIInsight.js +2 -2
- 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 +20 -4
- package/Models/DatabaseModels/AlertEpisode.js +2 -2
- package/Models/DatabaseModels/AlertEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.js +48 -2
- package/Models/DatabaseModels/AlertOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertSeverity.js +13 -4
- package/Models/DatabaseModels/AlertState.js +1 -1
- package/Models/DatabaseModels/CallLog.js +12 -12
- package/Models/DatabaseModels/DataStore.js +9 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.mts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.ts +2 -0
- package/Models/DatabaseModels/EmailLog.js +14 -14
- package/Models/DatabaseModels/Form.js +3 -3
- package/Models/DatabaseModels/FormSubmission.js +6 -6
- package/Models/DatabaseModels/GlobalConfig.d.mts +1 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +1 -0
- package/Models/DatabaseModels/GlobalConfig.js +74 -45
- package/Models/DatabaseModels/Incident.js +20 -4
- package/Models/DatabaseModels/IncidentEpisode.js +2 -2
- package/Models/DatabaseModels/IncidentEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.js +48 -2
- package/Models/DatabaseModels/IncidentOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentSeverity.js +13 -4
- package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/IncidentState.js +1 -1
- package/Models/DatabaseModels/IncidentTemplate.js +2 -2
- package/Models/DatabaseModels/Index.js +4 -0
- package/Models/DatabaseModels/InventoryItem.js +11 -0
- package/Models/DatabaseModels/Monitor.js +54 -20
- 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.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +64 -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/OnCallDutyPolicy.js +4 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRule.js +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleSchedule.js +8 -5
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleTeam.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleUser.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +28 -11
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +10 -7
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +16 -11
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerTeam.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerUser.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.js +6 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +4 -4
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +3 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -6
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +9 -6
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
- package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
- package/Models/DatabaseModels/Project.d.mts +3 -0
- package/Models/DatabaseModels/Project.d.ts +3 -0
- package/Models/DatabaseModels/Project.js +142 -5
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
- package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.mts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.ts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.js +52 -3
- package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
- package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
- package/Models/DatabaseModels/PushNotificationLog.js +12 -12
- package/Models/DatabaseModels/Reseller.js +8 -2
- package/Models/DatabaseModels/ResellerPlan.js +8 -2
- package/Models/DatabaseModels/RunbookExecution.js +2 -2
- package/Models/DatabaseModels/RunbookRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenance.js +9 -6
- package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +3 -3
- 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 +10 -7
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
- package/Models/DatabaseModels/Service.js +1 -1
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +4 -4
- package/Models/DatabaseModels/ServiceLevelObjectiveErrorBudgetPolicyTier.js +4 -4
- package/Models/DatabaseModels/SmsLog.js +12 -12
- package/Models/DatabaseModels/StatusPage.js +5 -5
- package/Models/DatabaseModels/StatusPageSubscriber.js +2 -2
- package/Models/DatabaseModels/TeamMember.js +10 -1
- package/Models/DatabaseModels/TelegramLog.js +12 -12
- package/Models/DatabaseModels/TelemetryIngestionKey.js +8 -5
- package/Models/DatabaseModels/TelemetryIngestionKeyRefusal.js +7 -4
- package/Models/DatabaseModels/User.d.mts +4 -0
- package/Models/DatabaseModels/User.d.ts +4 -0
- package/Models/DatabaseModels/User.js +100 -0
- package/Models/DatabaseModels/UserOnCallLog.js +6 -6
- package/Models/DatabaseModels/UserOnCallLogTimeline.js +3 -3
- package/Models/DatabaseModels/UserOnCallShiftReminderLog.js +2 -2
- package/Models/DatabaseModels/WebhookLog.js +12 -12
- package/Models/DatabaseModels/WhatsAppLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationLog.js +12 -12
- 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 +4 -2
- package/Types/AI/AIChatTypes.d.ts +4 -2
- package/Types/AI/AIChatTypes.js +5 -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 +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/Analytics/ProductEvent.d.mts +6 -1
- package/Types/Analytics/ProductEvent.d.ts +6 -1
- package/Types/Analytics/ProductEvent.js +41 -0
- package/Types/AuditLog/AuditLogCoverage.d.mts +1 -0
- package/Types/AuditLog/AuditLogCoverage.d.ts +1 -0
- package/Types/AuditLog/AuditLogCoverage.js +4 -2
- 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/Cloud/CloudResourceCatalog.d.mts +2 -0
- package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
- package/Types/Cloud/CloudResourceCatalog.js +33 -3
- package/Types/Cloud/CloudResourceCatalog.mjs +1 -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/DataCheckSuggestions.d.mts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.d.ts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.js +102 -65
- package/Types/DataObservability/DataCheckSuggestions.mjs +1 -0
- package/Types/Database/TableMetadata.d.mts +2 -0
- package/Types/Database/TableMetadata.d.ts +2 -0
- package/Types/Database/TableMetadata.js +6 -0
- package/Types/Date.d.mts +26 -2
- package/Types/Date.d.ts +26 -2
- package/Types/Date.js +81 -9
- package/Types/Date.mjs +1 -0
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +44 -2
- package/Types/DateLanguage.mjs +2 -0
- package/Types/DirectionArrow.d.mts +7 -0
- package/Types/DirectionArrow.d.ts +7 -0
- package/Types/DirectionArrow.js +88 -0
- package/Types/DirectionArrow.mjs +7 -0
- package/Types/Docs/GlossaryTerm.d.mts +1 -0
- package/Types/Docs/GlossaryTerm.d.ts +1 -0
- package/Types/Docs/GlossaryTerm.js +2 -0
- package/Types/Docs/RetiredNames.d.mts +11 -0
- package/Types/Docs/RetiredNames.d.ts +11 -0
- package/Types/Docs/RetiredNames.js +139 -0
- package/Types/Docs/RetiredNames.mjs +3 -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/RefusalWithValues.d.mts +7 -0
- package/Types/Exception/RefusalWithValues.d.ts +7 -0
- package/Types/Exception/RefusalWithValues.js +76 -0
- package/Types/Exception/RefusalWithValues.mjs +3 -0
- package/Types/Exception/UnexplainedError.d.mts +13 -0
- package/Types/Exception/UnexplainedError.d.ts +13 -0
- package/Types/Exception/UnexplainedError.js +53 -1
- package/Types/Exception/UnexplainedError.mjs +1 -0
- package/Types/File/FileSize.d.mts +4 -1
- package/Types/File/FileSize.d.ts +4 -1
- package/Types/File/FileSize.js +18 -17
- package/Types/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- package/Types/HostCollector/HostCollector.d.mts +1 -0
- package/Types/HostCollector/HostCollector.d.ts +1 -0
- package/Types/HostCollector/HostCollector.js +26 -10
- package/Types/HostCollector/HostCollector.mjs +1 -0
- package/Types/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -0
- package/Types/Monitor/MonitorCriteria.js +2 -2
- 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/MonitorStep.js +1 -1
- package/Types/Monitor/MonitorTemplateSyncField.d.mts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.d.ts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.js +106 -64
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.mts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.ts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.js +11 -3
- 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 -1
- package/Types/Monitor/WhoIsTold.d.ts +3 -1
- package/Types/Monitor/WhoIsTold.js +2 -1
- package/Types/NotificationRule/PagingLadder.d.mts +137 -0
- package/Types/NotificationRule/PagingLadder.d.ts +137 -0
- package/Types/NotificationRule/PagingLadder.js +682 -0
- package/Types/NotificationRule/PagingLadder.mjs +28 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +1 -1
- 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/OnCallPageLine.d.mts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.ts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.js +136 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.mjs +18 -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/OnCallTestPage.d.mts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +96 -5
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.mts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.ts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.js +222 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.mjs +6 -0
- package/Types/OnCallDutyPolicy/ScheduleLayerDefaults.js +5 -2
- 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/UserOverrideCoverRequest.js +9 -1
- 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.d.mts +2 -2
- package/Types/Permission.d.ts +2 -2
- package/Types/Permission.js +196 -195
- 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/ProductCatalog.d.mts +10 -0
- package/Types/Product/ProductCatalog.d.ts +10 -0
- package/Types/Product/ProductCatalog.js +208 -0
- package/Types/Product/ProductCatalog.mjs +6 -0
- package/Types/Product/ProductOfTable.d.mts +3 -0
- package/Types/Product/ProductOfTable.d.ts +3 -0
- package/Types/Product/ProductOfTable.js +68 -0
- package/Types/Product/ProductOfTable.mjs +3 -0
- package/Types/Product/ProjectProductsAnswer.d.mts +3 -0
- package/Types/Product/ProjectProductsAnswer.d.ts +3 -0
- package/Types/Product/ProjectProductsAnswer.js +35 -2
- package/Types/Product/ProjectProductsAnswer.mjs +1 -0
- package/Types/Product/ServerProducts.d.mts +65 -0
- package/Types/Product/ServerProducts.d.ts +65 -0
- package/Types/Product/ServerProducts.js +383 -0
- package/Types/Product/ServerProducts.mjs +26 -0
- package/Types/Product/ServerProductsAnswer.d.mts +21 -0
- package/Types/Product/ServerProductsAnswer.d.ts +21 -0
- package/Types/Product/ServerProductsAnswer.js +78 -0
- package/Types/Product/ServerProductsAnswer.mjs +5 -0
- package/Types/ProductFeedback/ProductFeedback.d.mts +3 -1
- package/Types/ProductFeedback/ProductFeedback.d.ts +3 -1
- package/Types/ProductFeedback/ProductFeedback.js +8 -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/Rum/SessionReplayCustomEvents.d.mts +1 -0
- package/Types/Rum/SessionReplayCustomEvents.d.ts +1 -0
- package/Types/SampleProject/SampleProject.d.mts +54 -0
- package/Types/SampleProject/SampleProject.d.ts +54 -0
- package/Types/SampleProject/SampleProject.js +177 -0
- package/Types/SampleProject/SampleProject.mjs +22 -0
- package/Types/SampleProject/SampleProjectContent.d.mts +127 -0
- package/Types/SampleProject/SampleProjectContent.d.ts +127 -0
- package/Types/SampleProject/SampleProjectContent.js +397 -0
- package/Types/SampleProject/SampleProjectContent.mjs +18 -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/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 +54 -12
- 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 +414 -50
- package/Types/Translator.mjs +1 -0
- package/Types/UsedBy/UsedBy.d.mts +103 -0
- package/Types/UsedBy/UsedBy.d.ts +103 -0
- package/Types/UsedBy/UsedBy.js +389 -0
- package/Types/UsedBy/UsedBy.mjs +20 -0
- package/Types/UsedBy/UsedByServerProducts.d.mts +4 -0
- package/Types/UsedBy/UsedByServerProducts.d.ts +4 -0
- package/Types/UsedBy/UsedByServerProducts.js +48 -0
- package/Types/UsedBy/UsedByServerProducts.mjs +3 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.mts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.ts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.js +54 -2
- package/Types/WelcomeChecklist/WelcomeChecklist.mjs +4 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.mts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.ts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.js +3 -0
- package/Types/Workflow/PassedOnFields.js +2 -1
- package/Types/Workflow/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +3 -3
- 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 +28 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +28 -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/MeaningMatch.d.mts +36 -0
- package/Utils/AI/MeaningMatch.d.ts +36 -0
- package/Utils/AI/MeaningMatch.js +535 -0
- package/Utils/AI/MeaningMatch.mjs +7 -0
- package/Utils/ArchivableValues.js +1 -1
- package/Utils/AuditLog/AuditLogValues.js +2 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.mts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.ts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.js +105 -2
- package/Utils/Dashboard/DashboardViewConfigSignature.d.mts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.d.ts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.js +45 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.mjs +3 -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/DataSecurity/TextScanner.js +2 -2
- package/Utils/DeveloperDocs/AiAssistantExamples.js +4 -4
- package/Utils/DeveloperDocs/CliCommands.d.mts +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +1 -0
- package/Utils/DeveloperDocs/CliCommands.js +2 -1
- package/Utils/DeveloperDocs/CliResources.js +2 -1
- package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- 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/Markdown/LinkReferenceDefinitions.d.mts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +1493 -131
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +1 -0
- package/Utils/Markdown/MarkdownTableCell.js +2 -1
- package/Utils/Markdown/OverLongText.js +523 -5
- package/Utils/Markdown/SlowMarkdown.d.mts +14 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +14 -0
- package/Utils/Markdown/SlowMarkdown.js +595 -11
- package/Utils/Markdown/SlowMarkdown.mjs +6 -0
- 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/ModelApiName.d.mts +11 -0
- package/Utils/ModelApiName.d.ts +11 -0
- package/Utils/ModelApiName.js +72 -0
- package/Utils/ModelApiName.mjs +5 -0
- package/Utils/Monitor/DeviceMacLearningUtil.d.mts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.d.ts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.js +26 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +97 -22
- package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.mts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.ts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.js +35 -1
- package/Utils/Monitor/ExternalStatusPageReading.mjs +2 -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/MonitorTemplateLinkRefusal.d.mts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.ts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.js +45 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.mjs +6 -0
- 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/OpenStack/OpenStackCheckName.js +2 -1
- package/Utils/OpenStack/OpenStackLogScrub.js +1 -1
- package/Utils/OpenStack/OpenStackLogs.js +3 -2
- package/Utils/OpenStack/OpenStackTraces.js +2 -1
- package/Utils/Project/NextNumber.js +1 -1
- package/Utils/Project/NotificationChannels.js +5 -5
- package/Utils/Project/ProjectBalance.js +2 -2
- package/Utils/Project/TwilioAccount.js +2 -2
- 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/ScheduledMaintenanceStart.d.mts +3 -0
- package/Utils/ScheduledMaintenanceStart.d.ts +3 -0
- package/Utils/ScheduledMaintenanceStart.js +9 -0
- package/Utils/Schema/ModelSchema.js +10 -1
- 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/Utils/Uptime/UptimeMaintenanceUtil.js +2 -1
- package/Utils/ValueFormatter.d.mts +8 -6
- package/Utils/ValueFormatter.d.ts +8 -6
- package/Utils/ValueFormatter.js +145 -0
- 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
|
-
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.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 = 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,37 +55,70 @@ 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",
|
|
89
|
+
"Mattermost",
|
|
90
|
+
"Meraki",
|
|
66
91
|
"Microsoft",
|
|
67
92
|
"Okta",
|
|
68
93
|
"OpenTelemetry",
|
|
94
|
+
"Opsgenie",
|
|
69
95
|
"Podman",
|
|
70
96
|
"Prometheus",
|
|
71
97
|
"Proxmox",
|
|
72
98
|
"OpenStack",
|
|
73
99
|
"Slack",
|
|
100
|
+
"Sophos",
|
|
101
|
+
"Splunk",
|
|
74
102
|
"Swarm",
|
|
75
103
|
"Telegram",
|
|
104
|
+
"Tencent",
|
|
76
105
|
"Terraform",
|
|
77
106
|
"Twilio",
|
|
107
|
+
"Ubiquiti",
|
|
108
|
+
"Vercel",
|
|
78
109
|
"Windows",
|
|
110
|
+
"Zabbix",
|
|
79
111
|
];
|
|
80
112
|
/*
|
|
81
113
|
* Proper nouns of two words: the second keeps its capital after the first
|
|
82
114
|
* ("Google Cloud project", but "cloud resources").
|
|
83
115
|
*/
|
|
84
|
-
const PROPER_NOUN_PAIRS = [
|
|
116
|
+
const PROPER_NOUN_PAIRS = [
|
|
117
|
+
["Alibaba", "Cloud"],
|
|
118
|
+
["Google", "Cloud"],
|
|
119
|
+
["Microsoft", "Teams"],
|
|
120
|
+
["Tencent", "Cloud"],
|
|
121
|
+
];
|
|
85
122
|
// "API", "SLOs": two capitals in a row.
|
|
86
123
|
const ACRONYM_PATTERN = /\p{Lu}{2,}/u;
|
|
87
124
|
// "OneUptime", "GitHub", "iOS": a capital after the first letter.
|
|
@@ -134,6 +171,40 @@ const toSentenceTerm = (text, language) => {
|
|
|
134
171
|
.join(" ");
|
|
135
172
|
};
|
|
136
173
|
exports.toSentenceTerm = toSentenceTerm;
|
|
174
|
+
// A lower-case letter at the very start: the "c" of "clúster de Kubernetes".
|
|
175
|
+
const LOWER_CASE_START = /^\p{Ll}/u;
|
|
176
|
+
/*
|
|
177
|
+
* A word or name as it starts a label - a row's name, a chip, a line of a
|
|
178
|
+
* card - in `language`: its first letter upper-cased the way the language
|
|
179
|
+
* writes a capital. A locale words a name the way the sentences that say it
|
|
180
|
+
* take it ("Este clúster de Kubernetes...", "Этот кластер Kubernetes..."),
|
|
181
|
+
* so where the same key names a row it starts lower-case; drawn through
|
|
182
|
+
* this, it reads "Clúster de Kubernetes", "Кластер Kubernetes". The
|
|
183
|
+
* counterpart of toSentenceTerm, which writes a label for the middle of a
|
|
184
|
+
* sentence.
|
|
185
|
+
*
|
|
186
|
+
* Unchanged when the text starts with anything but a lower-case letter - a
|
|
187
|
+
* capital, a digit, a sign, a letter of a script without case (Chinese,
|
|
188
|
+
* Japanese, Korean, Persian, Arabic, Hindi) - and when its first word keeps
|
|
189
|
+
* its own case ("vCenter", "iOS", "eBPF"). For a label of words, never a
|
|
190
|
+
* code or a name someone typed.
|
|
191
|
+
*/
|
|
192
|
+
const toLabelTerm = (text, language) => {
|
|
193
|
+
var _a;
|
|
194
|
+
const first = (_a = LOWER_CASE_START.exec(text)) === null || _a === void 0 ? void 0 : _a[0];
|
|
195
|
+
if (!first || keepsItsCase(text.split(/[\s-]/)[0] || "")) {
|
|
196
|
+
return text;
|
|
197
|
+
}
|
|
198
|
+
let capital;
|
|
199
|
+
try {
|
|
200
|
+
capital = first.toLocaleUpperCase(language || exports.DEFAULT_LANGUAGE);
|
|
201
|
+
}
|
|
202
|
+
catch (_b) {
|
|
203
|
+
capital = first.toUpperCase();
|
|
204
|
+
}
|
|
205
|
+
return `${capital}${text.slice(first.length)}`;
|
|
206
|
+
};
|
|
207
|
+
exports.toLabelTerm = toLabelTerm;
|
|
137
208
|
/*
|
|
138
209
|
* The CLDR plural category of `count` in `language` - "one", "few",
|
|
139
210
|
* "many", "other"... - which is also i18next's key suffix for that form.
|
|
@@ -207,6 +278,261 @@ const LETTER = /\p{L}/u;
|
|
|
207
278
|
const hasWords = (template) => {
|
|
208
279
|
return LETTER.test(template.replace(PLACEHOLDER, ""));
|
|
209
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
|
+
};
|
|
210
536
|
// A value as the English sentence shows it.
|
|
211
537
|
const englishValue = (value) => {
|
|
212
538
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
@@ -241,7 +567,8 @@ const englishTextValues = (values) => {
|
|
|
241
567
|
const dated = englishDateValues(values);
|
|
242
568
|
const result = {};
|
|
243
569
|
for (const key of Object.keys(dated)) {
|
|
244
|
-
|
|
570
|
+
const value = dated[key];
|
|
571
|
+
result[key] = toSentenceValue(value, englishValue(value), exports.DEFAULT_LANGUAGE);
|
|
245
572
|
}
|
|
246
573
|
return result;
|
|
247
574
|
};
|
|
@@ -262,30 +589,23 @@ const englishTextValues = (values) => {
|
|
|
262
589
|
* A slot's marker (TranslatedSentence, translateTemplateAround) is set
|
|
263
590
|
* apart in a sentence read right to left when asked to (SentenceOptions'
|
|
264
591
|
* setsSlotsApart), so what is drawn there as an element is too; otherwise
|
|
265
|
-
* it is left as it is. As in
|
|
266
|
-
*
|
|
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.
|
|
267
596
|
*/
|
|
268
|
-
const fillSettingValuesApart = (template, values, direction, setsSlotsApart) => {
|
|
269
|
-
|
|
270
|
-
const pieces = [];
|
|
597
|
+
const fillSettingValuesApart = (template, values, direction, setsSlotsApart, language) => {
|
|
598
|
+
const pieces = fillPieces(template, values, language);
|
|
271
599
|
// The sentence with every value as it is: what a number's signs are read in.
|
|
272
600
|
let filled = "";
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
filled
|
|
277
|
-
|
|
278
|
-
for (const match of template.matchAll(PLACEHOLDER)) {
|
|
279
|
-
const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
|
|
280
|
-
const name = match[1] || "";
|
|
281
|
-
const isFilled = Object.prototype.hasOwnProperty.call(values, name);
|
|
282
|
-
addPiece(template.slice(at, start), false);
|
|
283
|
-
addPiece(isFilled ? values[name] : match[0], isFilled);
|
|
284
|
-
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;
|
|
285
606
|
}
|
|
286
|
-
addPiece(template.slice(at), false);
|
|
287
607
|
return pieces
|
|
288
|
-
.map((piece) => {
|
|
608
|
+
.map((piece, index) => {
|
|
289
609
|
if (!piece.isValue) {
|
|
290
610
|
return piece.text;
|
|
291
611
|
}
|
|
@@ -294,9 +614,10 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
294
614
|
? `${ReadingDirection_1.FIRST_STRONG_ISOLATE}${piece.text}${ReadingDirection_1.POP_DIRECTIONAL_ISOLATE}`
|
|
295
615
|
: piece.text;
|
|
296
616
|
}
|
|
297
|
-
const
|
|
617
|
+
const start = starts[index];
|
|
618
|
+
const end = start + piece.text.length;
|
|
298
619
|
if (direction === ReadingDirection_1.RIGHT_TO_LEFT &&
|
|
299
|
-
(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))) {
|
|
300
621
|
return piece.text;
|
|
301
622
|
}
|
|
302
623
|
return (0, ReadingDirection_1.setApartInSentence)(piece.text, direction);
|
|
@@ -304,16 +625,22 @@ const fillSettingValuesApart = (template, values, direction, setsSlotsApart) =>
|
|
|
304
625
|
.join("");
|
|
305
626
|
};
|
|
306
627
|
/*
|
|
307
|
-
* Fills {{key}} placeholders from values
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
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.
|
|
311
633
|
*/
|
|
312
634
|
const fillTemplate = (template, values = {}) => {
|
|
313
|
-
return template.replace(PLACEHOLDER, (match, key) => {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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;
|
|
317
644
|
});
|
|
318
645
|
};
|
|
319
646
|
exports.fillTemplate = fillTemplate;
|
|
@@ -425,17 +752,19 @@ const createTranslator = (lookup, language) => {
|
|
|
425
752
|
const result = {};
|
|
426
753
|
for (const key of Object.keys(values)) {
|
|
427
754
|
const value = values[key];
|
|
755
|
+
let text;
|
|
428
756
|
if ((0, exports.isTranslatableTerm)(value)) {
|
|
429
|
-
|
|
757
|
+
text = translateTerm(value.translatableTerm, {
|
|
430
758
|
inSentence: value.inSentence,
|
|
431
759
|
});
|
|
432
760
|
}
|
|
433
761
|
else if ((0, exports.isComposedValue)(value)) {
|
|
434
|
-
|
|
762
|
+
text = value.compose(translator);
|
|
435
763
|
}
|
|
436
764
|
else {
|
|
437
|
-
|
|
765
|
+
text = String(value);
|
|
438
766
|
}
|
|
767
|
+
result[key] = toSentenceValue(value, text, activeLanguage);
|
|
439
768
|
}
|
|
440
769
|
return result;
|
|
441
770
|
};
|
|
@@ -446,7 +775,9 @@ const createTranslator = (lookup, language) => {
|
|
|
446
775
|
* English one; then its terms are translated too. Otherwise the English
|
|
447
776
|
* sentence is filled with the English terms - except for a template with no
|
|
448
777
|
* words of its own ("{{action}} {{itemName}}"), which belongs to no
|
|
449
|
-
* 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).
|
|
450
781
|
*
|
|
451
782
|
* Asked to (SentenceOptions), each value is set apart from the sentence
|
|
452
783
|
* where it could move the words around it (fillSettingValuesApart), by the
|
|
@@ -463,16 +794,17 @@ const createTranslator = (lookup, language) => {
|
|
|
463
794
|
*/
|
|
464
795
|
if (hasWords(english)) {
|
|
465
796
|
return setsValuesApart
|
|
466
|
-
? 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)
|
|
467
798
|
: (0, exports.fillTemplate)(punctuate(english), englishDateValues(values));
|
|
468
799
|
}
|
|
800
|
+
// No words of its own: the reader's words, as their sentence holds them.
|
|
469
801
|
return setsValuesApart
|
|
470
|
-
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart)
|
|
471
|
-
: (
|
|
802
|
+
? fillSettingValuesApart(punctuate(english), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
803
|
+
: fillSentenceValues(punctuate(english), translatedValues(values), activeLanguage);
|
|
472
804
|
}
|
|
473
805
|
return setsValuesApart
|
|
474
|
-
? fillSettingValuesApart(punctuate(stored), translatedValues(values), readerDirection, setsSlotsApart)
|
|
475
|
-
: (
|
|
806
|
+
? fillSettingValuesApart(punctuate(stored), translatedValues(values), readerDirection, setsSlotsApart, activeLanguage)
|
|
807
|
+
: fillSentenceValues(punctuate(stored), translatedValues(values), activeLanguage);
|
|
476
808
|
};
|
|
477
809
|
const translateTemplate = (template, values = {}, options) => {
|
|
478
810
|
return fill(find(template), template, values, options);
|
|
@@ -489,7 +821,8 @@ const createTranslator = (lookup, language) => {
|
|
|
489
821
|
/*
|
|
490
822
|
* The form for `count` the way i18next resolves it: the language's own
|
|
491
823
|
* category ("few" for 3 in Russian) under the key plus "_few", else the key
|
|
492
|
-
* 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).
|
|
493
826
|
*
|
|
494
827
|
* A language's "one" form is said for every count its language calls one
|
|
495
828
|
* - 21 and 31 in Russian, 0 in French. A one form that says exactly one
|
|
@@ -504,22 +837,53 @@ const createTranslator = (lookup, language) => {
|
|
|
504
837
|
if (category !== "other" && !saysOnlyOne) {
|
|
505
838
|
const form = find(`${key}_${category}`);
|
|
506
839
|
if (form !== undefined) {
|
|
507
|
-
return form;
|
|
840
|
+
return { text: form, category };
|
|
508
841
|
}
|
|
509
842
|
}
|
|
510
|
-
|
|
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;
|
|
511
874
|
};
|
|
512
875
|
const translatePlural = (template, count, values = {}, options) => {
|
|
513
876
|
// English has two forms: exactly one, and everything else.
|
|
514
877
|
const english = count === 1 ? template.one : template.other;
|
|
515
878
|
const stored = findPlural(template.other, count, (0, exports.isOneFormOnlyForOne)(template));
|
|
516
879
|
/*
|
|
517
|
-
* An English form left in a locale is a placeholder, not a translation
|
|
518
|
-
* the sentence is English, in English's form for
|
|
519
|
-
*
|
|
520
|
-
* 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.
|
|
521
883
|
*/
|
|
522
|
-
const translated = stored ===
|
|
884
|
+
const translated = stored === undefined || isEnglishPlaceholder(stored, template)
|
|
885
|
+
? undefined
|
|
886
|
+
: stored.text;
|
|
523
887
|
// {{count}} is written the reader's way unless the caller passes its own.
|
|
524
888
|
return fill(translated, english, Object.assign({ count: formatNumber(count) }, values), options);
|
|
525
889
|
};
|
|
@@ -678,7 +1042,7 @@ const getSentencePartsAndLanguage = (data) => {
|
|
|
678
1042
|
};
|
|
679
1043
|
}
|
|
680
1044
|
return {
|
|
681
|
-
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)) || [
|
|
682
1046
|
{
|
|
683
1047
|
kind: "text",
|
|
684
1048
|
text: (0, exports.fillTemplate)(englishTemplate, englishDateValues(Object.assign(Object.assign({}, (isPlural ? { count: data.translator.formatNumber(count) } : {})), (data.values || {})))),
|
package/Types/Translator.mjs
CHANGED
|
@@ -18,6 +18,7 @@ export const getTemplatePlaceholders = commonJsModule.getTemplatePlaceholders;
|
|
|
18
18
|
export const isComposedValue = commonJsModule.isComposedValue;
|
|
19
19
|
export const isOneFormOnlyForOne = commonJsModule.isOneFormOnlyForOne;
|
|
20
20
|
export const isTranslatableTerm = commonJsModule.isTranslatableTerm;
|
|
21
|
+
export const toLabelTerm = commonJsModule.toLabelTerm;
|
|
21
22
|
export const toSentenceTerm = commonJsModule.toSentenceTerm;
|
|
22
23
|
export const translatableTerm = commonJsModule.translatableTerm;
|
|
23
24
|
export const translateNamedAction = commonJsModule.translateNamedAction;
|