@oneuptime/common 14.0.107 → 14.0.108

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 (129) hide show
  1. package/Models/DatabaseModels/DataBiConnection.d.mts +4 -0
  2. package/Models/DatabaseModels/DataBiConnection.d.ts +4 -0
  3. package/Models/DatabaseModels/DataBiConnection.js +59 -2
  4. package/Models/DatabaseModels/Index.js +2 -0
  5. package/Models/DatabaseModels/RumProductAnalyticsSavedView.d.mts +20 -0
  6. package/Models/DatabaseModels/RumProductAnalyticsSavedView.d.ts +20 -0
  7. package/Models/DatabaseModels/RumProductAnalyticsSavedView.js +353 -0
  8. package/Models/DatabaseModels/RumProductAnalyticsSavedView.mjs +2 -0
  9. package/Models/DatabaseModels/WhatsAppLog.d.mts +3 -0
  10. package/Models/DatabaseModels/WhatsAppLog.d.ts +3 -0
  11. package/Models/DatabaseModels/WhatsAppLog.js +62 -0
  12. package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.mts +11 -0
  13. package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.ts +11 -0
  14. package/Models/DatabaseModels/WorkspaceUserGroup.js +1 -1
  15. package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.mts +212 -0
  16. package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.ts +212 -0
  17. package/Server/Utils/Workspace/WorkspaceBase.d.mts +3 -0
  18. package/Server/Utils/Workspace/WorkspaceBase.d.ts +3 -0
  19. package/Types/AI/AIChatTypes.d.mts +2 -1
  20. package/Types/AI/AIChatTypes.d.ts +2 -1
  21. package/Types/AI/AIChatTypes.js +2 -0
  22. package/Types/AI/InvestigationNotStartedReason.d.mts +7 -0
  23. package/Types/AI/InvestigationNotStartedReason.d.ts +7 -0
  24. package/Types/CodeInSentence.d.mts +8 -0
  25. package/Types/CodeInSentence.d.ts +8 -0
  26. package/Types/CodeInSentence.js +875 -0
  27. package/Types/CodeInSentence.mjs +4 -0
  28. package/Types/Dashboard/DashboardComponentType.d.mts +2 -0
  29. package/Types/Dashboard/DashboardComponentType.d.ts +2 -0
  30. package/Types/Dashboard/DashboardComponentType.js +7 -0
  31. package/Types/Dashboard/DashboardComponents/ComponentArgument.d.mts +3 -1
  32. package/Types/Dashboard/DashboardComponents/ComponentArgument.d.ts +3 -1
  33. package/Types/Dashboard/DashboardComponents/ComponentArgument.js +3 -0
  34. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.d.mts +11 -0
  35. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.d.ts +11 -0
  36. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.js +2 -0
  37. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.mjs +1 -0
  38. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.d.mts +11 -0
  39. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.d.ts +11 -0
  40. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.js +2 -0
  41. package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.mjs +1 -0
  42. package/Types/Dashboard/PublicDashboardServedSettings.js +15 -7
  43. package/Types/DataObservability/DataBiRefreshAlert.d.mts +44 -0
  44. package/Types/DataObservability/DataBiRefreshAlert.d.ts +44 -0
  45. package/Types/DataObservability/DataBiRefreshAlert.js +206 -0
  46. package/Types/DataObservability/DataBiRefreshAlert.mjs +12 -0
  47. package/Types/DataObservability/DataObservabilityApiTypes.d.mts +7 -0
  48. package/Types/DataObservability/DataObservabilityApiTypes.d.ts +7 -0
  49. package/Types/DataObservability/DataObservabilityApiTypes.js +12 -0
  50. package/Types/DataObservability/DataTableLineage.d.mts +22 -1
  51. package/Types/DataObservability/DataTableLineage.d.ts +22 -1
  52. package/Types/DataObservability/DataTableLineage.js +13 -5
  53. package/Types/DataObservability/DataTableLineage.mjs +2 -0
  54. package/Types/HashedString.js +9 -2
  55. package/Types/Monitor/CriteriaFilterValues.d.mts +16 -0
  56. package/Types/Monitor/CriteriaFilterValues.d.ts +16 -0
  57. package/Types/Monitor/CriteriaFilterValues.js +324 -0
  58. package/Types/Monitor/CriteriaFilterValues.mjs +2 -0
  59. package/Types/Monitor/DataBiRefreshMonitorStep.d.mts +13 -0
  60. package/Types/Monitor/DataBiRefreshMonitorStep.d.ts +13 -0
  61. package/Types/Monitor/DataBiRefreshMonitorStep.js +108 -0
  62. package/Types/Monitor/DataBiRefreshMonitorStep.mjs +3 -0
  63. package/Types/Monitor/IncomingEmailMonitor/IncomingEmailMonitorRequest.d.mts +1 -0
  64. package/Types/Monitor/IncomingEmailMonitor/IncomingEmailMonitorRequest.d.ts +1 -0
  65. package/Types/Monitor/MonitorCriteriaInstance.js +22 -2
  66. package/Types/Monitor/MonitorStep.js +28 -11
  67. package/Types/Monitor/MonitorStepMetricMonitor.js +6 -1
  68. package/Types/Monitor/MonitorStepRollingTime.d.mts +12 -0
  69. package/Types/Monitor/MonitorStepRollingTime.d.ts +12 -0
  70. package/Types/Monitor/MonitorStepRollingTime.js +117 -0
  71. package/Types/Monitor/MonitorStepRollingTime.mjs +2 -0
  72. package/Types/Monitor/SeriesContext/SeriesLabelDisplay.js +11 -0
  73. package/Types/Monitor/ServerMonitor/ServerMonitorResponse.d.mts +1 -0
  74. package/Types/Monitor/ServerMonitor/ServerMonitorResponse.d.ts +1 -0
  75. package/Types/Monitor/TelemetryAlertRule.js +7 -2
  76. package/Types/NotificationRule/NotificationRepeat.d.mts +10 -0
  77. package/Types/NotificationRule/NotificationRepeat.d.ts +10 -0
  78. package/Types/NotificationRule/NotificationRepeat.js +51 -0
  79. package/Types/NotificationRule/NotificationRepeat.mjs +2 -0
  80. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +70 -0
  81. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +70 -0
  82. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +276 -0
  83. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +12 -0
  84. package/Types/OnCallDutyPolicy/OnCallEscalationWait.d.mts +9 -0
  85. package/Types/OnCallDutyPolicy/OnCallEscalationWait.d.ts +9 -0
  86. package/Types/OnCallDutyPolicy/OnCallEscalationWait.js +44 -0
  87. package/Types/OnCallDutyPolicy/OnCallEscalationWait.mjs +5 -0
  88. package/Types/Probe/ProbeMonitorResponse.d.mts +1 -0
  89. package/Types/Probe/ProbeMonitorResponse.d.ts +1 -0
  90. package/Types/ReadingDirection.d.mts +2 -0
  91. package/Types/ReadingDirection.d.ts +2 -0
  92. package/Types/ReadingDirection.js +221 -25
  93. package/Types/ReadingDirection.mjs +2 -0
  94. package/Types/RollingTime/RollingTimeUtil.d.mts +7 -0
  95. package/Types/RollingTime/RollingTimeUtil.d.ts +7 -0
  96. package/Types/RollingTime/RollingTimeUtil.js +240 -71
  97. package/Types/Rum/ProductAnalyticsSavedViews.d.mts +56 -0
  98. package/Types/Rum/ProductAnalyticsSavedViews.d.ts +56 -0
  99. package/Types/Rum/ProductAnalyticsSavedViews.js +219 -0
  100. package/Types/Rum/ProductAnalyticsSavedViews.mjs +14 -0
  101. package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +8 -7
  102. package/Types/Telemetry/ServiceType.d.mts +1 -0
  103. package/Types/Telemetry/ServiceType.d.ts +1 -0
  104. package/Types/Telemetry/ServiceType.js +6 -0
  105. package/Utils/Crypto.js +10 -3
  106. package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.d.mts +7 -0
  107. package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.d.ts +7 -0
  108. package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.js +67 -0
  109. package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.mjs +2 -0
  110. package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.d.mts +7 -0
  111. package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.d.ts +7 -0
  112. package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.js +68 -0
  113. package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.mjs +2 -0
  114. package/Utils/Dashboard/DashboardWidgetIds.js +6 -1
  115. package/Utils/Metrics/MetricQueryCloudAggregation.js +2 -4
  116. package/Utils/Monitor/MonitorRootCauseWording.js +28 -24
  117. package/Utils/Monitor/MonitorStepMetricQueries.js +2 -1
  118. package/Utils/Monitor/MonitorStepsValuesUtil.d.mts +13 -0
  119. package/Utils/Monitor/MonitorStepsValuesUtil.d.ts +13 -0
  120. package/Utils/Monitor/MonitorStepsValuesUtil.js +80 -0
  121. package/Utils/Monitor/MonitorStepsValuesUtil.mjs +2 -0
  122. package/Utils/Slo/SloProjection.d.mts +18 -0
  123. package/Utils/Slo/SloProjection.d.ts +18 -0
  124. package/Utils/Slo/SloProjection.js +53 -12
  125. package/Utils/Slo/SloProjection.mjs +2 -0
  126. package/Utils/StatusPage/ResourceExplorer.d.mts +0 -10
  127. package/Utils/StatusPage/ResourceExplorer.d.ts +0 -10
  128. package/Utils/StatusPage/ResourceExplorer.js +0 -28
  129. package/package.json +1 -1
@@ -10,7 +10,6 @@ const CloudPlatform_1 = require("../../Types/Cloud/CloudPlatform");
10
10
  const CloudMonitoredResource_1 = require("../../Types/Cloud/CloudMonitoredResource");
11
11
  const CloudResourceCatalog_1 = require("../../Types/Cloud/CloudResourceCatalog");
12
12
  const CloudResourceMetricAggregation_1 = require("../../Types/Cloud/CloudResourceMetricAggregation");
13
- const RollingTime_1 = __importDefault(require("../../Types/RollingTime/RollingTime"));
14
13
  const RollingTimeUtil_1 = __importDefault(require("../../Types/RollingTime/RollingTimeUtil"));
15
14
  function asRecord(value) {
16
15
  return value && typeof value === "object" && !Array.isArray(value)
@@ -112,9 +111,8 @@ class MetricQueryCloudAggregation {
112
111
  if ((record === null || record === void 0 ? void 0 : record["aggregatesWholeWindow"]) === true) {
113
112
  return AggregationInterval_1.default.Total;
114
113
  }
115
- const rollingTime = Object.values(RollingTime_1.default).includes(record === null || record === void 0 ? void 0 : record["rollingTime"])
116
- ? record["rollingTime"]
117
- : RollingTime_1.default.Past1Minute;
114
+ // Written another way ("15 minutes") or not at all, as the worker reads it.
115
+ const rollingTime = RollingTimeUtil_1.default.fromValueOrDefault(record === null || record === void 0 ? void 0 : record["rollingTime"]);
118
116
  const window = RollingTimeUtil_1.default.convertToStartAndEndDate(rollingTime, new Date(0));
119
117
  return MetricQueryCloudAggregation.getRangeReadInterval({
120
118
  startDate: window.startValue,
@@ -63,6 +63,9 @@ const Translator_1 = require("../../Types/Translator");
63
63
  *
64
64
  * Line by line, and only a whole line, or a label at a line's start, is
65
65
  * ever replaced: nothing else in the text is read as one of OneUptime's.
66
+ * A line that is replaced is written with mdText, as the engine wrote it:
67
+ * OneUptime's words placed as text, the rest of the line as it was stored
68
+ * (FeedAndChatPlainTextEscapedGuard holds the file to it).
66
69
  */
67
70
  // A section heading or a label OneUptime writes in bold, at a line's start.
68
71
  const BOLD_LABELS = [
@@ -133,12 +136,13 @@ const FILTER_CONDITIONS_MET = "Filter Conditions Met";
133
136
  const BOLD_LABEL_LINE = /^\*\*([^*\n]{1,80})\*\*(:?)(.*)$/;
134
137
  // "- Label: value", with a label of letters and spaces.
135
138
  const FACT_LINE = /^- ([A-Z][A-Za-z ]{0,40}): (.*)$/;
139
+ // A finding as an Any criteria's root cause writes it after its label.
136
140
  const asMarkdownText = (text) => {
137
- return (0, FeedMarkdown_1.mdText) `${text}`.toString();
141
+ return (0, FeedMarkdown_1.mdText) `${text}`;
138
142
  };
139
- // A finding as an All criteria's list has it ("\n- finding"), without the "- ".
140
- const asListItemText = (text) => {
141
- return (0, FeedMarkdown_1.mdText) `\n- ${text}`.toString().replace(/^\n- /, "");
143
+ // A finding's whole line in an All criteria's list: "- finding".
144
+ const asListItem = (text) => {
145
+ return (0, FeedMarkdown_1.mdText) `- ${text}`;
142
146
  };
143
147
  class MonitorRootCauseWording {
144
148
  static wordRootCause(data) {
@@ -151,20 +155,19 @@ class MonitorRootCauseWording {
151
155
  translator: translator,
152
156
  options: data.options,
153
157
  });
154
- // The finding the root cause has at a place, escaped as it is there.
155
- const findingAt = (text, escape) => {
158
+ /*
159
+ * The worded finding the text is, written as `write` writes it: the
160
+ * text is a finding when the English finding, written the same way, is
161
+ * the text.
162
+ */
163
+ const findingAt = (text, write) => {
156
164
  for (const finding of findings) {
157
- if (escape(finding.english) === text) {
158
- return finding;
165
+ if (write(finding.english).toString() === text) {
166
+ return write(finding.worded);
159
167
  }
160
168
  }
161
169
  return null;
162
170
  };
163
- /*
164
- * Each line OneUptime wrote is written again with mdText: its words, a
165
- * label or a finding, as text, and what the root cause has after them as
166
- * the Markdown it already is.
167
- */
168
171
  return data.rootCause
169
172
  .split("\n")
170
173
  .map((line) => {
@@ -172,6 +175,7 @@ class MonitorRootCauseWording {
172
175
  if (boldLabel && BOLD_LABEL_SET.has(boldLabel[1])) {
173
176
  const label = boldLabel[1];
174
177
  const stored = boldLabel[3] || "";
178
+ // What follows the label: as stored, unless this language words it.
175
179
  let rest = FeedMarkdown_1.default.asMarkdown(stored);
176
180
  // "**Filter Conditions Met**: <the finding, or All filters met.>"
177
181
  if (label === FILTER_CONDITIONS_MET && stored.startsWith(" ")) {
@@ -180,22 +184,22 @@ class MonitorRootCauseWording {
180
184
  rest = (0, FeedMarkdown_1.mdText) ` ${MonitorRootCauseWording.word(ALL_FILTERS_MET, translator)}`;
181
185
  }
182
186
  else {
183
- const finding = findingAt(said, asMarkdownText);
184
- if (finding !== null) {
185
- rest = (0, FeedMarkdown_1.mdText) ` ${finding.worded}`;
187
+ const worded = findingAt(said, asMarkdownText);
188
+ if (worded !== null) {
189
+ rest = (0, FeedMarkdown_1.mdText) ` ${worded}`;
186
190
  }
187
191
  }
188
192
  }
189
- const bold = MonitorRootCauseWording.boldLabel(label, translator);
190
- return (boldLabel[2] === ":"
191
- ? (0, FeedMarkdown_1.mdText) `${bold}:${rest}`
192
- : (0, FeedMarkdown_1.mdText) `${bold}${rest}`).toString();
193
+ const wordedLabel = MonitorRootCauseWording.boldLabel(label, translator);
194
+ return (boldLabel[2]
195
+ ? (0, FeedMarkdown_1.mdText) `${wordedLabel}:${rest}`
196
+ : (0, FeedMarkdown_1.mdText) `${wordedLabel}${rest}`).toString();
193
197
  }
194
198
  const fact = FACT_LINE.exec(line);
195
199
  if (fact && FACT_LABEL_SET.has(fact[1])) {
196
200
  const label = fact[1];
197
201
  const stored = fact[2] || "";
198
- // OneUptime's own yes or no is a word; any other value is as stored.
202
+ // OneUptime's own yes or no is worded; any other value is as stored.
199
203
  const value = YES_NO_FACTS.has(label) && (stored === "Yes" || stored === "No")
200
204
  ? MonitorRootCauseWording.word(stored, translator)
201
205
  : FeedMarkdown_1.default.asMarkdown(stored);
@@ -203,9 +207,9 @@ class MonitorRootCauseWording {
203
207
  }
204
208
  // "- <a finding>", under All filters met.
205
209
  if (line.startsWith("- ")) {
206
- const finding = findingAt(line.slice(2), asListItemText);
207
- if (finding !== null) {
208
- return (0, FeedMarkdown_1.mdText) `- ${finding.worded}`.toString();
210
+ const worded = findingAt(line, asListItem);
211
+ if (worded !== null) {
212
+ return worded.toString();
209
213
  }
210
214
  }
211
215
  return line;
@@ -571,7 +571,8 @@ class MonitorStepMetricQueries {
571
571
  formulaConfigs: metricViewConfig.formulaConfigs.filter((formulaConfig) => {
572
572
  return Boolean(formulaConfig && typeof formulaConfig === "object");
573
573
  }),
574
- rollingTime: settings.rollingTime || RollingTime_1.default.Past1Minute,
574
+ // Written another way ("15 minutes") or not at all, as the worker reads it.
575
+ rollingTime: RollingTimeUtil_1.default.fromValueOrDefault(settings.rollingTime),
575
576
  aggregatesWholeWindow: MonitorStepMetricMonitor_1.MonitorStepMetricMonitorUtil.aggregatesWholeWindow(metricMonitor),
576
577
  telemetryServiceIds: MonitorStepMetricQueries.getReadServiceIds({
577
578
  monitorType: input.monitorType,
@@ -0,0 +1,13 @@
1
+ import { JSONObject } from "../../Types/JSON.mjs";
2
+ import MonitorSteps from "../../Types/Monitor/MonitorSteps.mjs";
3
+ import MonitorType from "../../Types/Monitor/MonitorType.mjs";
4
+ export default class MonitorStepsValuesUtil {
5
+ static getUnreadableValueError(data: {
6
+ monitorType: MonitorType | undefined | null;
7
+ monitorSteps: MonitorSteps | JSONObject | null | undefined;
8
+ }): string | null;
9
+ static assertValuesReadable(data: {
10
+ monitorType: MonitorType | undefined | null;
11
+ monitorSteps: MonitorSteps | JSONObject | null | undefined;
12
+ }): void;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { JSONObject } from "../../Types/JSON";
2
+ import MonitorSteps from "../../Types/Monitor/MonitorSteps";
3
+ import MonitorType from "../../Types/Monitor/MonitorType";
4
+ export default class MonitorStepsValuesUtil {
5
+ static getUnreadableValueError(data: {
6
+ monitorType: MonitorType | undefined | null;
7
+ monitorSteps: MonitorSteps | JSONObject | null | undefined;
8
+ }): string | null;
9
+ static assertValuesReadable(data: {
10
+ monitorType: MonitorType | undefined | null;
11
+ monitorSteps: MonitorSteps | JSONObject | null | undefined;
12
+ }): void;
13
+ }
@@ -0,0 +1,80 @@
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
+ const BadDataException_1 = __importDefault(require("../../Types/Exception/BadDataException"));
7
+ const CriteriaFilterValues_1 = __importDefault(require("../../Types/Monitor/CriteriaFilterValues"));
8
+ const MonitorStepRollingTime_1 = __importDefault(require("../../Types/Monitor/MonitorStepRollingTime"));
9
+ const MonitorSteps_1 = __importDefault(require("../../Types/Monitor/MonitorSteps"));
10
+ /*
11
+ * A monitor's (or template's) steps written with a value its checks cannot
12
+ * read are refused, whoever writes them: the API, a workflow, or an AI
13
+ * through the MCP server (the Terraform provider takes only the values
14
+ * OneUptime writes for a criteria, but not for a rolling time).
15
+ *
16
+ * A Metrics monitor an AI created through the MCP server was stored with
17
+ * its rolling time as "15 minutes" and its conditions as "GreaterThan" and
18
+ * "LessThanOrEqual". Every check read a window of no length, found no
19
+ * data, and its no-data rule opened an alert on every run - and its
20
+ * conditions, matching nothing, could never have fired on a value.
21
+ *
22
+ * A value written another way that means one ("15 minutes", "PT15M",
23
+ * "GreaterThan", ">") is not refused: reading the steps
24
+ * (MonitorStep.fromJSON, MonitorCriteriaInstance.fromJSON) stores it as
25
+ * the one it means. One that means none is refused, with the values it
26
+ * can take (MonitorStepRollingTime, CriteriaFilterValues).
27
+ */
28
+ class MonitorStepsValuesUtil {
29
+ /*
30
+ * Why these steps cannot be read - the first value, step by step, that
31
+ * means none of the values its field takes - or null when every one can.
32
+ * A rolling time is read only under the monitor's own type: it is the
33
+ * one its checks use. Steps that cannot be read at all say nothing here:
34
+ * their shape is refused where they are parsed.
35
+ */
36
+ static getUnreadableValueError(data) {
37
+ var _a, _b, _c, _d, _e, _f, _g;
38
+ if (!data.monitorSteps) {
39
+ return null;
40
+ }
41
+ let steps = [];
42
+ try {
43
+ steps =
44
+ ((_a = MonitorSteps_1.default.fromJSON(data.monitorSteps)
45
+ .data) === null || _a === void 0 ? void 0 : _a.monitorStepsInstanceArray) || [];
46
+ }
47
+ catch (_h) {
48
+ return null;
49
+ }
50
+ for (const step of steps) {
51
+ const rollingTimeError = MonitorStepRollingTime_1.default.getUnreadableError({
52
+ monitorType: data.monitorType,
53
+ stepData: step === null || step === void 0 ? void 0 : step.data,
54
+ });
55
+ if (rollingTimeError) {
56
+ return rollingTimeError;
57
+ }
58
+ const criteriaInstances = ((_d = (_c = (_b = step === null || step === void 0 ? void 0 : step.data) === null || _b === void 0 ? void 0 : _b.monitorCriteria) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.monitorCriteriaInstanceArray) || [];
59
+ for (const criteriaInstance of criteriaInstances) {
60
+ const errors = CriteriaFilterValues_1.default.getUnreadableErrors({
61
+ criteriaName: ((_e = criteriaInstance === null || criteriaInstance === void 0 ? void 0 : criteriaInstance.data) === null || _e === void 0 ? void 0 : _e.name) || "",
62
+ filterCondition: (_f = criteriaInstance === null || criteriaInstance === void 0 ? void 0 : criteriaInstance.data) === null || _f === void 0 ? void 0 : _f.filterCondition,
63
+ filters: (_g = criteriaInstance === null || criteriaInstance === void 0 ? void 0 : criteriaInstance.data) === null || _g === void 0 ? void 0 : _g.filters,
64
+ });
65
+ if (errors.length > 0) {
66
+ return errors[0];
67
+ }
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ // Refuses steps written with a value their checks cannot read (above).
73
+ static assertValuesReadable(data) {
74
+ const error = MonitorStepsValuesUtil.getUnreadableValueError(data);
75
+ if (error) {
76
+ throw new BadDataException_1.default(error);
77
+ }
78
+ }
79
+ }
80
+ exports.default = MonitorStepsValuesUtil;
@@ -0,0 +1,2 @@
1
+ import commonJsModule from "./MonitorStepsValuesUtil.js";
2
+ export default commonJsModule.default;
@@ -168,6 +168,24 @@ export declare const isSliBelowTarget: IsSliBelowTargetFunction;
168
168
  * because the tile colours the SLI red on the unrounded comparison and the
169
169
  * words must not contradict the colour.
170
170
  */
171
+ export declare enum SliDeltaSide {
172
+ JustBelow = "JustBelow",
173
+ JustAbove = "JustAbove",
174
+ OnTarget = "OnTarget",
175
+ Above = "Above",
176
+ Below = "Below"
177
+ }
178
+ export interface SliDelta {
179
+ side: SliDeltaSide;
180
+ percentagePoints: number;
181
+ targetText: string;
182
+ }
183
+ /**
184
+ * The parts getSliDeltaText words, for a caller that words them in another
185
+ * language. Null when either number is unknown.
186
+ */
187
+ export type GetSliDeltaFunction = (data: SliVersusTargetData) => SliDelta | null;
188
+ export declare const getSliDelta: GetSliDeltaFunction;
171
189
  export type GetSliDeltaTextFunction = (data: SliVersusTargetData) => string | null;
172
190
  export declare const getSliDeltaText: GetSliDeltaTextFunction;
173
191
  /**
@@ -168,6 +168,24 @@ export declare const isSliBelowTarget: IsSliBelowTargetFunction;
168
168
  * because the tile colours the SLI red on the unrounded comparison and the
169
169
  * words must not contradict the colour.
170
170
  */
171
+ export declare enum SliDeltaSide {
172
+ JustBelow = "JustBelow",
173
+ JustAbove = "JustAbove",
174
+ OnTarget = "OnTarget",
175
+ Above = "Above",
176
+ Below = "Below"
177
+ }
178
+ export interface SliDelta {
179
+ side: SliDeltaSide;
180
+ percentagePoints: number;
181
+ targetText: string;
182
+ }
183
+ /**
184
+ * The parts getSliDeltaText words, for a caller that words them in another
185
+ * language. Null when either number is unknown.
186
+ */
187
+ export type GetSliDeltaFunction = (data: SliVersusTargetData) => SliDelta | null;
188
+ export declare const getSliDelta: GetSliDeltaFunction;
171
189
  export type GetSliDeltaTextFunction = (data: SliVersusTargetData) => string | null;
172
190
  export declare const getSliDeltaText: GetSliDeltaTextFunction;
173
191
  /**
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSloChartBucketSeconds = exports.getSloIdealBurnPoints = exports.getSloComplianceWindowRange = exports.getSloAllowedDowntime = exports.isBurnRateAtOrAboveThreshold = exports.getLowestBurnRateThreshold = exports.getSliDeltaText = exports.isSliBelowTarget = exports.getSliDeltaPercentagePoints = exports.getSloBudgetBarGeometry = exports.getSloBudgetRunway = exports.SloProjectionTone = exports.SloBudgetRunwayKind = exports.getRollingWindowFill = exports.getRollingWindowFillFraction = void 0;
6
+ exports.getSloChartBucketSeconds = exports.getSloIdealBurnPoints = exports.getSloComplianceWindowRange = exports.getSloAllowedDowntime = exports.isBurnRateAtOrAboveThreshold = exports.getLowestBurnRateThreshold = exports.getSliDeltaText = exports.getSliDelta = exports.SliDeltaSide = exports.isSliBelowTarget = exports.getSliDeltaPercentagePoints = exports.getSloBudgetBarGeometry = exports.getSloBudgetRunway = exports.SloProjectionTone = exports.SloBudgetRunwayKind = exports.getRollingWindowFill = exports.getRollingWindowFillFraction = void 0;
7
7
  const AggregationInterval_1 = __importDefault(require("../../Types/BaseDatabase/AggregationInterval"));
8
8
  const SloMultiMonitorMode_1 = __importDefault(require("../../Types/ServiceLevelObjective/SloMultiMonitorMode"));
9
9
  const SloWindowType_1 = __importDefault(require("../../Types/ServiceLevelObjective/SloWindowType"));
@@ -320,7 +320,27 @@ const isSliBelowTarget = (data) => {
320
320
  return sli !== null && target !== null && sli < target;
321
321
  };
322
322
  exports.isSliBelowTarget = isSliBelowTarget;
323
- const getSliDeltaText = (data) => {
323
+ /**
324
+ * "0.042 pp above the 99.9% target" — how far the SLI sits from its target,
325
+ * in percentage points, which is how the gap is discussed ("we are 4 basis
326
+ * points under"). Returns null when either number is unknown so the caller
327
+ * phrases "not evaluated" in its own context.
328
+ *
329
+ * A gap that rounds to zero still says which side it is on ("Just below"),
330
+ * because the tile colours the SLI red on the unrounded comparison and the
331
+ * words must not contradict the colour.
332
+ */
333
+ var SliDeltaSide;
334
+ (function (SliDeltaSide) {
335
+ // Rounds to zero, SLI below the target.
336
+ SliDeltaSide["JustBelow"] = "JustBelow";
337
+ // Rounds to zero, SLI above the target.
338
+ SliDeltaSide["JustAbove"] = "JustAbove";
339
+ SliDeltaSide["OnTarget"] = "OnTarget";
340
+ SliDeltaSide["Above"] = "Above";
341
+ SliDeltaSide["Below"] = "Below";
342
+ })(SliDeltaSide || (exports.SliDeltaSide = SliDeltaSide = {}));
343
+ const getSliDelta = (data) => {
324
344
  const delta = (0, exports.getSliDeltaPercentagePoints)(data);
325
345
  if (delta === null) {
326
346
  return null;
@@ -328,19 +348,40 @@ const getSliDeltaText = (data) => {
328
348
  const sli = data.currentSliPercentage;
329
349
  const target = data.targetPercentage;
330
350
  const targetText = `${roundToDecimals(target, SLI_DELTA_DECIMALS)}%`;
351
+ let side = delta > 0 ? SliDeltaSide.Above : SliDeltaSide.Below;
331
352
  if (delta === 0) {
332
- if (sli < target) {
333
- return `Just below the ${targetText} target`;
334
- }
335
- if (sli > target) {
336
- return `Just above the ${targetText} target`;
337
- }
338
- return `Exactly on the ${targetText} target`;
353
+ side =
354
+ sli < target
355
+ ? SliDeltaSide.JustBelow
356
+ : sli > target
357
+ ? SliDeltaSide.JustAbove
358
+ : SliDeltaSide.OnTarget;
359
+ }
360
+ return {
361
+ side: side,
362
+ percentagePoints: Math.abs(delta),
363
+ targetText: targetText,
364
+ };
365
+ };
366
+ exports.getSliDelta = getSliDelta;
367
+ const getSliDeltaText = (data) => {
368
+ const delta = (0, exports.getSliDelta)(data);
369
+ if (delta === null) {
370
+ return null;
339
371
  }
340
- if (delta > 0) {
341
- return `${delta} pp above the ${targetText} target`;
372
+ switch (delta.side) {
373
+ case SliDeltaSide.JustBelow:
374
+ return `Just below the ${delta.targetText} target`;
375
+ case SliDeltaSide.JustAbove:
376
+ return `Just above the ${delta.targetText} target`;
377
+ case SliDeltaSide.OnTarget:
378
+ return `Exactly on the ${delta.targetText} target`;
379
+ case SliDeltaSide.Above:
380
+ return `${delta.percentagePoints} pp above the ${delta.targetText} target`;
381
+ case SliDeltaSide.Below:
382
+ default:
383
+ return `${delta.percentagePoints} pp below the ${delta.targetText} target`;
342
384
  }
343
- return `${Math.abs(delta)} pp below the ${targetText} target`;
344
385
  };
345
386
  exports.getSliDeltaText = getSliDeltaText;
346
387
  const getLowestBurnRateThreshold = (thresholds) => {
@@ -1,9 +1,11 @@
1
1
  import commonJsModule from "./SloProjection.js";
2
+ export const SliDeltaSide = commonJsModule.SliDeltaSide;
2
3
  export const SloBudgetRunwayKind = commonJsModule.SloBudgetRunwayKind;
3
4
  export const SloProjectionTone = commonJsModule.SloProjectionTone;
4
5
  export const getLowestBurnRateThreshold = commonJsModule.getLowestBurnRateThreshold;
5
6
  export const getRollingWindowFill = commonJsModule.getRollingWindowFill;
6
7
  export const getRollingWindowFillFraction = commonJsModule.getRollingWindowFillFraction;
8
+ export const getSliDelta = commonJsModule.getSliDelta;
7
9
  export const getSliDeltaPercentagePoints = commonJsModule.getSliDeltaPercentagePoints;
8
10
  export const getSliDeltaText = commonJsModule.getSliDeltaText;
9
11
  export const getSloAllowedDowntime = commonJsModule.getSloAllowedDowntime;
@@ -155,18 +155,8 @@ export default class StatusPageResourceExplorerUtil {
155
155
  rowValues: Array<string>;
156
156
  columnValues: Array<string>;
157
157
  }): StatusPageResourceGridModel;
158
- static getResourceCountLabel(data: {
159
- count: number;
160
- }): string;
161
158
  static getNavigatorCountLabel(data: {
162
159
  row: StatusPageResourceNavigatorRow;
163
160
  countIndex: StatusPageResourceCountIndex;
164
161
  }): string | null;
165
- static getNavigatorCountTooltip(data: {
166
- row: StatusPageResourceNavigatorRow;
167
- countIndex: StatusPageResourceCountIndex;
168
- }): string | undefined;
169
- static getSubGroupCountLabel(data: {
170
- subGroupCount: number;
171
- }): string | null;
172
162
  }
@@ -155,18 +155,8 @@ export default class StatusPageResourceExplorerUtil {
155
155
  rowValues: Array<string>;
156
156
  columnValues: Array<string>;
157
157
  }): StatusPageResourceGridModel;
158
- static getResourceCountLabel(data: {
159
- count: number;
160
- }): string;
161
158
  static getNavigatorCountLabel(data: {
162
159
  row: StatusPageResourceNavigatorRow;
163
160
  countIndex: StatusPageResourceCountIndex;
164
161
  }): string | null;
165
- static getNavigatorCountTooltip(data: {
166
- row: StatusPageResourceNavigatorRow;
167
- countIndex: StatusPageResourceCountIndex;
168
- }): string | undefined;
169
- static getSubGroupCountLabel(data: {
170
- subGroupCount: number;
171
- }): string | null;
172
162
  }
@@ -623,15 +623,6 @@ class StatusPageResourceExplorerUtil {
623
623
  /* ------------------------------------------------------------------ */
624
624
  /* Labels */
625
625
  /* ------------------------------------------------------------------ */
626
- /*
627
- * "12 resources", or "1 resource".
628
- */
629
- static getResourceCountLabel(data) {
630
- if (data.count === 1) {
631
- return "1 resource";
632
- }
633
- return `${data.count.toLocaleString("en-US")} resources`;
634
- }
635
626
  /*
636
627
  * What a navigator row's count badge says, which is not always the same
637
628
  * number as the pane it opens.
@@ -652,25 +643,6 @@ class StatusPageResourceExplorerUtil {
652
643
  }
653
644
  return data.row.ownResourceCount.toLocaleString((0, DateLanguage_1.getReaderNumberLocale)());
654
645
  }
655
- static getNavigatorCountTooltip(data) {
656
- if (!data.countIndex.isComplete) {
657
- return undefined;
658
- }
659
- const own = `${data.row.ownResourceCount.toLocaleString("en-US")} ${data.row.ownResourceCount === 1 ? "resource" : "resources"} in this group`;
660
- if (data.row.subtreeResourceCount === data.row.ownResourceCount) {
661
- return own;
662
- }
663
- return `${own} · ${data.row.subtreeResourceCount.toLocaleString("en-US")} including sub groups`;
664
- }
665
- static getSubGroupCountLabel(data) {
666
- if (data.subGroupCount <= 0) {
667
- return null;
668
- }
669
- if (data.subGroupCount === 1) {
670
- return "1 sub group";
671
- }
672
- return `${data.subGroupCount.toLocaleString("en-US")} sub groups`;
673
- }
674
646
  }
675
647
  /*
676
648
  * How many navigator rows are drawn before the list stops and offers to draw
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneuptime/common",
3
- "version": "14.0.107",
3
+ "version": "14.0.108",
4
4
  "description": "OneUptime's shared types, utilities and data models, for Node.js and TypeScript.",
5
5
  "homepage": "https://oneuptime.com",
6
6
  "repository": {