@oneuptime/common 14.0.109 → 14.0.110
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/Alert.js +2 -2
- 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/DatabaseBaseModel/DatabaseBaseModel.d.mts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.ts +2 -0
- package/Models/DatabaseModels/EmailLog.js +12 -12
- package/Models/DatabaseModels/FormSubmission.js +2 -2
- package/Models/DatabaseModels/GlobalConfig.d.mts +1 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +1 -0
- package/Models/DatabaseModels/GlobalConfig.js +28 -0
- package/Models/DatabaseModels/Incident.js +2 -2
- 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/IncidentState.js +1 -1
- package/Models/DatabaseModels/IncidentTemplate.js +2 -2
- package/Models/DatabaseModels/Monitor.js +3 -3
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +41 -0
- 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 +9 -6
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +10 -7
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +14 -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/Project.d.mts +2 -0
- package/Models/DatabaseModels/Project.d.ts +2 -0
- package/Models/DatabaseModels/Project.js +96 -2
- 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/PushNotificationLog.js +12 -12
- package/Models/DatabaseModels/Reseller.js +8 -2
- package/Models/DatabaseModels/ResellerPlan.js +8 -2
- package/Models/DatabaseModels/ScheduledMaintenance.js +6 -3
- package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +2 -2
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -1
- 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/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/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AIChatTypes.js +5 -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/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/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 +20 -1
- package/Types/Date.d.ts +20 -1
- package/Types/Date.js +42 -2
- 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/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/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/Monitor/MonitorCriteria.js +2 -2
- 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/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/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/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/UserOverrideCoverRequest.js +9 -1
- package/Types/Permission.d.mts +2 -2
- package/Types/Permission.d.ts +2 -2
- package/Types/Permission.js +194 -193
- 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/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/Telemetry/TelemetryIngestSurface.js +6 -5
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +40 -2
- 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/Templates.js +1 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +2 -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/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/TerraformSchema.js +3 -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/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.js +8 -3
- 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/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/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/NotificationChannels.js +5 -5
- package/Utils/Project/ProjectBalance.js +2 -2
- package/Utils/Project/TwilioAccount.js +2 -2
- 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/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
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MEANING_CONCEPTS = exports.MAX_SHARED_TERMS = exports.MIN_SHARED_WORDS = exports.MIN_MEANING_SIMILARITY = exports.MAX_TEXT_LENGTH = void 0;
|
|
7
|
+
const PromptText_1 = __importDefault(require("./PromptText"));
|
|
8
|
+
/*
|
|
9
|
+
* RECALL BY MEANING (issue #6798).
|
|
10
|
+
*
|
|
11
|
+
* OneUptime AI's memory used to recall a past incident only when it shared
|
|
12
|
+
* a monitor or a label with the one being investigated. The same failure
|
|
13
|
+
* seldom arrives that way: "Checkout returns 503s" on the checkout monitor
|
|
14
|
+
* and "payments: too many connections to Postgres" on another are the same
|
|
15
|
+
* exhausted connection pool, and shared nothing the old match could see.
|
|
16
|
+
*
|
|
17
|
+
* This matches records by what their words say happened. A text is read
|
|
18
|
+
* into terms:
|
|
19
|
+
*
|
|
20
|
+
* - concepts: the ways an outage is described, each a set of phrasings
|
|
21
|
+
* ("OOMKilled", "out of memory", "memory limit" are one concept; so are
|
|
22
|
+
* "503", "5xx" and "service unavailable"). Two records that name the
|
|
23
|
+
* same concept in different words share it, and a concept weighs more
|
|
24
|
+
* than a plain word;
|
|
25
|
+
* - words: what is left, lower case, with the stop words, numbers, ids,
|
|
26
|
+
* hashes, addresses and links taken out, and cut to a stem
|
|
27
|
+
* ("connections", "connected" and "connecting" are one word).
|
|
28
|
+
*
|
|
29
|
+
* Records are compared by the cosine of their weighted terms (TF-IDF over
|
|
30
|
+
* the records being compared), so a term every record has says little and
|
|
31
|
+
* a rare one says a lot. A comparison also says which terms the two share,
|
|
32
|
+
* strongest first, so whoever reads the match - OneUptime AI, and the
|
|
33
|
+
* people who read its report - can see why it was made.
|
|
34
|
+
*
|
|
35
|
+
* Why not embeddings and a vector store: every install would need a
|
|
36
|
+
* Postgres extension, and the project's AI provider an embeddings API
|
|
37
|
+
* that not every provider has. This runs anywhere, on the data OneUptime
|
|
38
|
+
* already owns, and the same inputs always give the same answer.
|
|
39
|
+
*
|
|
40
|
+
* Pure: no Node or browser APIs. A text is held to MAX_TEXT_LENGTH after its
|
|
41
|
+
* embedded files are left out (PromptText), so no pattern here ever reads
|
|
42
|
+
* a screenshot's megabytes.
|
|
43
|
+
*/
|
|
44
|
+
// The most of one text that is read, after its embedded files are left out.
|
|
45
|
+
exports.MAX_TEXT_LENGTH = 4000;
|
|
46
|
+
/*
|
|
47
|
+
* How much a match must have in common: a similarity of at least this, and a
|
|
48
|
+
* concept or at least MIN_SHARED_WORDS words in common.
|
|
49
|
+
*/
|
|
50
|
+
exports.MIN_MEANING_SIMILARITY = 0.2;
|
|
51
|
+
exports.MIN_SHARED_WORDS = 2;
|
|
52
|
+
// The most shared terms a comparison names.
|
|
53
|
+
exports.MAX_SHARED_TERMS = 4;
|
|
54
|
+
// A concept weighs this much more than a word.
|
|
55
|
+
const CONCEPT_WEIGHT = 2;
|
|
56
|
+
// What a concept term starts with, so it can never collide with a word.
|
|
57
|
+
const CONCEPT_PREFIX = "#";
|
|
58
|
+
// The shapes of a word the stemmer and the word filter tell apart.
|
|
59
|
+
const LATIN_WORD = /^[a-z]+$/;
|
|
60
|
+
const LATIN_LETTERS_AND_DIGITS = /^[a-z0-9]+$/;
|
|
61
|
+
const ONLY_DIGITS = /^\p{N}+$/u;
|
|
62
|
+
const ANY_DIGIT = /\p{N}/gu;
|
|
63
|
+
// The consonants a suffix doubles: "stopped" -> "stop", "running" -> "run".
|
|
64
|
+
const DOUBLED_CONSONANT = /[bcdfgkmnprt]/;
|
|
65
|
+
/*
|
|
66
|
+
* The ways an outage is described, each one concept. Read from lower-case
|
|
67
|
+
* text, word-bounded, with no nested quantifiers.
|
|
68
|
+
*/
|
|
69
|
+
exports.MEANING_CONCEPTS = [
|
|
70
|
+
{
|
|
71
|
+
id: "out-of-memory",
|
|
72
|
+
label: "out of memory",
|
|
73
|
+
pattern: /\b(oom|oomkill|oomkilled|oom[ -]killed|out[ -]of[ -]memory|outofmemory|outofmemoryerror|memory limit|memory exhausted|memory exhaustion|memory pressure)\b/,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "high-cpu",
|
|
77
|
+
label: "high CPU",
|
|
78
|
+
pattern: /\b(high cpu|cpu (usage|load|spike|spikes|saturation|saturated|throttling|throttled|pressure|utili[sz]ation)|cpu is high|cpu at)\b/,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "disk-full",
|
|
82
|
+
label: "disk full",
|
|
83
|
+
pattern: /\b(disk (full|space|usage|pressure)|no space left|out of disk|filesystem (full|usage)|volume (full|usage)|inodes?)\b/,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "connection-exhaustion",
|
|
87
|
+
label: "connection pool exhausted",
|
|
88
|
+
pattern: /\b((connection|conn|db|database) pool|too many (connections|clients)|max ?connections|pool (exhausted|exhaustion|timeout|full)|connection limit|connections exhausted|connection slots)\b/,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "connection-refused",
|
|
92
|
+
label: "connection refused",
|
|
93
|
+
pattern: /\b(connection refused|econnrefused|refused to connect)\b/,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "connection-reset",
|
|
97
|
+
label: "connection reset",
|
|
98
|
+
pattern: /\b(econnreset|connection reset|reset by peer|broken pipe|epipe)\b/,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "timeout",
|
|
102
|
+
label: "timeout",
|
|
103
|
+
pattern: /\b(timeout|timeouts|time out|timed out|deadline exceeded|etimedout|504s?)\b/,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "slow",
|
|
107
|
+
label: "slow responses",
|
|
108
|
+
pattern: /\b(latency|slow|slowness|slower|slowly|p95|p99|response time|response times|sluggish|lagging)\b/,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "server-errors",
|
|
112
|
+
label: "server errors (5xx)",
|
|
113
|
+
pattern: /\b(5\d\ds?|5xxs?|internal server error|server error|server errors|bad gateway|service unavailable)\b/,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "not-found",
|
|
117
|
+
label: "not found (404)",
|
|
118
|
+
pattern: /\b(404s?|not found)\b/,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "rate-limited",
|
|
122
|
+
label: "rate limiting",
|
|
123
|
+
pattern: /\b(429s?|rate[ -]?limit|rate[ -]?limited|rate[ -]?limiting|too many requests|quota exceeded|quota exhausted)\b/,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "crash-loop",
|
|
127
|
+
label: "crash or restart loop",
|
|
128
|
+
pattern: /\b(crash ?loop|crashloopbackoff|crashloop|crashed|crashes|crashing|crash|restart loop|restarting|keeps restarting|restarted repeatedly|segfault|segmentation fault|panic|panicked|core dumped)\b/,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "deploy",
|
|
132
|
+
label: "deploy or release",
|
|
133
|
+
pattern: /\b(deploy|deployed|deploying|deploys|deployment|deployments|release|released|releases|rollout|rollouts|rolled out|new version|upgrade|upgraded|upgrading)\b/,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "rollback",
|
|
137
|
+
label: "rollback",
|
|
138
|
+
pattern: /\b(rollback|rollbacks|roll back|rolled back|rolling back|revert|reverted|reverting)\b/,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "certificate",
|
|
142
|
+
label: "TLS certificate",
|
|
143
|
+
pattern: /\b(certificate|certificates|cert|certs|tls|ssl|x509|handshake)\b/,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "dns",
|
|
147
|
+
label: "DNS",
|
|
148
|
+
pattern: /\b(dns|nxdomain|servfail|name resolution|could not resolve|unable to resolve|resolve host|no such host)\b/,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "database",
|
|
152
|
+
label: "database",
|
|
153
|
+
pattern: /\b(database|databases|db|postgres|postgresql|mysql|mariadb|mongo|mongodb|redis|sql|clickhouse|cassandra|dynamodb|elasticsearch|opensearch)\b/,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "queue-backlog",
|
|
157
|
+
label: "queue backlog",
|
|
158
|
+
pattern: /\b(queue (depth|backlog|lag|size|growing|full)|consumer lag|backlog|dead[ -]?letter|dlq)\b/,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "auth",
|
|
162
|
+
label: "authentication or permissions",
|
|
163
|
+
pattern: /\b(authentication|authorization|unauthorized|unauthorised|forbidden|401|403|login failure|login failures|invalid token|invalid credentials|expired token|permission denied|access denied)\b/,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "network",
|
|
167
|
+
label: "network",
|
|
168
|
+
pattern: /\b(network|packet loss|no route to host|host unreachable|interface down|link down)\b/,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "node-down",
|
|
172
|
+
label: "host or node down",
|
|
173
|
+
pattern: /\b(node (down|not ready|notready|failure|failed|unreachable)|host (down|unreachable)|instance (down|terminated|stopped|unhealthy)|server down|vm (down|stopped))\b/,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: "memory-growth",
|
|
177
|
+
label: "memory growth or GC",
|
|
178
|
+
pattern: /\b(memory leak|leak|leaks|leaking|heap usage|heap growth|heap size|gc pause|gc pressure|gc overhead|garbage collection)\b/,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "configuration",
|
|
182
|
+
label: "configuration",
|
|
183
|
+
pattern: /\b(config|configs|configuration|configmap|misconfigured|misconfiguration|environment variable|environment variables|env var|env vars|feature flag|feature flags)\b/,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "expiry",
|
|
187
|
+
label: "expiry",
|
|
188
|
+
pattern: /\b(expired|expiry|expires|expiration|expiring)\b/,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: "dependency",
|
|
192
|
+
label: "a dependency",
|
|
193
|
+
pattern: /\b(upstream|downstream|dependency|dependencies|third[ -]party|external api|external service)\b/,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "capacity",
|
|
197
|
+
label: "scaling or capacity",
|
|
198
|
+
pattern: /\b(autoscale|autoscaler|autoscaling|scaled up|scaled down|scaling|replica|replicas|hpa|capacity)\b/,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: "outage",
|
|
202
|
+
label: "outage",
|
|
203
|
+
pattern: /\b(outage|is down|went down|offline|not responding|unresponsive)\b/,
|
|
204
|
+
},
|
|
205
|
+
];
|
|
206
|
+
// Words that say nothing about what happened.
|
|
207
|
+
const STOP_WORDS = new Set([
|
|
208
|
+
"a",
|
|
209
|
+
"about",
|
|
210
|
+
"after",
|
|
211
|
+
"all",
|
|
212
|
+
"also",
|
|
213
|
+
"an",
|
|
214
|
+
"and",
|
|
215
|
+
"any",
|
|
216
|
+
"are",
|
|
217
|
+
"as",
|
|
218
|
+
"at",
|
|
219
|
+
"be",
|
|
220
|
+
"because",
|
|
221
|
+
"been",
|
|
222
|
+
"before",
|
|
223
|
+
"but",
|
|
224
|
+
"by",
|
|
225
|
+
"can",
|
|
226
|
+
"could",
|
|
227
|
+
"did",
|
|
228
|
+
"do",
|
|
229
|
+
"does",
|
|
230
|
+
"due",
|
|
231
|
+
"during",
|
|
232
|
+
"each",
|
|
233
|
+
"for",
|
|
234
|
+
"from",
|
|
235
|
+
"had",
|
|
236
|
+
"has",
|
|
237
|
+
"have",
|
|
238
|
+
"here",
|
|
239
|
+
"how",
|
|
240
|
+
"if",
|
|
241
|
+
"in",
|
|
242
|
+
"into",
|
|
243
|
+
"is",
|
|
244
|
+
"it",
|
|
245
|
+
"its",
|
|
246
|
+
"just",
|
|
247
|
+
"may",
|
|
248
|
+
"might",
|
|
249
|
+
"more",
|
|
250
|
+
"most",
|
|
251
|
+
"no",
|
|
252
|
+
"not",
|
|
253
|
+
"of",
|
|
254
|
+
"on",
|
|
255
|
+
"only",
|
|
256
|
+
"or",
|
|
257
|
+
"our",
|
|
258
|
+
"out",
|
|
259
|
+
"over",
|
|
260
|
+
"per",
|
|
261
|
+
"should",
|
|
262
|
+
"so",
|
|
263
|
+
"some",
|
|
264
|
+
"than",
|
|
265
|
+
"that",
|
|
266
|
+
"the",
|
|
267
|
+
"their",
|
|
268
|
+
"them",
|
|
269
|
+
"then",
|
|
270
|
+
"there",
|
|
271
|
+
"these",
|
|
272
|
+
"they",
|
|
273
|
+
"this",
|
|
274
|
+
"those",
|
|
275
|
+
"to",
|
|
276
|
+
"under",
|
|
277
|
+
"up",
|
|
278
|
+
"very",
|
|
279
|
+
"via",
|
|
280
|
+
"was",
|
|
281
|
+
"we",
|
|
282
|
+
"were",
|
|
283
|
+
"what",
|
|
284
|
+
"when",
|
|
285
|
+
"which",
|
|
286
|
+
"while",
|
|
287
|
+
"who",
|
|
288
|
+
"why",
|
|
289
|
+
"will",
|
|
290
|
+
"with",
|
|
291
|
+
"would",
|
|
292
|
+
"you",
|
|
293
|
+
"your",
|
|
294
|
+
// Every record is one of these: they tell two records apart by nothing.
|
|
295
|
+
"alert",
|
|
296
|
+
"alerts",
|
|
297
|
+
"incident",
|
|
298
|
+
"incidents",
|
|
299
|
+
"monitor",
|
|
300
|
+
"monitors",
|
|
301
|
+
"issue",
|
|
302
|
+
"issues",
|
|
303
|
+
"problem",
|
|
304
|
+
"problems",
|
|
305
|
+
"detected",
|
|
306
|
+
"triggered",
|
|
307
|
+
"fired",
|
|
308
|
+
"firing",
|
|
309
|
+
]);
|
|
310
|
+
// A word's stem, where its suffixes would not take it there.
|
|
311
|
+
const IRREGULAR_STEMS = new Map([
|
|
312
|
+
["failure", "fail"],
|
|
313
|
+
["failures", "fail"],
|
|
314
|
+
["unavailable", "unavail"],
|
|
315
|
+
["availability", "avail"],
|
|
316
|
+
]);
|
|
317
|
+
class MeaningMatch {
|
|
318
|
+
/*
|
|
319
|
+
* A text's terms. Empty for empty text, and for text with nothing in it
|
|
320
|
+
* that says what happened.
|
|
321
|
+
*/
|
|
322
|
+
static read(text) {
|
|
323
|
+
const terms = {
|
|
324
|
+
weights: new Map(),
|
|
325
|
+
labels: new Map(),
|
|
326
|
+
};
|
|
327
|
+
if (!text) {
|
|
328
|
+
return terms;
|
|
329
|
+
}
|
|
330
|
+
let cleaned = MeaningMatch.clean(text);
|
|
331
|
+
for (const concept of exports.MEANING_CONCEPTS) {
|
|
332
|
+
const global = new RegExp(concept.pattern.source, "g");
|
|
333
|
+
const matches = cleaned.match(global);
|
|
334
|
+
if (!matches || matches.length === 0) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const term = `${CONCEPT_PREFIX}${concept.id}`;
|
|
338
|
+
MeaningMatch.add(terms, term, CONCEPT_WEIGHT * matches.length);
|
|
339
|
+
terms.labels.set(term, concept.label);
|
|
340
|
+
/*
|
|
341
|
+
* What a concept said is the concept's, not words of its own: "too
|
|
342
|
+
* many connections" is the exhausted pool, not also "many".
|
|
343
|
+
*/
|
|
344
|
+
cleaned = cleaned.replace(global, " ");
|
|
345
|
+
}
|
|
346
|
+
for (const word of cleaned.split(/[^\p{L}\p{N}]+/u)) {
|
|
347
|
+
if (!MeaningMatch.isMeaningfulWord(word)) {
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
const stem = MeaningMatch.stem(word);
|
|
351
|
+
MeaningMatch.add(terms, stem, 1);
|
|
352
|
+
if (!terms.labels.has(stem)) {
|
|
353
|
+
terms.labels.set(stem, word);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return terms;
|
|
357
|
+
}
|
|
358
|
+
/*
|
|
359
|
+
* How close each of `documents` is to `query`, in the order given. The
|
|
360
|
+
* weight of a term is how often a text says it, scaled by how rare it is
|
|
361
|
+
* across the query and the documents: compared together, so a term every
|
|
362
|
+
* one of them has says little.
|
|
363
|
+
*/
|
|
364
|
+
static rank(data) {
|
|
365
|
+
const all = [data.query, ...data.documents];
|
|
366
|
+
const documentFrequency = new Map();
|
|
367
|
+
for (const terms of all) {
|
|
368
|
+
for (const term of terms.weights.keys()) {
|
|
369
|
+
documentFrequency.set(term, (documentFrequency.get(term) || 0) + 1);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const inverse = (term) => {
|
|
373
|
+
return (Math.log((all.length + 1) / ((documentFrequency.get(term) || 0) + 1)) +
|
|
374
|
+
1);
|
|
375
|
+
};
|
|
376
|
+
const queryVector = MeaningMatch.vector(data.query, inverse);
|
|
377
|
+
const queryNorm = MeaningMatch.norm(queryVector);
|
|
378
|
+
return data.documents.map((document) => {
|
|
379
|
+
const documentVector = MeaningMatch.vector(document, inverse);
|
|
380
|
+
const documentNorm = MeaningMatch.norm(documentVector);
|
|
381
|
+
const shared = [];
|
|
382
|
+
let dot = 0;
|
|
383
|
+
for (const [term, weight] of queryVector) {
|
|
384
|
+
const other = documentVector.get(term);
|
|
385
|
+
if (other === undefined) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
dot += weight * other;
|
|
389
|
+
shared.push({ term, contribution: weight * other });
|
|
390
|
+
}
|
|
391
|
+
const similarity = queryNorm > 0 && documentNorm > 0
|
|
392
|
+
? Math.min(1, dot / (queryNorm * documentNorm))
|
|
393
|
+
: 0;
|
|
394
|
+
shared.sort((a, b) => {
|
|
395
|
+
return b.contribution - a.contribution || (a.term < b.term ? -1 : 1);
|
|
396
|
+
});
|
|
397
|
+
const sharedTerms = [];
|
|
398
|
+
for (const { term } of shared) {
|
|
399
|
+
const label = document.labels.get(term) || data.query.labels.get(term) || term;
|
|
400
|
+
if (!sharedTerms.includes(label)) {
|
|
401
|
+
sharedTerms.push(label);
|
|
402
|
+
}
|
|
403
|
+
if (sharedTerms.length >= exports.MAX_SHARED_TERMS) {
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const sharedConceptCount = shared.filter((item) => {
|
|
408
|
+
return item.term.startsWith(CONCEPT_PREFIX);
|
|
409
|
+
}).length;
|
|
410
|
+
return {
|
|
411
|
+
similarity,
|
|
412
|
+
sharedTerms,
|
|
413
|
+
sharedConceptCount,
|
|
414
|
+
sharedWordCount: shared.length - sharedConceptCount,
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
/*
|
|
419
|
+
* Whether a comparison is a match worth naming: close enough, and sharing
|
|
420
|
+
* a concept or more than one word - one shared word ("checkout") is a
|
|
421
|
+
* coincidence, not a recurrence.
|
|
422
|
+
*/
|
|
423
|
+
static isMatch(score) {
|
|
424
|
+
return (score.similarity >= exports.MIN_MEANING_SIMILARITY &&
|
|
425
|
+
(score.sharedConceptCount > 0 ||
|
|
426
|
+
score.sharedWordCount >= exports.MIN_SHARED_WORDS));
|
|
427
|
+
}
|
|
428
|
+
/*
|
|
429
|
+
* One comparison: how close `document` is to `query`, with the two of
|
|
430
|
+
* them as the whole collection.
|
|
431
|
+
*/
|
|
432
|
+
static compare(query, document) {
|
|
433
|
+
return MeaningMatch.rank({
|
|
434
|
+
query: MeaningMatch.read(query),
|
|
435
|
+
documents: [MeaningMatch.read(document)],
|
|
436
|
+
})[0];
|
|
437
|
+
}
|
|
438
|
+
// A word's stem: "connections", "connected", "connecting" -> "connect".
|
|
439
|
+
static stem(word) {
|
|
440
|
+
const irregular = IRREGULAR_STEMS.get(word);
|
|
441
|
+
if (irregular) {
|
|
442
|
+
return irregular;
|
|
443
|
+
}
|
|
444
|
+
// Only Latin words have the suffixes below.
|
|
445
|
+
if (!LATIN_WORD.test(word) || word.length <= 3) {
|
|
446
|
+
return word;
|
|
447
|
+
}
|
|
448
|
+
let stem = word;
|
|
449
|
+
if (stem.endsWith("ies") && stem.length > 4) {
|
|
450
|
+
stem = `${stem.slice(0, -3)}y`;
|
|
451
|
+
}
|
|
452
|
+
else if (stem.endsWith("s") &&
|
|
453
|
+
!stem.endsWith("ss") &&
|
|
454
|
+
!stem.endsWith("us") &&
|
|
455
|
+
!stem.endsWith("is")) {
|
|
456
|
+
stem = stem.slice(0, -1);
|
|
457
|
+
}
|
|
458
|
+
for (const suffix of ["ing", "ed"]) {
|
|
459
|
+
if (stem.endsWith(suffix) && stem.length - suffix.length >= 3) {
|
|
460
|
+
stem = MeaningMatch.undouble(stem.slice(0, -suffix.length));
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
for (const suffix of ["ion", "ment", "ness", "ly"]) {
|
|
465
|
+
if (stem.endsWith(suffix) && stem.length - suffix.length >= 4) {
|
|
466
|
+
stem = stem.slice(0, -suffix.length);
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (stem.endsWith("e") && stem.length > 4) {
|
|
471
|
+
stem = stem.slice(0, -1);
|
|
472
|
+
}
|
|
473
|
+
return stem;
|
|
474
|
+
}
|
|
475
|
+
/*
|
|
476
|
+
* The text a pattern reads: embedded files left out and held to a length,
|
|
477
|
+
* lower case, with links, ids, addresses and hashes taken out.
|
|
478
|
+
*/
|
|
479
|
+
static clean(text) {
|
|
480
|
+
return PromptText_1.default.field(text, { maxLength: exports.MAX_TEXT_LENGTH })
|
|
481
|
+
.toLowerCase()
|
|
482
|
+
.replace(/\b(https?|wss?|ftp):\/\/\S+/g, " ")
|
|
483
|
+
.replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g, " ")
|
|
484
|
+
.replace(/\b\d{1,3}(\.\d{1,3}){3}(:\d+)?\b/g, " ")
|
|
485
|
+
.replace(/\b[0-9a-f]{12,}\b/g, " ")
|
|
486
|
+
.replace(/[_./:\\-]+/g, " ");
|
|
487
|
+
}
|
|
488
|
+
static isMeaningfulWord(word) {
|
|
489
|
+
if (!word || STOP_WORDS.has(word)) {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
// A number, or what only a machine reads: "7d9f8b6c4", "x2k9p".
|
|
493
|
+
if (ONLY_DIGITS.test(word)) {
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
const digits = (word.match(ANY_DIGIT) || []).length;
|
|
497
|
+
if (digits > 0 && (digits >= 2 || word.length > 5)) {
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
// A Latin word of one or two letters says little; a CJK one may say a lot.
|
|
501
|
+
if (LATIN_LETTERS_AND_DIGITS.test(word)) {
|
|
502
|
+
return word.length >= 3;
|
|
503
|
+
}
|
|
504
|
+
return word.length >= 2;
|
|
505
|
+
}
|
|
506
|
+
// "stopp" -> "stop", "runn" -> "run"; "fall", "pass" and "buzz" stay.
|
|
507
|
+
static undouble(stem) {
|
|
508
|
+
const last = stem.charAt(stem.length - 1);
|
|
509
|
+
if (stem.length >= 4 &&
|
|
510
|
+
last === stem.charAt(stem.length - 2) &&
|
|
511
|
+
DOUBLED_CONSONANT.test(last)) {
|
|
512
|
+
return stem.slice(0, -1);
|
|
513
|
+
}
|
|
514
|
+
return stem;
|
|
515
|
+
}
|
|
516
|
+
static add(terms, term, weight) {
|
|
517
|
+
terms.weights.set(term, (terms.weights.get(term) || 0) + weight);
|
|
518
|
+
}
|
|
519
|
+
static vector(terms, inverse) {
|
|
520
|
+
const vector = new Map();
|
|
521
|
+
for (const [term, weight] of terms.weights) {
|
|
522
|
+
// Saying a word ten times does not make it ten times as telling.
|
|
523
|
+
vector.set(term, (1 + Math.log(weight)) * inverse(term));
|
|
524
|
+
}
|
|
525
|
+
return vector;
|
|
526
|
+
}
|
|
527
|
+
static norm(vector) {
|
|
528
|
+
let sum = 0;
|
|
529
|
+
for (const value of vector.values()) {
|
|
530
|
+
sum += value * value;
|
|
531
|
+
}
|
|
532
|
+
return Math.sqrt(sum);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
exports.default = MeaningMatch;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import commonJsModule from "./MeaningMatch.js";
|
|
2
|
+
export default commonJsModule.default;
|
|
3
|
+
export const MAX_SHARED_TERMS = commonJsModule.MAX_SHARED_TERMS;
|
|
4
|
+
export const MAX_TEXT_LENGTH = commonJsModule.MAX_TEXT_LENGTH;
|
|
5
|
+
export const MEANING_CONCEPTS = commonJsModule.MEANING_CONCEPTS;
|
|
6
|
+
export const MIN_MEANING_SIMILARITY = commonJsModule.MIN_MEANING_SIMILARITY;
|
|
7
|
+
export const MIN_SHARED_WORDS = commonJsModule.MIN_SHARED_WORDS;
|
|
@@ -145,7 +145,7 @@ exports.ARCHIVABLE_VALUES = {
|
|
|
145
145
|
tableName: "ScheduledMaintenanceState",
|
|
146
146
|
singular: "scheduled maintenance state",
|
|
147
147
|
plural: "scheduled maintenance states",
|
|
148
|
-
settingsPath: "Scheduled Maintenance > Settings >
|
|
148
|
+
settingsPath: "Scheduled Maintenance > Settings > Maintenance State",
|
|
149
149
|
protections: [
|
|
150
150
|
{
|
|
151
151
|
column: "isScheduledState",
|
|
@@ -28,8 +28,8 @@ const AuditLogTypedValues_1 = require("./AuditLogTypedValues");
|
|
|
28
28
|
* out on each side.
|
|
29
29
|
*
|
|
30
30
|
* Nothing here runs a regular expression over a value: values can be
|
|
31
|
-
* megabytes long (
|
|
32
|
-
* server.
|
|
31
|
+
* megabytes long (Docs/notifications/README.md, "Megabyte-long values"). Pure:
|
|
32
|
+
* no DOM, no server.
|
|
33
33
|
*/
|
|
34
34
|
// Characters of text an entry keeps of a value.
|
|
35
35
|
exports.AUDIT_LOG_TEXT_LIMIT = 10000;
|
|
@@ -44,9 +44,17 @@ export interface ClockWidgetDisplay {
|
|
|
44
44
|
time: string;
|
|
45
45
|
/** "07", or null when the widget is configured without seconds. */
|
|
46
46
|
seconds: string | null;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* "AM" / "PM" in 12-hour mode - in the reader's words ("午後", "ب.ظ."),
|
|
49
|
+
* see getClockWidgetDisplay - null in 24-hour mode.
|
|
50
|
+
*/
|
|
48
51
|
meridiem: string | null;
|
|
49
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* True where the reader's language writes the meridiem before the time
|
|
54
|
+
* ("午後 9:05" in Japanese, Korean and Chinese); after it otherwise.
|
|
55
|
+
*/
|
|
56
|
+
isMeridiemFirst: boolean;
|
|
57
|
+
/** "Mon, Aug 3" ("Do., 12. Nov."), or null when the date is switched off. */
|
|
50
58
|
dateText: string | null;
|
|
51
59
|
/** DST-aware "EDT" / "GMT+05:30", or null when switched off. */
|
|
52
60
|
zoneAbbreviation: string | null;
|
|
@@ -72,6 +80,9 @@ export declare const isClockTimezoneFallback: IsClockTimezoneFallbackFunction;
|
|
|
72
80
|
* Seconds and meridiem come back separately from the time so the renderer can
|
|
73
81
|
* set them in a smaller type beside the big digits without re-parsing a
|
|
74
82
|
* formatted string.
|
|
83
|
+
*
|
|
84
|
+
* `language` is the reader's: the date and the meridiem are its words, and
|
|
85
|
+
* the digits its digits. None, or English, writes them as they always were.
|
|
75
86
|
*/
|
|
76
87
|
export type GetClockWidgetDisplayFunction = (data: {
|
|
77
88
|
date: Date;
|
|
@@ -81,6 +92,7 @@ export type GetClockWidgetDisplayFunction = (data: {
|
|
|
81
92
|
showSeconds?: boolean | undefined;
|
|
82
93
|
showDate?: boolean | undefined;
|
|
83
94
|
showTimezoneAbbreviation?: boolean | undefined;
|
|
95
|
+
language?: string | undefined;
|
|
84
96
|
}) => ClockWidgetDisplay;
|
|
85
97
|
export declare const getClockWidgetDisplay: GetClockWidgetDisplayFunction;
|
|
86
98
|
/**
|
|
@@ -44,9 +44,17 @@ export interface ClockWidgetDisplay {
|
|
|
44
44
|
time: string;
|
|
45
45
|
/** "07", or null when the widget is configured without seconds. */
|
|
46
46
|
seconds: string | null;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* "AM" / "PM" in 12-hour mode - in the reader's words ("午後", "ب.ظ."),
|
|
49
|
+
* see getClockWidgetDisplay - null in 24-hour mode.
|
|
50
|
+
*/
|
|
48
51
|
meridiem: string | null;
|
|
49
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* True where the reader's language writes the meridiem before the time
|
|
54
|
+
* ("午後 9:05" in Japanese, Korean and Chinese); after it otherwise.
|
|
55
|
+
*/
|
|
56
|
+
isMeridiemFirst: boolean;
|
|
57
|
+
/** "Mon, Aug 3" ("Do., 12. Nov."), or null when the date is switched off. */
|
|
50
58
|
dateText: string | null;
|
|
51
59
|
/** DST-aware "EDT" / "GMT+05:30", or null when switched off. */
|
|
52
60
|
zoneAbbreviation: string | null;
|
|
@@ -72,6 +80,9 @@ export declare const isClockTimezoneFallback: IsClockTimezoneFallbackFunction;
|
|
|
72
80
|
* Seconds and meridiem come back separately from the time so the renderer can
|
|
73
81
|
* set them in a smaller type beside the big digits without re-parsing a
|
|
74
82
|
* formatted string.
|
|
83
|
+
*
|
|
84
|
+
* `language` is the reader's: the date and the meridiem are its words, and
|
|
85
|
+
* the digits its digits. None, or English, writes them as they always were.
|
|
75
86
|
*/
|
|
76
87
|
export type GetClockWidgetDisplayFunction = (data: {
|
|
77
88
|
date: Date;
|
|
@@ -81,6 +92,7 @@ export type GetClockWidgetDisplayFunction = (data: {
|
|
|
81
92
|
showSeconds?: boolean | undefined;
|
|
82
93
|
showDate?: boolean | undefined;
|
|
83
94
|
showTimezoneAbbreviation?: boolean | undefined;
|
|
95
|
+
language?: string | undefined;
|
|
84
96
|
}) => ClockWidgetDisplay;
|
|
85
97
|
export declare const getClockWidgetDisplay: GetClockWidgetDisplayFunction;
|
|
86
98
|
/**
|