@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.
- package/Models/DatabaseModels/DataBiConnection.d.mts +4 -0
- package/Models/DatabaseModels/DataBiConnection.d.ts +4 -0
- package/Models/DatabaseModels/DataBiConnection.js +59 -2
- package/Models/DatabaseModels/Index.js +2 -0
- package/Models/DatabaseModels/RumProductAnalyticsSavedView.d.mts +20 -0
- package/Models/DatabaseModels/RumProductAnalyticsSavedView.d.ts +20 -0
- package/Models/DatabaseModels/RumProductAnalyticsSavedView.js +353 -0
- package/Models/DatabaseModels/RumProductAnalyticsSavedView.mjs +2 -0
- package/Models/DatabaseModels/WhatsAppLog.d.mts +3 -0
- package/Models/DatabaseModels/WhatsAppLog.d.ts +3 -0
- package/Models/DatabaseModels/WhatsAppLog.js +62 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.mts +11 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.ts +11 -0
- package/Models/DatabaseModels/WorkspaceUserGroup.js +1 -1
- package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.mts +212 -0
- package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.ts +212 -0
- package/Server/Utils/Workspace/WorkspaceBase.d.mts +3 -0
- package/Server/Utils/Workspace/WorkspaceBase.d.ts +3 -0
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AIChatTypes.js +2 -0
- package/Types/AI/InvestigationNotStartedReason.d.mts +7 -0
- package/Types/AI/InvestigationNotStartedReason.d.ts +7 -0
- package/Types/CodeInSentence.d.mts +8 -0
- package/Types/CodeInSentence.d.ts +8 -0
- package/Types/CodeInSentence.js +875 -0
- package/Types/CodeInSentence.mjs +4 -0
- package/Types/Dashboard/DashboardComponentType.d.mts +2 -0
- package/Types/Dashboard/DashboardComponentType.d.ts +2 -0
- package/Types/Dashboard/DashboardComponentType.js +7 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.d.mts +3 -1
- package/Types/Dashboard/DashboardComponents/ComponentArgument.d.ts +3 -1
- package/Types/Dashboard/DashboardComponents/ComponentArgument.js +3 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.d.mts +11 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.d.ts +11 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.js +2 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsFunnelComponent.mjs +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.d.mts +11 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.d.ts +11 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.js +2 -0
- package/Types/Dashboard/DashboardComponents/DashboardProductAnalyticsRetentionComponent.mjs +1 -0
- package/Types/Dashboard/PublicDashboardServedSettings.js +15 -7
- package/Types/DataObservability/DataBiRefreshAlert.d.mts +44 -0
- package/Types/DataObservability/DataBiRefreshAlert.d.ts +44 -0
- package/Types/DataObservability/DataBiRefreshAlert.js +206 -0
- package/Types/DataObservability/DataBiRefreshAlert.mjs +12 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.mts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.ts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.js +12 -0
- package/Types/DataObservability/DataTableLineage.d.mts +22 -1
- package/Types/DataObservability/DataTableLineage.d.ts +22 -1
- package/Types/DataObservability/DataTableLineage.js +13 -5
- package/Types/DataObservability/DataTableLineage.mjs +2 -0
- package/Types/HashedString.js +9 -2
- package/Types/Monitor/CriteriaFilterValues.d.mts +16 -0
- package/Types/Monitor/CriteriaFilterValues.d.ts +16 -0
- package/Types/Monitor/CriteriaFilterValues.js +324 -0
- package/Types/Monitor/CriteriaFilterValues.mjs +2 -0
- package/Types/Monitor/DataBiRefreshMonitorStep.d.mts +13 -0
- package/Types/Monitor/DataBiRefreshMonitorStep.d.ts +13 -0
- package/Types/Monitor/DataBiRefreshMonitorStep.js +108 -0
- package/Types/Monitor/DataBiRefreshMonitorStep.mjs +3 -0
- package/Types/Monitor/IncomingEmailMonitor/IncomingEmailMonitorRequest.d.mts +1 -0
- package/Types/Monitor/IncomingEmailMonitor/IncomingEmailMonitorRequest.d.ts +1 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +22 -2
- package/Types/Monitor/MonitorStep.js +28 -11
- package/Types/Monitor/MonitorStepMetricMonitor.js +6 -1
- package/Types/Monitor/MonitorStepRollingTime.d.mts +12 -0
- package/Types/Monitor/MonitorStepRollingTime.d.ts +12 -0
- package/Types/Monitor/MonitorStepRollingTime.js +117 -0
- package/Types/Monitor/MonitorStepRollingTime.mjs +2 -0
- package/Types/Monitor/SeriesContext/SeriesLabelDisplay.js +11 -0
- package/Types/Monitor/ServerMonitor/ServerMonitorResponse.d.mts +1 -0
- package/Types/Monitor/ServerMonitor/ServerMonitorResponse.d.ts +1 -0
- package/Types/Monitor/TelemetryAlertRule.js +7 -2
- package/Types/NotificationRule/NotificationRepeat.d.mts +10 -0
- package/Types/NotificationRule/NotificationRepeat.d.ts +10 -0
- package/Types/NotificationRule/NotificationRepeat.js +51 -0
- package/Types/NotificationRule/NotificationRepeat.mjs +2 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +70 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +70 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +276 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +12 -0
- package/Types/OnCallDutyPolicy/OnCallEscalationWait.d.mts +9 -0
- package/Types/OnCallDutyPolicy/OnCallEscalationWait.d.ts +9 -0
- package/Types/OnCallDutyPolicy/OnCallEscalationWait.js +44 -0
- package/Types/OnCallDutyPolicy/OnCallEscalationWait.mjs +5 -0
- package/Types/Probe/ProbeMonitorResponse.d.mts +1 -0
- package/Types/Probe/ProbeMonitorResponse.d.ts +1 -0
- package/Types/ReadingDirection.d.mts +2 -0
- package/Types/ReadingDirection.d.ts +2 -0
- package/Types/ReadingDirection.js +221 -25
- package/Types/ReadingDirection.mjs +2 -0
- package/Types/RollingTime/RollingTimeUtil.d.mts +7 -0
- package/Types/RollingTime/RollingTimeUtil.d.ts +7 -0
- package/Types/RollingTime/RollingTimeUtil.js +240 -71
- package/Types/Rum/ProductAnalyticsSavedViews.d.mts +56 -0
- package/Types/Rum/ProductAnalyticsSavedViews.d.ts +56 -0
- package/Types/Rum/ProductAnalyticsSavedViews.js +219 -0
- package/Types/Rum/ProductAnalyticsSavedViews.mjs +14 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +8 -7
- package/Types/Telemetry/ServiceType.d.mts +1 -0
- package/Types/Telemetry/ServiceType.d.ts +1 -0
- package/Types/Telemetry/ServiceType.js +6 -0
- package/Utils/Crypto.js +10 -3
- package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.d.mts +7 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.d.ts +7 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.js +67 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsFunnelComponent.mjs +2 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.d.mts +7 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.d.ts +7 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.js +68 -0
- package/Utils/Dashboard/Components/DashboardProductAnalyticsRetentionComponent.mjs +2 -0
- package/Utils/Dashboard/DashboardWidgetIds.js +6 -1
- package/Utils/Metrics/MetricQueryCloudAggregation.js +2 -4
- package/Utils/Monitor/MonitorRootCauseWording.js +28 -24
- package/Utils/Monitor/MonitorStepMetricQueries.js +2 -1
- package/Utils/Monitor/MonitorStepsValuesUtil.d.mts +13 -0
- package/Utils/Monitor/MonitorStepsValuesUtil.d.ts +13 -0
- package/Utils/Monitor/MonitorStepsValuesUtil.js +80 -0
- package/Utils/Monitor/MonitorStepsValuesUtil.mjs +2 -0
- package/Utils/Slo/SloProjection.d.mts +18 -0
- package/Utils/Slo/SloProjection.d.ts +18 -0
- package/Utils/Slo/SloProjection.js +53 -12
- package/Utils/Slo/SloProjection.mjs +2 -0
- package/Utils/StatusPage/ResourceExplorer.d.mts +0 -10
- package/Utils/StatusPage/ResourceExplorer.d.ts +0 -10
- package/Utils/StatusPage/ResourceExplorer.js +0 -28
- package/package.json +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
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.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_SEEN_TITLE = exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_RESOLVED_TITLE = exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_ACKNOWLEDGED_TITLE = exports.OnCallAcknowledgePageState = void 0;
|
|
7
|
+
exports.isOnCallPageEndedOnlyByAnAnswer = isOnCallPageEndedOnlyByAnAnswer;
|
|
8
|
+
exports.getOnCallAcknowledgePageAnswer = getOnCallAcknowledgePageAnswer;
|
|
9
|
+
exports.isOnCallAcknowledgePageOpen = isOnCallAcknowledgePageOpen;
|
|
10
|
+
exports.getOnCallAcknowledgePagePersonName = getOnCallAcknowledgePagePersonName;
|
|
11
|
+
exports.getOnCallAcknowledgePageAnsweredHeading = getOnCallAcknowledgePageAnsweredHeading;
|
|
12
|
+
exports.getOnCallAcknowledgePageMoment = getOnCallAcknowledgePageMoment;
|
|
13
|
+
exports.getOnCallAcknowledgePageAnsweredSentence = getOnCallAcknowledgePageAnsweredSentence;
|
|
14
|
+
const Date_1 = __importDefault(require("../Date"));
|
|
15
|
+
const Timezone_1 = __importDefault(require("../Timezone"));
|
|
16
|
+
const OnCallAcknowledgementTimeout_1 = require("./OnCallAcknowledgementTimeout");
|
|
17
|
+
const OnCallObserverPage_1 = require("./OnCallObserverPage");
|
|
18
|
+
const OnCallPagePassOn_1 = require("./OnCallPagePassOn");
|
|
19
|
+
const OnCallPersonPage_1 = require("./OnCallPersonPage");
|
|
20
|
+
/*
|
|
21
|
+
* WHAT THE ACKNOWLEDGE PAGE A MESSAGE'S LINK OPENS OFFERS.
|
|
22
|
+
*
|
|
23
|
+
* Every message a page sends - a text, an email, WhatsApp, Telegram, a push,
|
|
24
|
+
* Slack, Microsoft Teams - links to one page about it (UserOnCallLogTimelineAPI's
|
|
25
|
+
* acknowledge-page): what the page is about, with Acknowledge. It asked
|
|
26
|
+
* "Do you want to acknowledge this incident?" whatever had happened since the
|
|
27
|
+
* message was sent, so somebody opening it after the incident was taken - by
|
|
28
|
+
* a colleague, by themselves from another message or the Dashboard, or moved
|
|
29
|
+
* on to a state after Acknowledged - was asked to acknowledge it again
|
|
30
|
+
* (https://github.com/OneUptime/oneuptime/issues/6706). Everywhere else,
|
|
31
|
+
* Acknowledge is offered only to a record that is not acknowledged yet
|
|
32
|
+
* (Common/Utils/AcknowledgedState).
|
|
33
|
+
*
|
|
34
|
+
* So the page offers Acknowledge only while the person's page still waits for
|
|
35
|
+
* an answer, by the rule the worker that sends the page's notifications ends
|
|
36
|
+
* it with (Workers/Jobs/UserOnCallLog/ExecutePendingExecutions):
|
|
37
|
+
*
|
|
38
|
+
* - a record that is resolved ends every page of it;
|
|
39
|
+
* - the person's own answer ends their page: this message's link, or any
|
|
40
|
+
* other way they answered the page - another message's link, a call's 1,
|
|
41
|
+
* a text, the app (the run then records them as who acknowledged it);
|
|
42
|
+
* - a responder's page is over once its record is acknowledged - by the
|
|
43
|
+
* one rule, so a state after Acknowledged counts - whoever did it;
|
|
44
|
+
* - a page again (OnCallAcknowledgementTimeout), a page a person asked for
|
|
45
|
+
* (OnCallPersonPage) and an observer's page (OnCallObserverPage) are
|
|
46
|
+
* about a record that is often acknowledged already, and go on until one
|
|
47
|
+
* of their people answers them: the record being acknowledged ends none
|
|
48
|
+
* of them.
|
|
49
|
+
*
|
|
50
|
+
* Once it is over, the page says so, with what it is about and the button
|
|
51
|
+
* that opens it in the Dashboard, and no Acknowledge - who took it, and when,
|
|
52
|
+
* as Slack and Microsoft Teams answer a press that came too late
|
|
53
|
+
* (https://github.com/OneUptime/oneuptime/issues/6711):
|
|
54
|
+
*
|
|
55
|
+
* Incident INC-42 was already acknowledged by Ana Lopez at 5:28 AM UTC.
|
|
56
|
+
*
|
|
57
|
+
* Who and when come from where the page was taken: for a responder's page,
|
|
58
|
+
* the record's own state timeline - its latest acknowledgement, or its latest
|
|
59
|
+
* resolve - whether that was a page's answer, the Dashboard, the app, Slack
|
|
60
|
+
* or a workflow; for the pages that go on until answered, the answer to the
|
|
61
|
+
* page, as the run records it. The person themselves is "you". The time is on
|
|
62
|
+
* the reader's own clock.
|
|
63
|
+
*
|
|
64
|
+
* Every read behind it is best effort: a fact that cannot be read leaves
|
|
65
|
+
* Acknowledge offered, as it always was - or, once the page is over, leaves
|
|
66
|
+
* out who or when - and the button that acknowledges checks again.
|
|
67
|
+
*/
|
|
68
|
+
var OnCallAcknowledgePageState;
|
|
69
|
+
(function (OnCallAcknowledgePageState) {
|
|
70
|
+
// The page still waits for an answer: Acknowledge is offered.
|
|
71
|
+
OnCallAcknowledgePageState["Open"] = "Open";
|
|
72
|
+
// The person answered their page already, here or another way.
|
|
73
|
+
OnCallAcknowledgePageState["AcknowledgedByYou"] = "AcknowledgedByYou";
|
|
74
|
+
/*
|
|
75
|
+
* Somebody else took it: answered the page (a page again, a person's
|
|
76
|
+
* page, an observer's page), or acknowledged the record (a responder's).
|
|
77
|
+
*/
|
|
78
|
+
OnCallAcknowledgePageState["AcknowledgedBySomeoneElse"] = "AcknowledgedBySomeoneElse";
|
|
79
|
+
// The record is resolved: every page of it is over.
|
|
80
|
+
OnCallAcknowledgePageState["Resolved"] = "Resolved";
|
|
81
|
+
})(OnCallAcknowledgePageState || (exports.OnCallAcknowledgePageState = OnCallAcknowledgePageState = {}));
|
|
82
|
+
/*
|
|
83
|
+
* Whether a run goes on until one of its people answers it, or its record is
|
|
84
|
+
* resolved - whoever acknowledges the record: a page again, a page a person
|
|
85
|
+
* asked for, an observer's page.
|
|
86
|
+
*/
|
|
87
|
+
function isOnCallPageEndedOnlyByAnAnswer(run) {
|
|
88
|
+
return ((0, OnCallAcknowledgementTimeout_1.isOnCallPageAgainRun)(run) ||
|
|
89
|
+
(0, OnCallPersonPage_1.isOnCallPersonPage)(run) ||
|
|
90
|
+
(0, OnCallObserverPage_1.isOnCallObserverPage)(run));
|
|
91
|
+
}
|
|
92
|
+
// What the acknowledge page offers, by the rule above.
|
|
93
|
+
function getOnCallAcknowledgePageAnswer(facts) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
const run = facts.run;
|
|
96
|
+
// The answer to the page, as the run records it.
|
|
97
|
+
const runAnswer = (run === null || run === void 0 ? void 0 : run.acknowledgedAt)
|
|
98
|
+
? {
|
|
99
|
+
byUserId: run.acknowledgedByUserId,
|
|
100
|
+
byName: getOnCallAcknowledgePagePersonName(run.acknowledgedByUser),
|
|
101
|
+
at: run.acknowledgedAt,
|
|
102
|
+
}
|
|
103
|
+
: undefined;
|
|
104
|
+
if ((_a = facts.record) === null || _a === void 0 ? void 0 : _a.isResolved) {
|
|
105
|
+
return takenBy(OnCallAcknowledgePageState.Resolved, facts.record.resolution, facts.personUserId);
|
|
106
|
+
}
|
|
107
|
+
if (facts.isMessageAcknowledged) {
|
|
108
|
+
return withTime({ state: OnCallAcknowledgePageState.AcknowledgedByYou }, facts.messageAcknowledgedAt);
|
|
109
|
+
}
|
|
110
|
+
if (runAnswer && isSamePerson(runAnswer.byUserId, facts.personUserId)) {
|
|
111
|
+
return withTime({ state: OnCallAcknowledgePageState.AcknowledgedByYou }, runAnswer.at);
|
|
112
|
+
}
|
|
113
|
+
// A page again, say, read as a responder's would lose its Acknowledge.
|
|
114
|
+
if (facts.isRunUnknown) {
|
|
115
|
+
return { state: OnCallAcknowledgePageState.Open };
|
|
116
|
+
}
|
|
117
|
+
// Taken only by an answer to the page, which the run records.
|
|
118
|
+
if (isOnCallPageEndedOnlyByAnAnswer(run)) {
|
|
119
|
+
return runAnswer
|
|
120
|
+
? takenBy(OnCallAcknowledgePageState.AcknowledgedBySomeoneElse, runAnswer, facts.personUserId)
|
|
121
|
+
: { state: OnCallAcknowledgePageState.Open };
|
|
122
|
+
}
|
|
123
|
+
if (!((_b = facts.record) === null || _b === void 0 ? void 0 : _b.isAcknowledged)) {
|
|
124
|
+
return { state: OnCallAcknowledgePageState.Open };
|
|
125
|
+
}
|
|
126
|
+
/*
|
|
127
|
+
* A responder's page, over with its record's acknowledgement: whoever
|
|
128
|
+
* acknowledged the record, by its state timeline - a page's answer, the
|
|
129
|
+
* Dashboard, the app, Slack alike - or the run's answer when the timeline
|
|
130
|
+
* does not say.
|
|
131
|
+
*/
|
|
132
|
+
return takenBy(OnCallAcknowledgePageState.AcknowledgedBySomeoneElse, facts.record.acknowledgement || runAnswer, facts.personUserId);
|
|
133
|
+
}
|
|
134
|
+
// Whether the page still offers Acknowledge.
|
|
135
|
+
function isOnCallAcknowledgePageOpen(answer) {
|
|
136
|
+
return answer.state === OnCallAcknowledgePageState.Open;
|
|
137
|
+
}
|
|
138
|
+
// A person as the page names them: their name, else their email, else nothing.
|
|
139
|
+
function getOnCallAcknowledgePagePersonName(user) {
|
|
140
|
+
const name = (user === null || user === void 0 ? void 0 : user.name) ? String(user.name).trim() : "";
|
|
141
|
+
if (name) {
|
|
142
|
+
return name;
|
|
143
|
+
}
|
|
144
|
+
return (user === null || user === void 0 ? void 0 : user.email) ? String(user.email).trim() : "";
|
|
145
|
+
}
|
|
146
|
+
/*
|
|
147
|
+
* The heading over a page that no longer offers Acknowledge: "Already
|
|
148
|
+
* acknowledged", "Already resolved" - or, for an observer, "Already marked as
|
|
149
|
+
* seen", since an observer's answer acknowledges nothing.
|
|
150
|
+
*/
|
|
151
|
+
function getOnCallAcknowledgePageAnsweredHeading(data) {
|
|
152
|
+
if (data.state === OnCallAcknowledgePageState.Resolved) {
|
|
153
|
+
return exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_RESOLVED_TITLE;
|
|
154
|
+
}
|
|
155
|
+
return data.isObserverPage
|
|
156
|
+
? exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_SEEN_TITLE
|
|
157
|
+
: exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_ACKNOWLEDGED_TITLE;
|
|
158
|
+
}
|
|
159
|
+
exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_ACKNOWLEDGED_TITLE = "Already acknowledged";
|
|
160
|
+
exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_RESOLVED_TITLE = "Already resolved";
|
|
161
|
+
exports.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_SEEN_TITLE = "Already marked as seen";
|
|
162
|
+
/*
|
|
163
|
+
* When it was taken, as the page says it, on the reader's own clock: "at
|
|
164
|
+
* 5:28 AM UTC" the same day, "on Oct 17, 2026, 12:10 AM UTC" another - the
|
|
165
|
+
* time the Escalate page words a time with (getOnCallPassOnTime), kept on one
|
|
166
|
+
* line of a phone. A zone OneUptime does not know reads as UTC: the page's
|
|
167
|
+
* whole purpose is to inform, and a wrong zone would say a wrong time.
|
|
168
|
+
*/
|
|
169
|
+
function getOnCallAcknowledgePageMoment(data) {
|
|
170
|
+
const timezone = toKnownTimezone(data.timezone);
|
|
171
|
+
const time = (0, OnCallPagePassOn_1.getOnCallPassOnTime)(data.at, {
|
|
172
|
+
timezone: timezone,
|
|
173
|
+
now: data.now,
|
|
174
|
+
});
|
|
175
|
+
const isToday = (0, OnCallPagePassOn_1.isOnCallPassOnTimeToday)({
|
|
176
|
+
at: data.at,
|
|
177
|
+
now: data.now,
|
|
178
|
+
timezone: timezone,
|
|
179
|
+
});
|
|
180
|
+
return `${isToday ? "at" : "on"} ${time
|
|
181
|
+
.split(" ")
|
|
182
|
+
.join(OnCallPagePassOn_1.ON_CALL_PASS_ON_NO_BREAK_SPACE)}`;
|
|
183
|
+
}
|
|
184
|
+
/*
|
|
185
|
+
* The sentence under that heading: who took it, and when, as far as it is
|
|
186
|
+
* known.
|
|
187
|
+
*
|
|
188
|
+
* Incident INC-42 was already acknowledged by Ana Lopez at 5:28 AM UTC.
|
|
189
|
+
* You already acknowledged Incident INC-42 at 5:28 AM UTC.
|
|
190
|
+
* Incident INC-42 was already resolved by Ana Lopez at 6:10 AM UTC.
|
|
191
|
+
* Incident INC-42 is already acknowledged.
|
|
192
|
+
*
|
|
193
|
+
* `recordLabel` names the record at the start of a sentence ("Incident
|
|
194
|
+
* INC-42", "This incident"), `recordLabelInSentence` inside one ("Incident
|
|
195
|
+
* INC-42", "this incident"). An observer's page is marked as seen, never
|
|
196
|
+
* acknowledged: what they answer is the page, not the record. Times are in
|
|
197
|
+
* `timezone`, the reader's own, and say their date on another day than
|
|
198
|
+
* `now`.
|
|
199
|
+
*/
|
|
200
|
+
function getOnCallAcknowledgePageAnsweredSentence(data) {
|
|
201
|
+
const label = data.recordLabel.trim() || "It";
|
|
202
|
+
const labelInSentence = data.recordLabelInSentence.trim() || "it";
|
|
203
|
+
const byWhom = (data.answer.byName || "").trim();
|
|
204
|
+
const when = data.answer.at
|
|
205
|
+
? ` ${getOnCallAcknowledgePageMoment({
|
|
206
|
+
at: data.answer.at,
|
|
207
|
+
timezone: data.timezone,
|
|
208
|
+
now: data.now,
|
|
209
|
+
})}`
|
|
210
|
+
: "";
|
|
211
|
+
switch (data.answer.state) {
|
|
212
|
+
case OnCallAcknowledgePageState.Resolved:
|
|
213
|
+
if (data.answer.isByYou) {
|
|
214
|
+
return `You already resolved ${labelInSentence}${when}.`;
|
|
215
|
+
}
|
|
216
|
+
if (byWhom) {
|
|
217
|
+
return `${label} was already resolved by ${byWhom}${when}.`;
|
|
218
|
+
}
|
|
219
|
+
return when
|
|
220
|
+
? `${label} was already resolved${when}.`
|
|
221
|
+
: `${label} is already resolved.`;
|
|
222
|
+
case OnCallAcknowledgePageState.AcknowledgedByYou:
|
|
223
|
+
return data.isObserverPage
|
|
224
|
+
? `You already marked this page as seen${when}.`
|
|
225
|
+
: `You already acknowledged ${labelInSentence}${when}.`;
|
|
226
|
+
case OnCallAcknowledgePageState.AcknowledgedBySomeoneElse:
|
|
227
|
+
default:
|
|
228
|
+
if (data.isObserverPage) {
|
|
229
|
+
if (byWhom) {
|
|
230
|
+
return `${byWhom} already marked this page as seen${when}.`;
|
|
231
|
+
}
|
|
232
|
+
return when
|
|
233
|
+
? `This page was already marked as seen${when}.`
|
|
234
|
+
: "This page is already marked as seen.";
|
|
235
|
+
}
|
|
236
|
+
if (byWhom) {
|
|
237
|
+
return `${label} was already acknowledged by ${byWhom}${when}.`;
|
|
238
|
+
}
|
|
239
|
+
return when
|
|
240
|
+
? `${label} was already acknowledged${when}.`
|
|
241
|
+
: `${label} is already acknowledged.`;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/*
|
|
245
|
+
* An answer that names who took it and when, from the change that did: the
|
|
246
|
+
* person themselves is "you" - their own acknowledgement, from the Dashboard
|
|
247
|
+
* say, is theirs.
|
|
248
|
+
*/
|
|
249
|
+
function takenBy(state, change, personUserId) {
|
|
250
|
+
const isByYou = isSamePerson(change === null || change === void 0 ? void 0 : change.byUserId, personUserId);
|
|
251
|
+
if (isByYou &&
|
|
252
|
+
state === OnCallAcknowledgePageState.AcknowledgedBySomeoneElse) {
|
|
253
|
+
return withTime({ state: OnCallAcknowledgePageState.AcknowledgedByYou }, change === null || change === void 0 ? void 0 : change.at);
|
|
254
|
+
}
|
|
255
|
+
const name = isByYou ? "" : ((change === null || change === void 0 ? void 0 : change.byName) || "").trim();
|
|
256
|
+
return withTime(Object.assign(Object.assign({ state: state }, (name ? { byName: name } : {})), (isByYou ? { isByYou: true } : {})), change === null || change === void 0 ? void 0 : change.at);
|
|
257
|
+
}
|
|
258
|
+
// The answer, with when it was taken when that is a moment.
|
|
259
|
+
function withTime(answer, at) {
|
|
260
|
+
if (!at) {
|
|
261
|
+
return answer;
|
|
262
|
+
}
|
|
263
|
+
const date = Date_1.default.fromString(at);
|
|
264
|
+
return Number.isNaN(date.getTime()) ? answer : Object.assign(Object.assign({}, answer), { at: date });
|
|
265
|
+
}
|
|
266
|
+
function toKnownTimezone(timezone) {
|
|
267
|
+
return timezone &&
|
|
268
|
+
Object.values(Timezone_1.default).includes(timezone)
|
|
269
|
+
? timezone
|
|
270
|
+
: Timezone_1.default.UTC;
|
|
271
|
+
}
|
|
272
|
+
function isSamePerson(a, b) {
|
|
273
|
+
const first = a ? a.toString().trim().toLowerCase() : "";
|
|
274
|
+
const second = b ? b.toString().trim().toLowerCase() : "";
|
|
275
|
+
return Boolean(first) && first === second;
|
|
276
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import commonJsModule from "./OnCallAcknowledgePage.js";
|
|
2
|
+
export const ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_ACKNOWLEDGED_TITLE = commonJsModule.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_ACKNOWLEDGED_TITLE;
|
|
3
|
+
export const ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_RESOLVED_TITLE = commonJsModule.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_RESOLVED_TITLE;
|
|
4
|
+
export const ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_SEEN_TITLE = commonJsModule.ON_CALL_ACKNOWLEDGE_PAGE_ALREADY_SEEN_TITLE;
|
|
5
|
+
export const OnCallAcknowledgePageState = commonJsModule.OnCallAcknowledgePageState;
|
|
6
|
+
export const getOnCallAcknowledgePageAnswer = commonJsModule.getOnCallAcknowledgePageAnswer;
|
|
7
|
+
export const getOnCallAcknowledgePageAnsweredHeading = commonJsModule.getOnCallAcknowledgePageAnsweredHeading;
|
|
8
|
+
export const getOnCallAcknowledgePageAnsweredSentence = commonJsModule.getOnCallAcknowledgePageAnsweredSentence;
|
|
9
|
+
export const getOnCallAcknowledgePageMoment = commonJsModule.getOnCallAcknowledgePageMoment;
|
|
10
|
+
export const getOnCallAcknowledgePagePersonName = commonJsModule.getOnCallAcknowledgePagePersonName;
|
|
11
|
+
export const isOnCallAcknowledgePageOpen = commonJsModule.isOnCallAcknowledgePageOpen;
|
|
12
|
+
export const isOnCallPageEndedOnlyByAnAnswer = commonJsModule.isOnCallPageEndedOnlyByAnAnswer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface OnCallEscalationWaitRun {
|
|
2
|
+
lastEscalationRuleExecutedAt?: Date | string | null | undefined;
|
|
3
|
+
createdAt?: Date | string | null | undefined;
|
|
4
|
+
executeNextEscalationRuleInMinutes?: number | null | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function getOnCallEscalationWaitStartedAt(run: OnCallEscalationWaitRun): Date | undefined;
|
|
7
|
+
export declare function getOnCallEscalationWaitInMinutes(run: OnCallEscalationWaitRun): number;
|
|
8
|
+
export declare function isOnCallEscalationWaitOver(run: OnCallEscalationWaitRun, now: Date): boolean;
|
|
9
|
+
export declare function getOnCallEscalationDueAt(run: OnCallEscalationWaitRun): Date | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface OnCallEscalationWaitRun {
|
|
2
|
+
lastEscalationRuleExecutedAt?: Date | string | null | undefined;
|
|
3
|
+
createdAt?: Date | string | null | undefined;
|
|
4
|
+
executeNextEscalationRuleInMinutes?: number | null | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function getOnCallEscalationWaitStartedAt(run: OnCallEscalationWaitRun): Date | undefined;
|
|
7
|
+
export declare function getOnCallEscalationWaitInMinutes(run: OnCallEscalationWaitRun): number;
|
|
8
|
+
export declare function isOnCallEscalationWaitOver(run: OnCallEscalationWaitRun, now: Date): boolean;
|
|
9
|
+
export declare function getOnCallEscalationDueAt(run: OnCallEscalationWaitRun): Date | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.getOnCallEscalationWaitStartedAt = getOnCallEscalationWaitStartedAt;
|
|
7
|
+
exports.getOnCallEscalationWaitInMinutes = getOnCallEscalationWaitInMinutes;
|
|
8
|
+
exports.isOnCallEscalationWaitOver = isOnCallEscalationWaitOver;
|
|
9
|
+
exports.getOnCallEscalationDueAt = getOnCallEscalationDueAt;
|
|
10
|
+
const Date_1 = __importDefault(require("../Date"));
|
|
11
|
+
const MINUTE_IN_MS = 60 * 1000;
|
|
12
|
+
// When the wait started: when the level started, else the run's creation.
|
|
13
|
+
function getOnCallEscalationWaitStartedAt(run) {
|
|
14
|
+
const startedAt = run.lastEscalationRuleExecutedAt || run.createdAt;
|
|
15
|
+
return startedAt ? Date_1.default.fromString(startedAt) : undefined;
|
|
16
|
+
}
|
|
17
|
+
// How many minutes the run waits: none, for a level that holds no wait.
|
|
18
|
+
function getOnCallEscalationWaitInMinutes(run) {
|
|
19
|
+
return run.executeNextEscalationRuleInMinutes || 0;
|
|
20
|
+
}
|
|
21
|
+
/*
|
|
22
|
+
* Whether the wait has run out at `now`, as the worker has always decided
|
|
23
|
+
* it: the whole minutes since it started are at least the wait.
|
|
24
|
+
*/
|
|
25
|
+
function isOnCallEscalationWaitOver(run, now) {
|
|
26
|
+
const startedAt = getOnCallEscalationWaitStartedAt(run);
|
|
27
|
+
return (Date_1.default.getDifferenceInMinutes(startedAt, now) >=
|
|
28
|
+
getOnCallEscalationWaitInMinutes(run));
|
|
29
|
+
}
|
|
30
|
+
/*
|
|
31
|
+
* The moment the wait runs out: the first at which isOnCallEscalationWaitOver
|
|
32
|
+
* says it is over. Undefined for a run with no moment its wait started, or
|
|
33
|
+
* a wait that never runs out.
|
|
34
|
+
*/
|
|
35
|
+
function getOnCallEscalationDueAt(run) {
|
|
36
|
+
const startedAt = getOnCallEscalationWaitStartedAt(run);
|
|
37
|
+
const minutes = getOnCallEscalationWaitInMinutes(run);
|
|
38
|
+
if (!startedAt || isNaN(startedAt.getTime()) || !Number.isFinite(minutes)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
// Whole minutes, as the worker counts them: a wait of 1.5 runs out at 2.
|
|
42
|
+
const wholeMinutes = minutes > 0 ? Math.ceil(minutes) : 0;
|
|
43
|
+
return new Date(startedAt.getTime() + wholeMinutes * MINUTE_IN_MS);
|
|
44
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import commonJsModule from "./OnCallEscalationWait.js";
|
|
2
|
+
export const getOnCallEscalationDueAt = commonJsModule.getOnCallEscalationDueAt;
|
|
3
|
+
export const getOnCallEscalationWaitInMinutes = commonJsModule.getOnCallEscalationWaitInMinutes;
|
|
4
|
+
export const getOnCallEscalationWaitStartedAt = commonJsModule.getOnCallEscalationWaitStartedAt;
|
|
5
|
+
export const isOnCallEscalationWaitOver = commonJsModule.isOnCallEscalationWaitOver;
|
|
@@ -57,6 +57,7 @@ export default interface ProbeMonitorResponse {
|
|
|
57
57
|
monitoredAt: Date;
|
|
58
58
|
isTimeout?: boolean | undefined;
|
|
59
59
|
ingestedAt?: Date | undefined;
|
|
60
|
+
dataReceivedAt?: Date | undefined;
|
|
60
61
|
evaluationSummary?: MonitorEvaluationSummary | undefined;
|
|
61
62
|
probeAttempts?: Array<ProbeAttempt> | undefined;
|
|
62
63
|
totalAttempts?: number | undefined;
|
|
@@ -57,6 +57,7 @@ export default interface ProbeMonitorResponse {
|
|
|
57
57
|
monitoredAt: Date;
|
|
58
58
|
isTimeout?: boolean | undefined;
|
|
59
59
|
ingestedAt?: Date | undefined;
|
|
60
|
+
dataReceivedAt?: Date | undefined;
|
|
60
61
|
evaluationSummary?: MonitorEvaluationSummary | undefined;
|
|
61
62
|
probeAttempts?: Array<ProbeAttempt> | undefined;
|
|
62
63
|
totalAttempts?: number | undefined;
|
|
@@ -7,6 +7,8 @@ export declare const getReadingDirection: (language: string | null | undefined)
|
|
|
7
7
|
export declare const isRightToLeftLanguage: (language: string | null | undefined) => boolean;
|
|
8
8
|
export declare const TEXT_DIRECTION_SCAN_LENGTH: number;
|
|
9
9
|
export declare const getTextReadingDirectionByMostLetters: (text: string | null | undefined) => ReadingDirection | null;
|
|
10
|
+
export declare const hasRightToLeftWords: (text: string | null | undefined) => boolean;
|
|
11
|
+
export declare const hasEnglishWords: (text: string | null | undefined) => boolean;
|
|
10
12
|
export declare const FIRST_STRONG_ISOLATE: string;
|
|
11
13
|
export declare const POP_DIRECTIONAL_ISOLATE: string;
|
|
12
14
|
export declare const isSetApartInSentence: (value: string, sentenceDirection: ReadingDirection) => boolean;
|
|
@@ -7,6 +7,8 @@ export declare const getReadingDirection: (language: string | null | undefined)
|
|
|
7
7
|
export declare const isRightToLeftLanguage: (language: string | null | undefined) => boolean;
|
|
8
8
|
export declare const TEXT_DIRECTION_SCAN_LENGTH: number;
|
|
9
9
|
export declare const getTextReadingDirectionByMostLetters: (text: string | null | undefined) => ReadingDirection | null;
|
|
10
|
+
export declare const hasRightToLeftWords: (text: string | null | undefined) => boolean;
|
|
11
|
+
export declare const hasEnglishWords: (text: string | null | undefined) => boolean;
|
|
10
12
|
export declare const FIRST_STRONG_ISOLATE: string;
|
|
11
13
|
export declare const POP_DIRECTIONAL_ISOLATE: string;
|
|
12
14
|
export declare const isSetApartInSentence: (value: string, sentenceDirection: ReadingDirection) => boolean;
|