@oneuptime/common 14.1.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/Models/DatabaseModels/Alert.d.mts +1 -0
  2. package/Models/DatabaseModels/Alert.d.ts +1 -0
  3. package/Models/DatabaseModels/Alert.js +34 -0
  4. package/Models/DatabaseModels/AutoRemediationSuggestion.d.mts +2 -0
  5. package/Models/DatabaseModels/AutoRemediationSuggestion.d.ts +2 -0
  6. package/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
  7. package/Models/DatabaseModels/Incident.d.mts +1 -0
  8. package/Models/DatabaseModels/Incident.d.ts +1 -0
  9. package/Models/DatabaseModels/Incident.js +35 -0
  10. package/Models/DatabaseModels/IncidentPostmortemActionItem.d.mts +31 -0
  11. package/Models/DatabaseModels/IncidentPostmortemActionItem.d.ts +31 -0
  12. package/Models/DatabaseModels/IncidentPostmortemActionItem.js +591 -0
  13. package/Models/DatabaseModels/IncidentPostmortemActionItem.mjs +3 -0
  14. package/Models/DatabaseModels/Index.js +2 -0
  15. package/Models/DatabaseModels/TelemetryIngestionKey.js +1 -1
  16. package/Types/AI/AIActionWords.d.mts +3 -1
  17. package/Types/AI/AIActionWords.d.ts +3 -1
  18. package/Types/AI/AIActionWords.js +70 -1
  19. package/Types/AI/AIActionWords.mjs +2 -0
  20. package/Types/AI/AIChatTypes.d.mts +2 -1
  21. package/Types/AI/AIChatTypes.d.ts +2 -1
  22. package/Types/AI/AIReadTableWords.d.mts +192 -0
  23. package/Types/AI/AIReadTableWords.d.ts +192 -0
  24. package/Types/AI/AIReadTableWords.js +368 -0
  25. package/Types/AI/AIReadTableWords.mjs +18 -0
  26. package/Types/AI/AiRunRefusal.d.mts +3 -0
  27. package/Types/AI/AiRunRefusal.d.ts +3 -0
  28. package/Types/AI/AiRunRefusal.js +22 -1
  29. package/Types/AI/ResourceAiAccessPermissions.js +7 -18
  30. package/Types/AuditLog/AuditLogActionLabel.js +19 -9
  31. package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -0
  32. package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -0
  33. package/Types/BaseDatabase/AggregationIntervalUtil.js +123 -16
  34. package/Types/Cloud/CloudResourceHealth.d.mts +30 -1
  35. package/Types/Cloud/CloudResourceHealth.d.ts +30 -1
  36. package/Types/Cloud/CloudResourceHealth.js +405 -13
  37. package/Types/Cloud/CloudResourceHealth.mjs +28 -0
  38. package/Types/DataObservability/DataCheckRefusals.d.mts +32 -0
  39. package/Types/DataObservability/DataCheckRefusals.d.ts +32 -0
  40. package/Types/DataObservability/DataCheckRefusals.js +77 -0
  41. package/Types/DataObservability/DataCheckRefusals.mjs +8 -0
  42. package/Types/Database/AccessControl/PermissionScopeNarrowing.js +4 -0
  43. package/Types/Date.d.mts +2 -0
  44. package/Types/Date.d.ts +2 -0
  45. package/Types/Date.js +22 -0
  46. package/Types/DateLanguage.d.mts +2 -0
  47. package/Types/DateLanguage.d.ts +2 -0
  48. package/Types/DateLanguage.js +8 -5
  49. package/Types/Email/EmailTemplateType.d.mts +1 -0
  50. package/Types/Email/EmailTemplateType.d.ts +1 -0
  51. package/Types/Email/EmailTemplateType.js +2 -0
  52. package/Types/Exception/EgressGuardException.js +1 -1
  53. package/Types/Exception/ErrorMessageRule.d.mts +1 -0
  54. package/Types/Exception/ErrorMessageRule.d.ts +1 -0
  55. package/Types/Exception/ErrorMessageRule.js +67 -13
  56. package/Types/Exception/ErrorMessageRule.mjs +1 -0
  57. package/Types/Exception/ExceptionMessages.d.mts +2 -0
  58. package/Types/Exception/ExceptionMessages.d.ts +2 -0
  59. package/Types/Exception/ExceptionMessages.js +2 -0
  60. package/Types/Incident/PostmortemActionItemStatus.d.mts +17 -0
  61. package/Types/Incident/PostmortemActionItemStatus.d.ts +17 -0
  62. package/Types/Incident/PostmortemActionItemStatus.js +74 -0
  63. package/Types/Incident/PostmortemActionItemStatus.mjs +5 -0
  64. package/Types/JSONFunctions.js +10 -3
  65. package/Types/Link.d.mts +1 -0
  66. package/Types/Link.d.ts +1 -0
  67. package/Types/MeaningKeys.d.mts +4 -0
  68. package/Types/MeaningKeys.d.ts +4 -0
  69. package/Types/MeaningKeys.js +74 -0
  70. package/Types/MeaningKeys.mjs +5 -0
  71. package/Types/Monitor/WhoIsTold.d.mts +3 -0
  72. package/Types/Monitor/WhoIsTold.d.ts +3 -0
  73. package/Types/Monitor/WhoIsTold.js +63 -13
  74. package/Types/NoBreakSpaces.d.mts +16 -0
  75. package/Types/NoBreakSpaces.d.ts +16 -0
  76. package/Types/NoBreakSpaces.js +419 -0
  77. package/Types/NoBreakSpaces.mjs +9 -0
  78. package/Types/NotificationRule/PagingLadder.d.mts +12 -0
  79. package/Types/NotificationRule/PagingLadder.d.ts +12 -0
  80. package/Types/NotificationRule/PagingLadder.js +159 -11
  81. package/Types/NotificationRule/PagingLadder.mjs +3 -0
  82. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.mts +3 -0
  83. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.ts +3 -0
  84. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.js +42 -0
  85. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.mjs +4 -0
  86. package/Types/OnCallDutyPolicy/OnCallPageWords.d.mts +6 -2
  87. package/Types/OnCallDutyPolicy/OnCallPageWords.d.ts +6 -2
  88. package/Types/OnCallDutyPolicy/OnCallPageWords.js +21 -20
  89. package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +4 -0
  90. package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +4 -0
  91. package/Types/OnCallDutyPolicy/OnCallPersonPage.js +125 -1
  92. package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +1 -0
  93. package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +2 -0
  94. package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +2 -0
  95. package/Types/OnCallDutyPolicy/OnCallTestPage.js +12 -0
  96. package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
  97. package/Types/OpenStack/OpenStackCapacity.js +12 -5
  98. package/Types/Permission.d.mts +4 -0
  99. package/Types/Permission.d.ts +4 -0
  100. package/Types/Permission.js +64 -8
  101. package/Types/Product/ProductUsage.js +2 -1
  102. package/Types/Product/ProjectProductsAnswer.js +2 -1
  103. package/Types/ResourceAiAgent/AiResourceType.d.mts +1 -0
  104. package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
  105. package/Types/ResourceAiAgent/AiResourceType.js +12 -0
  106. package/Types/Rum/ProductAnalyticsEventReads.js +10 -1
  107. package/Types/Rum/ProductAnalyticsEvents.js +13 -1
  108. package/Types/Rum/SessionReplayCustomEvents.d.mts +4 -1
  109. package/Types/Rum/SessionReplayCustomEvents.d.ts +4 -1
  110. package/Types/Rum/SessionReplayCustomEvents.js +12 -0
  111. package/Types/Rum/SessionReplayCustomEvents.mjs +1 -0
  112. package/Types/SetupHealth/SetupHealth.d.mts +1 -0
  113. package/Types/SetupHealth/SetupHealth.d.ts +1 -0
  114. package/Types/SetupHealth/SetupHealth.js +13 -5
  115. package/Types/StatusPage/DefaultStatusNames.d.mts +11 -3
  116. package/Types/StatusPage/DefaultStatusNames.d.ts +11 -3
  117. package/Types/StatusPage/DefaultStatusNames.js +74 -28
  118. package/Types/StatusPage/DefaultStatusNames.mjs +9 -2
  119. package/Types/StatusPage/StateChangeNoteMessage.d.mts +3 -2
  120. package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
  121. package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
  122. package/Types/Telemetry/TelemetryIngestionKeyType.js +7 -6
  123. package/Types/Translator.d.mts +1 -0
  124. package/Types/Translator.d.ts +1 -0
  125. package/Types/Translator.js +100 -19
  126. package/Types/Translator.mjs +1 -0
  127. package/Types/UserSession/SessionLength.d.mts +33 -0
  128. package/Types/UserSession/SessionLength.d.ts +33 -0
  129. package/Types/UserSession/SessionLength.js +134 -5
  130. package/Types/UserSession/SessionLength.mjs +5 -0
  131. package/Types/Workflow/WorkflowStatus.js +21 -10
  132. package/Utils/AI/InvestigationReport.js +2 -2
  133. package/Utils/API.d.mts +0 -11
  134. package/Utils/API.d.ts +0 -11
  135. package/Utils/API.js +0 -432
  136. package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +2 -2
  137. package/Utils/AiRemediation/VerifiedFixRunbook.d.mts +39 -0
  138. package/Utils/AiRemediation/VerifiedFixRunbook.d.ts +39 -0
  139. package/Utils/AiRemediation/VerifiedFixRunbook.js +231 -0
  140. package/Utils/AiRemediation/VerifiedFixRunbook.mjs +10 -0
  141. package/Utils/Dashboard/DashboardWidgetSorts.js +11 -2
  142. package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +2 -1
  143. package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +2 -1
  144. package/Utils/Dashboard/MonitorListWidgetFormat.js +5 -3
  145. package/Utils/DefaultRecordNames.d.mts +6 -0
  146. package/Utils/DefaultRecordNames.d.ts +6 -0
  147. package/Utils/DefaultRecordNames.js +122 -0
  148. package/Utils/DefaultRecordNames.mjs +6 -0
  149. package/Utils/Grok/Grok.js +7 -4
  150. package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +20 -0
  151. package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +20 -0
  152. package/Utils/Incident/PostmortemActionItemCodeTask.js +107 -0
  153. package/Utils/Incident/PostmortemActionItemCodeTask.mjs +10 -0
  154. package/Utils/Incident/PostmortemActionItemMarkdown.d.mts +39 -0
  155. package/Utils/Incident/PostmortemActionItemMarkdown.d.ts +39 -0
  156. package/Utils/Incident/PostmortemActionItemMarkdown.js +118 -0
  157. package/Utils/Incident/PostmortemActionItemMarkdown.mjs +12 -0
  158. package/Utils/Incident/PostmortemNoteActionItems.d.mts +29 -0
  159. package/Utils/Incident/PostmortemNoteActionItems.d.ts +29 -0
  160. package/Utils/Incident/PostmortemNoteActionItems.js +544 -0
  161. package/Utils/Incident/PostmortemNoteActionItems.mjs +7 -0
  162. package/Utils/LookupTable.d.mts +3 -0
  163. package/Utils/LookupTable.d.ts +3 -0
  164. package/Utils/LookupTable.js +61 -0
  165. package/Utils/LookupTable.mjs +3 -0
  166. package/Utils/Markdown/LinkReferenceDefinitions.d.mts +2 -0
  167. package/Utils/Markdown/LinkReferenceDefinitions.d.ts +2 -0
  168. package/Utils/Markdown/LinkReferenceDefinitions.js +101 -1
  169. package/Utils/Markdown/LinkReferenceDefinitions.mjs +2 -0
  170. package/Utils/Markdown/OverLongText.js +296 -2
  171. package/Utils/Markdown/SlowMarkdown.d.mts +1 -0
  172. package/Utils/Markdown/SlowMarkdown.d.ts +1 -0
  173. package/Utils/Markdown/SlowMarkdown.js +354 -4
  174. package/Utils/Markdown/SlowMarkdown.mjs +1 -0
  175. package/Utils/Metrics/MetricFormulaEvaluator.js +10 -4
  176. package/Utils/Metrics/MetricSeriesFingerprint.js +13 -4
  177. package/Utils/Metrics/MetricSeriesScope.d.mts +5 -0
  178. package/Utils/Metrics/MetricSeriesScope.d.ts +5 -0
  179. package/Utils/Metrics/MetricSeriesScope.js +5 -1
  180. package/Utils/Monitor/MonitorRootCauseWording.d.mts +3 -0
  181. package/Utils/Monitor/MonitorRootCauseWording.d.ts +3 -0
  182. package/Utils/Monitor/MonitorRootCauseWording.js +100 -11
  183. package/Utils/Monitor/ProbeAgreementRule.d.mts +10 -0
  184. package/Utils/Monitor/ProbeAgreementRule.d.ts +10 -0
  185. package/Utils/Monitor/ProbeAgreementRule.js +58 -0
  186. package/Utils/Monitor/ProbeAgreementRule.mjs +3 -0
  187. package/Utils/Monitor/ProbeFailureReading.d.mts +4 -0
  188. package/Utils/Monitor/ProbeFailureReading.d.ts +4 -0
  189. package/Utils/Monitor/ProbeFailureReading.js +30 -1
  190. package/Utils/Monitor/ProbeFailureReading.mjs +1 -0
  191. package/Utils/Monitor/RequestFailureDescriptions.d.mts +61 -0
  192. package/Utils/Monitor/RequestFailureDescriptions.d.ts +61 -0
  193. package/Utils/Monitor/RequestFailureDescriptions.js +252 -0
  194. package/Utils/Monitor/RequestFailureDescriptions.mjs +6 -0
  195. package/Utils/PromQL/PromQLEngine.js +18 -9
  196. package/Utils/PromQL/PromQLFunctionEvaluators.js +114 -58
  197. package/Utils/PromQL/PromQLLabelOrder.d.mts +8 -0
  198. package/Utils/PromQL/PromQLLabelOrder.d.ts +8 -0
  199. package/Utils/PromQL/PromQLLabelOrder.js +212 -0
  200. package/Utils/PromQL/PromQLLabelOrder.mjs +6 -0
  201. package/Utils/PromQL/PromQLLabels.js +4 -3
  202. package/Utils/PromQL/PromQLMetricNames.js +8 -2
  203. package/Utils/PromQL/PromQLParser.js +11 -6
  204. package/Utils/PromQL/PromQLRegex.d.mts +11 -0
  205. package/Utils/PromQL/PromQLRegex.d.ts +11 -0
  206. package/Utils/PromQL/PromQLRegex.js +990 -50
  207. package/Utils/PromQL/PromQLRegex.mjs +3 -0
  208. package/Utils/PromQL/PrometheusResponse.js +3 -1
  209. package/Utils/PromQL/RE2CharacterClass.d.mts +24 -0
  210. package/Utils/PromQL/RE2CharacterClass.d.ts +24 -0
  211. package/Utils/PromQL/RE2CharacterClass.js +532 -0
  212. package/Utils/PromQL/RE2CharacterClass.mjs +16 -0
  213. package/Utils/RequestFailedDetailsUtil.d.mts +15 -0
  214. package/Utils/RequestFailedDetailsUtil.d.ts +15 -0
  215. package/Utils/RequestFailedDetailsUtil.js +452 -0
  216. package/Utils/RequestFailedDetailsUtil.mjs +2 -0
  217. package/Utils/Rum/UrlScrubber.d.mts +1 -1
  218. package/Utils/Rum/UrlScrubber.d.ts +1 -1
  219. package/Utils/Rum/UrlScrubber.js +10 -4
  220. package/Utils/Rum/UserFlow.js +22 -4
  221. package/Utils/SecurityCase/SecurityOverviewMetrics.d.mts +11 -1
  222. package/Utils/SecurityCase/SecurityOverviewMetrics.d.ts +11 -1
  223. package/Utils/SecurityCase/SecurityOverviewMetrics.js +99 -17
  224. package/Utils/SecurityCase/SecurityOverviewMetrics.mjs +3 -0
  225. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  226. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  227. package/Utils/Sms/OnCallPageSms.js +3 -1
  228. package/Utils/StateListType.d.mts +11 -0
  229. package/Utils/StateListType.d.ts +11 -0
  230. package/Utils/StateListType.js +21 -0
  231. package/Utils/StateListType.mjs +2 -0
  232. package/Utils/StateOrder.d.mts +8 -11
  233. package/Utils/StateOrder.d.ts +8 -11
  234. package/Utils/StateOrder.js +49 -84
  235. package/Utils/StateOrder.mjs +2 -0
  236. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.mts +9 -0
  237. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.ts +9 -0
  238. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.js +25 -0
  239. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.mjs +2 -0
  240. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.mts +5 -0
  241. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.ts +5 -0
  242. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.js +39 -0
  243. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.mjs +2 -0
  244. package/Utils/Syslog/SyslogMessageParser.js +16 -6
  245. package/Utils/Telemetry/HeartbeatAvailability.js +16 -21
  246. package/Utils/ValueFormatter.d.mts +1 -0
  247. package/Utils/ValueFormatter.d.ts +1 -0
  248. package/Utils/ValueFormatter.js +258 -18
  249. package/package.json +1 -1
@@ -35,8 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const FeedMarkdown_1 = __importStar(require("../Markdown/FeedMarkdown"));
37
37
  const EvaluationSentence_1 = require("../../Types/Monitor/EvaluationSentence");
38
+ const ReadingDirection_1 = require("../../Types/ReadingDirection");
38
39
  const Translator_1 = require("../../Types/Translator");
39
40
  const ProbeFailureReading_1 = require("./ProbeFailureReading");
41
+ const RequestFailureDescriptions_1 = require("./RequestFailureDescriptions");
40
42
  /*
41
43
  * THE ROOT CAUSE A MONITOR WROTE, IN THE READER'S LANGUAGE (issue #6542).
42
44
  *
@@ -62,11 +64,27 @@ const ProbeFailureReading_1 = require("./ProbeFailureReading");
62
64
  * written. A root cause somebody edited reads as they wrote it, but for a
63
65
  * line that is still OneUptime's own.
64
66
  *
65
- * Two of the check's values are OneUptime's own words too, and read in the
66
- * reader's language when the whole value is exactly them: the probe's
67
+ * Three of the check's values are OneUptime's own words too, and read in
68
+ * the reader's language when the whole value is exactly them: the probe's
67
69
  * timeout sentence after **Cause** ("Request was tried 3 times and it
68
- * timed out.", ProbeFailureReading), and the phase after "- Failed Phase:"
69
- * (DNS Resolution, TLS Handshake).
70
+ * timed out.", ProbeFailureReading), the phase after "- Failed Phase:"
71
+ * (DNS Resolution, TLS Handshake), and what the failed request means after
72
+ * "- Error Description:" ("DNS resolution failed. ...",
73
+ * RequestFailureDescriptions).
74
+ *
75
+ * On a page read from the right, a line OneUptime words is its words with
76
+ * a stored value after them - "**نام معیار**: Website is down", "- کد
77
+ * خطا: ETIMEDOUT" - and the value usually has more letters than the
78
+ * label. The viewer lays each block out the way most of its letters read
79
+ * (MarkdownReadingDirection), so the line was laid out from the left, its
80
+ * label's colon and its bullet on the wrong side, and the card turned
81
+ * from side to side line by line. Drawn on the page (setsValuesApart),
82
+ * each value kept as stored is set apart from the label in an isolate
83
+ * (FSI ... PDI) where it could move the words round it, as a sentence's
84
+ * values are (SentenceOptions.setsValuesApart): the line reads the way its
85
+ * label does, the value as written inside it, its full stop at its own
86
+ * end. A root cause somebody typed has no line of OneUptime's, and reads
87
+ * the way its own words do.
70
88
  *
71
89
  * Line by line, and only a whole line, or a label at a line's start, is
72
90
  * ever replaced: nothing else in the text is read as one of OneUptime's.
@@ -140,6 +158,14 @@ const FILTER_CONDITIONS_MET = "Filter Conditions Met";
140
158
  const CAUSE = "Cause";
141
159
  // "- Failed Phase: <the phase a request broke in>".
142
160
  const FAILED_PHASE = "Failed Phase";
161
+ // "- Error Description: <what the failed request means>".
162
+ const ERROR_DESCRIPTION = "Error Description";
163
+ /*
164
+ * A backslash before ASCII punctuation: how mdText escapes a value's
165
+ * Markdown (FeedMarkdown). Read back to the value's text, which is only
166
+ * trusted when mdText writes it back to the very line.
167
+ */
168
+ const MARKDOWN_ESCAPE = /\\([!-/:-@[-`{-~])/g;
143
169
  /*
144
170
  * "**Label**" or "**Label**: rest" - a label of at most 80 characters with
145
171
  * no asterisk or line break in it, so the match is linear in the line.
@@ -161,6 +187,19 @@ class MonitorRootCauseWording {
161
187
  if (!data.rootCause || translator.language === "en") {
162
188
  return data.rootCause;
163
189
  }
190
+ const setsValuesApart = Boolean(data.setsValuesApart);
191
+ const readerDirection = (0, ReadingDirection_1.getReadingDirection)(translator.language);
192
+ /*
193
+ * A stored value after `label`, set apart (when asked) by the way the
194
+ * line reads: the reader's, once their language words the label;
195
+ * English's while it does not.
196
+ */
197
+ const storedValue = (label, stored) => {
198
+ if (!setsValuesApart) {
199
+ return FeedMarkdown_1.default.asMarkdown(stored);
200
+ }
201
+ return FeedMarkdown_1.default.asMarkdown(MonitorRootCauseWording.setApart(stored, translator.hasTranslation(label) ? readerDirection : ReadingDirection_1.LEFT_TO_RIGHT));
202
+ };
164
203
  const findings = MonitorRootCauseWording.getWordedFindings({
165
204
  findings: data.findings || [],
166
205
  translator: translator,
@@ -182,12 +221,13 @@ class MonitorRootCauseWording {
182
221
  return data.rootCause
183
222
  .split("\n")
184
223
  .map((line) => {
224
+ var _a;
185
225
  const boldLabel = BOLD_LABEL_LINE.exec(line);
186
226
  if (boldLabel && BOLD_LABEL_SET.has(boldLabel[1])) {
187
227
  const label = boldLabel[1];
188
228
  const stored = boldLabel[3] || "";
189
229
  // What follows the label: as stored, unless this language words it.
190
- let rest = FeedMarkdown_1.default.asMarkdown(stored);
230
+ let rest = storedValue(label, stored);
191
231
  // "**Cause**: <the probe's timeout sentence>", worded with its count.
192
232
  if (label === CAUSE && stored.startsWith(" ")) {
193
233
  const worded = MonitorRootCauseWording.wordProbeTimeout(stored.slice(1), translator);
@@ -218,16 +258,27 @@ class MonitorRootCauseWording {
218
258
  const label = fact[1];
219
259
  const stored = fact[2] || "";
220
260
  /*
221
- * OneUptime's own yes or no, and the phase a request broke in, are
222
- * worded; any other value is as stored.
261
+ * OneUptime's own yes or no, the phase a request broke in and what
262
+ * the failed request means are worded; any other value is as
263
+ * stored.
223
264
  */
224
- let value = FeedMarkdown_1.default.asMarkdown(stored);
265
+ let value = storedValue(label, stored);
225
266
  if (YES_NO_FACTS.has(label) &&
226
267
  (stored === "Yes" || stored === "No")) {
227
268
  value = MonitorRootCauseWording.word(stored, translator);
228
269
  }
229
270
  else if (label === FAILED_PHASE) {
230
- value = MonitorRootCauseWording.wordFailedPhase(stored, translator);
271
+ value =
272
+ (_a = MonitorRootCauseWording.wordFailedPhase(stored, translator)) !== null && _a !== void 0 ? _a : value;
273
+ }
274
+ else if (label === ERROR_DESCRIPTION) {
275
+ value =
276
+ MonitorRootCauseWording.wordErrorDescription({
277
+ line: line,
278
+ stored: stored,
279
+ translator: translator,
280
+ setsValuesApart: setsValuesApart,
281
+ }) || value;
231
282
  }
232
283
  return (0, FeedMarkdown_1.mdText) `- ${MonitorRootCauseWording.word(label, translator)}: ${value}`.toString();
233
284
  }
@@ -267,7 +318,7 @@ class MonitorRootCauseWording {
267
318
  }
268
319
  /*
269
320
  * The phase a request broke in: a phase the probe names, in the reader's
270
- * word; any other value as stored.
321
+ * word; null for any other value, which stays as stored.
271
322
  */
272
323
  static wordFailedPhase(stored, translator) {
273
324
  const phase = stored.trim();
@@ -275,7 +326,45 @@ class MonitorRootCauseWording {
275
326
  translator: translator,
276
327
  failedPhase: phase,
277
328
  });
278
- return phase && worded !== phase ? worded : FeedMarkdown_1.default.asMarkdown(stored);
329
+ return phase && worded !== phase ? worded : null;
330
+ }
331
+ /*
332
+ * What the failed request means, as the engine placed it after "- Error
333
+ * Description:" (written with mdText): one of OneUptime's explanations
334
+ * (RequestFailureDescriptions) in the reader's language, the message
335
+ * that came with it kept as written - set apart from the reader's words
336
+ * when asked. Null for any other value, and when the reader's language
337
+ * does not word the explanation.
338
+ *
339
+ * The stored value is Markdown: it is read back to its text, which is
340
+ * only taken for the explanation when mdText writes it back to the very
341
+ * line the engine stored.
342
+ */
343
+ static wordErrorDescription(data) {
344
+ const text = data.stored.replace(MARKDOWN_ESCAPE, "$1");
345
+ if (!(0, RequestFailureDescriptions_1.readRequestFailureDescription)(text) ||
346
+ (0, FeedMarkdown_1.mdText) `- ${ERROR_DESCRIPTION}: ${text}`.toString() !== data.line) {
347
+ return null;
348
+ }
349
+ const worded = (0, RequestFailureDescriptions_1.getRequestFailureDescriptionText)({
350
+ translator: data.translator,
351
+ description: text,
352
+ options: { setsValuesApart: data.setsValuesApart },
353
+ });
354
+ return worded === text.trim() ? null : worded;
355
+ }
356
+ /*
357
+ * A stored value set apart from the line it is in (setApartInSentence),
358
+ * the space round it left outside the isolate: a value of the line's own
359
+ * script, or with no letter or digit, is left as it is.
360
+ */
361
+ static setApart(stored, lineDirection) {
362
+ const value = stored.trim();
363
+ if (!value) {
364
+ return stored;
365
+ }
366
+ const start = stored.length - stored.trimStart().length;
367
+ return `${stored.slice(0, start)}${(0, ReadingDirection_1.setApartInSentence)(value, lineDirection)}${stored.slice(start + value.length)}`;
279
368
  }
280
369
  // Each finding with a sentence its reader's language words.
281
370
  static getWordedFindings(data) {
@@ -0,0 +1,10 @@
1
+ import { Translator } from "../../Types/Translator.mjs";
2
+ export declare const getProbeAgreementRequiredCount: (data: {
3
+ minimumProbeAgreement: number | null | undefined;
4
+ activeProbeCount: number;
5
+ }) => number;
6
+ export declare const getProbeAgreementSentence: (data: {
7
+ minimumProbeAgreement: number | null | undefined;
8
+ activeProbeCount: number;
9
+ translator: Translator;
10
+ }) => string | null;
@@ -0,0 +1,10 @@
1
+ import { Translator } from "../../Types/Translator";
2
+ export declare const getProbeAgreementRequiredCount: (data: {
3
+ minimumProbeAgreement: number | null | undefined;
4
+ activeProbeCount: number;
5
+ }) => number;
6
+ export declare const getProbeAgreementSentence: (data: {
7
+ minimumProbeAgreement: number | null | undefined;
8
+ activeProbeCount: number;
9
+ translator: Translator;
10
+ }) => string | null;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProbeAgreementSentence = exports.getProbeAgreementRequiredCount = void 0;
4
+ /*
5
+ * THE PROBE AGREEMENT RULE, ONE COPY FOR THE SERVER AND THE PAGES.
6
+ *
7
+ * A probe-based monitor changes status only when its probes agree
8
+ * (MonitorResourceUtil.checkProbeAgreement): each enabled, connected probe
9
+ * judges its latest answer against the criteria, the verdict most of them
10
+ * reached wins, and it counts only when at least the required number of
11
+ * them reached it. The required number is the monitor's
12
+ * minimumProbeAgreement - all of them when it is not set - and never more
13
+ * than the probes that take part, so 3 required with one of three probes
14
+ * disconnected is 2 of 2.
15
+ *
16
+ * The server decides with getProbeAgreementRequiredCount; the monitor's
17
+ * probes card and the website-down guided setup say what it decides with
18
+ * the same function, so a page never promises an incident the server
19
+ * would not open (#7410).
20
+ */
21
+ const getProbeAgreementRequiredCount = (data) => {
22
+ /*
23
+ * A number read back as text ("3") is that number, as Math.min took it
24
+ * when the server wrote `minimumProbeAgreement ?? activeProbes.length`.
25
+ */
26
+ const minimum = Number(data.minimumProbeAgreement);
27
+ const isSet = data.minimumProbeAgreement !== null &&
28
+ data.minimumProbeAgreement !== undefined &&
29
+ Number.isFinite(minimum);
30
+ return Math.min(isSet ? minimum : data.activeProbeCount, data.activeProbeCount);
31
+ };
32
+ exports.getProbeAgreementRequiredCount = getProbeAgreementRequiredCount;
33
+ /*
34
+ * The rule in a sentence: "A status change needs both connected probes to
35
+ * agree." Null when no agreement is needed - one probe, or a minimum of
36
+ * one. Its counts are written in the reader's digits ("۲ از ۳ پراب متصل").
37
+ */
38
+ const getProbeAgreementSentence = (data) => {
39
+ const translator = data.translator;
40
+ const activeCount = data.activeProbeCount;
41
+ const requiredCount = (0, exports.getProbeAgreementRequiredCount)({
42
+ minimumProbeAgreement: data.minimumProbeAgreement,
43
+ activeProbeCount: activeCount,
44
+ });
45
+ if (activeCount < 2 || requiredCount < 2) {
46
+ return null;
47
+ }
48
+ if (requiredCount < activeCount) {
49
+ return translator.translateTemplate("A status change needs {{required}} of {{count}} connected probes to agree.", {
50
+ required: translator.formatNumber(requiredCount),
51
+ count: translator.formatNumber(activeCount),
52
+ });
53
+ }
54
+ return activeCount === 2
55
+ ? translator.translateTemplate("A status change needs both connected probes to agree.")
56
+ : translator.translateTemplate("A status change needs all {{count}} connected probes to agree.", { count: translator.formatNumber(activeCount) });
57
+ };
58
+ exports.getProbeAgreementSentence = getProbeAgreementSentence;
@@ -0,0 +1,3 @@
1
+ import commonJsModule from "./ProbeAgreementRule.js";
2
+ export const getProbeAgreementRequiredCount = commonJsModule.getProbeAgreementRequiredCount;
3
+ export const getProbeAgreementSentence = commonJsModule.getProbeAgreementSentence;
@@ -7,6 +7,10 @@ export declare const getProbeFailureCauseText: (data: {
7
7
  translator: Translator;
8
8
  failureCause: string | null | undefined;
9
9
  }) => string;
10
+ export declare const getProbeMessageText: (data: {
11
+ translator: Translator;
12
+ message: string | null | undefined;
13
+ }) => string;
10
14
  export declare const REQUEST_FAILED_PHASE_WORDS: Readonly<Record<RequestFailedPhase, string>>;
11
15
  export declare const getRequestFailedPhaseText: (data: {
12
16
  translator: Translator;
@@ -7,6 +7,10 @@ export declare const getProbeFailureCauseText: (data: {
7
7
  translator: Translator;
8
8
  failureCause: string | null | undefined;
9
9
  }) => string;
10
+ export declare const getProbeMessageText: (data: {
11
+ translator: Translator;
12
+ message: string | null | undefined;
13
+ }) => string;
10
14
  export declare const REQUEST_FAILED_PHASE_WORDS: Readonly<Record<RequestFailedPhase, string>>;
11
15
  export declare const getRequestFailedPhaseText: (data: {
12
16
  translator: Translator;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRequestFailedPhaseText = exports.REQUEST_FAILED_PHASE_WORDS = exports.getProbeFailureCauseText = exports.readProbeTimeoutFailureCause = exports.writeProbeTimeoutFailureCause = exports.PROBE_TIMEOUT_FAILURE_CAUSE = void 0;
3
+ exports.getRequestFailedPhaseText = exports.REQUEST_FAILED_PHASE_WORDS = exports.getProbeMessageText = exports.getProbeFailureCauseText = exports.readProbeTimeoutFailureCause = exports.writeProbeTimeoutFailureCause = exports.PROBE_TIMEOUT_FAILURE_CAUSE = void 0;
4
4
  const RequestFailedDetails_1 = require("../../Types/Probe/RequestFailedDetails");
5
5
  const Translator_1 = require("../../Types/Translator");
6
+ const RequestFailureDescriptions_1 = require("./RequestFailureDescriptions");
6
7
  /*
7
8
  * WHY A PROBE'S CHECK FAILED, READ IN THE READER'S LANGUAGE.
8
9
  *
@@ -98,6 +99,34 @@ const getProbeFailureCauseText = (data) => {
98
99
  return data.translator.translatePlural(exports.PROBE_TIMEOUT_FAILURE_CAUSE, triedCount);
99
100
  };
100
101
  exports.getProbeFailureCauseText = getProbeFailureCauseText;
102
+ // A text drawn on the page and nothing else (SentenceOptions).
103
+ const ON_THE_PAGE = { setsValuesApart: true };
104
+ /*
105
+ * Any message of the probe's as a monitor summary draws it on the page:
106
+ * OneUptime's own sentences in the reader's language - the timeout
107
+ * sentence (getProbeFailureCauseText), and what a failed request means
108
+ * (Error Details, RequestFailureDescriptions), with the message that came
109
+ * with it kept as written and set apart from the reader's words - and any
110
+ * other message as written, trimmed.
111
+ *
112
+ * Only for a text drawn on the page and nothing else: the isolate's marks
113
+ * round a message kept as written are characters.
114
+ */
115
+ const getProbeMessageText = (data) => {
116
+ const text = typeof data.message === "string" ? data.message.trim() : "";
117
+ if ((0, RequestFailureDescriptions_1.readRequestFailureDescription)(text)) {
118
+ return (0, RequestFailureDescriptions_1.getRequestFailureDescriptionText)({
119
+ translator: data.translator,
120
+ description: text,
121
+ options: ON_THE_PAGE,
122
+ });
123
+ }
124
+ return (0, exports.getProbeFailureCauseText)({
125
+ translator: data.translator,
126
+ failureCause: text,
127
+ });
128
+ };
129
+ exports.getProbeMessageText = getProbeMessageText;
101
130
  /*
102
131
  * WHERE A REQUEST BROKE.
103
132
  *
@@ -2,6 +2,7 @@ import commonJsModule from "./ProbeFailureReading.js";
2
2
  export const PROBE_TIMEOUT_FAILURE_CAUSE = commonJsModule.PROBE_TIMEOUT_FAILURE_CAUSE;
3
3
  export const REQUEST_FAILED_PHASE_WORDS = commonJsModule.REQUEST_FAILED_PHASE_WORDS;
4
4
  export const getProbeFailureCauseText = commonJsModule.getProbeFailureCauseText;
5
+ export const getProbeMessageText = commonJsModule.getProbeMessageText;
5
6
  export const getRequestFailedPhaseText = commonJsModule.getRequestFailedPhaseText;
6
7
  export const readProbeTimeoutFailureCause = commonJsModule.readProbeTimeoutFailureCause;
7
8
  export const writeProbeTimeoutFailureCause = commonJsModule.writeProbeTimeoutFailureCause;
@@ -0,0 +1,61 @@
1
+ import { SentenceOptions, Translator } from "../../Types/Translator.mjs";
2
+ export declare enum RequestFailureDescription {
3
+ InvalidTarget = "InvalidTarget",
4
+ TargetUnreachable = "TargetUnreachable",
5
+ ProbeCouldNotConnect = "ProbeCouldNotConnect",
6
+ ProbeCouldNotConnectOverIPv6 = "ProbeCouldNotConnectOverIPv6",
7
+ ProbeCannotSendIPv6 = "ProbeCannotSendIPv6",
8
+ NoIPv6Route = "NoIPv6Route",
9
+ NetworkUnreachable = "NetworkUnreachable",
10
+ DnsResolutionFailed = "DnsResolutionFailed",
11
+ ConnectionRefused = "ConnectionRefused",
12
+ ConnectionReset = "ConnectionReset",
13
+ ConnectionAborted = "ConnectionAborted",
14
+ RequestTimedOut = "RequestTimedOut",
15
+ CertificateRevoked = "CertificateRevoked",
16
+ CertificateExpired = "CertificateExpired",
17
+ SelfSignedCertificate = "SelfSignedCertificate",
18
+ CertificateUnknownAuthority = "CertificateUnknownAuthority",
19
+ TlsHandshakeFailed = "TlsHandshakeFailed",
20
+ NetworkError = "NetworkError",
21
+ HostUnreachable = "HostUnreachable",
22
+ HttpStatus = "HttpStatus",
23
+ HttpServerError = "HttpServerError",
24
+ HttpNotFound = "HttpNotFound",
25
+ HttpForbidden = "HttpForbidden",
26
+ HttpUnauthorized = "HttpUnauthorized",
27
+ HttpBadRequest = "HttpBadRequest",
28
+ HttpClientError = "HttpClientError",
29
+ NoResponse = "NoResponse",
30
+ RequestFailed = "RequestFailed",
31
+ PortProbeCouldNotConnect = "PortProbeCouldNotConnect",
32
+ PortProbeCouldNotConnectOverIPv6 = "PortProbeCouldNotConnectOverIPv6",
33
+ PortProbeCannotSendIPv6 = "PortProbeCannotSendIPv6",
34
+ PortNoIPv6Route = "PortNoIPv6Route",
35
+ PortDnsResolutionFailed = "PortDnsResolutionFailed",
36
+ PortConnectionTimedOut = "PortConnectionTimedOut",
37
+ PortTcpConnectionFailed = "PortTcpConnectionFailed",
38
+ PortNetworkError = "PortNetworkError",
39
+ NtpLookupTimedOut = "NtpLookupTimedOut",
40
+ NtpNoReply = "NtpNoReply",
41
+ NtpNameDidNotResolve = "NtpNameDidNotResolve",
42
+ NtpPortUnreachable = "NtpPortUnreachable",
43
+ NtpProbeCouldNotSend = "NtpProbeCouldNotSend",
44
+ NtpNetworkError = "NtpNetworkError"
45
+ }
46
+ export declare const REQUEST_FAILURE_DESCRIPTIONS: Readonly<Record<RequestFailureDescription, string>>;
47
+ export interface RequestFailureDescriptionValues {
48
+ status?: number | string | undefined;
49
+ message?: string | undefined;
50
+ }
51
+ export declare const writeRequestFailureDescription: (description: RequestFailureDescription, values?: RequestFailureDescriptionValues) => string;
52
+ export interface RequestFailureDescriptionReading {
53
+ description: RequestFailureDescription;
54
+ values: RequestFailureDescriptionValues;
55
+ }
56
+ export declare const readRequestFailureDescription: (text: string | null | undefined) => RequestFailureDescriptionReading | null;
57
+ export declare const getRequestFailureDescriptionText: (data: {
58
+ translator: Translator;
59
+ description: string | null | undefined;
60
+ options?: SentenceOptions | undefined;
61
+ }) => string;
@@ -0,0 +1,61 @@
1
+ import { SentenceOptions, Translator } from "../../Types/Translator";
2
+ export declare enum RequestFailureDescription {
3
+ InvalidTarget = "InvalidTarget",
4
+ TargetUnreachable = "TargetUnreachable",
5
+ ProbeCouldNotConnect = "ProbeCouldNotConnect",
6
+ ProbeCouldNotConnectOverIPv6 = "ProbeCouldNotConnectOverIPv6",
7
+ ProbeCannotSendIPv6 = "ProbeCannotSendIPv6",
8
+ NoIPv6Route = "NoIPv6Route",
9
+ NetworkUnreachable = "NetworkUnreachable",
10
+ DnsResolutionFailed = "DnsResolutionFailed",
11
+ ConnectionRefused = "ConnectionRefused",
12
+ ConnectionReset = "ConnectionReset",
13
+ ConnectionAborted = "ConnectionAborted",
14
+ RequestTimedOut = "RequestTimedOut",
15
+ CertificateRevoked = "CertificateRevoked",
16
+ CertificateExpired = "CertificateExpired",
17
+ SelfSignedCertificate = "SelfSignedCertificate",
18
+ CertificateUnknownAuthority = "CertificateUnknownAuthority",
19
+ TlsHandshakeFailed = "TlsHandshakeFailed",
20
+ NetworkError = "NetworkError",
21
+ HostUnreachable = "HostUnreachable",
22
+ HttpStatus = "HttpStatus",
23
+ HttpServerError = "HttpServerError",
24
+ HttpNotFound = "HttpNotFound",
25
+ HttpForbidden = "HttpForbidden",
26
+ HttpUnauthorized = "HttpUnauthorized",
27
+ HttpBadRequest = "HttpBadRequest",
28
+ HttpClientError = "HttpClientError",
29
+ NoResponse = "NoResponse",
30
+ RequestFailed = "RequestFailed",
31
+ PortProbeCouldNotConnect = "PortProbeCouldNotConnect",
32
+ PortProbeCouldNotConnectOverIPv6 = "PortProbeCouldNotConnectOverIPv6",
33
+ PortProbeCannotSendIPv6 = "PortProbeCannotSendIPv6",
34
+ PortNoIPv6Route = "PortNoIPv6Route",
35
+ PortDnsResolutionFailed = "PortDnsResolutionFailed",
36
+ PortConnectionTimedOut = "PortConnectionTimedOut",
37
+ PortTcpConnectionFailed = "PortTcpConnectionFailed",
38
+ PortNetworkError = "PortNetworkError",
39
+ NtpLookupTimedOut = "NtpLookupTimedOut",
40
+ NtpNoReply = "NtpNoReply",
41
+ NtpNameDidNotResolve = "NtpNameDidNotResolve",
42
+ NtpPortUnreachable = "NtpPortUnreachable",
43
+ NtpProbeCouldNotSend = "NtpProbeCouldNotSend",
44
+ NtpNetworkError = "NtpNetworkError"
45
+ }
46
+ export declare const REQUEST_FAILURE_DESCRIPTIONS: Readonly<Record<RequestFailureDescription, string>>;
47
+ export interface RequestFailureDescriptionValues {
48
+ status?: number | string | undefined;
49
+ message?: string | undefined;
50
+ }
51
+ export declare const writeRequestFailureDescription: (description: RequestFailureDescription, values?: RequestFailureDescriptionValues) => string;
52
+ export interface RequestFailureDescriptionReading {
53
+ description: RequestFailureDescription;
54
+ values: RequestFailureDescriptionValues;
55
+ }
56
+ export declare const readRequestFailureDescription: (text: string | null | undefined) => RequestFailureDescriptionReading | null;
57
+ export declare const getRequestFailureDescriptionText: (data: {
58
+ translator: Translator;
59
+ description: string | null | undefined;
60
+ options?: SentenceOptions | undefined;
61
+ }) => string;