@oneuptime/common 15.0.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/AIAgent.js +2 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.d.mts +2 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.d.ts +2 -0
- package/Models/DatabaseModels/AIAgentTaskPullRequest.js +62 -0
- package/Models/DatabaseModels/AIRun.d.mts +2 -0
- package/Models/DatabaseModels/AIRun.d.ts +2 -0
- package/Models/DatabaseModels/AIRun.js +63 -0
- package/Models/DatabaseModels/CustomNotificationChannel.js +17 -9
- package/Models/DatabaseModels/DataProduct.js +3 -2
- package/Models/DatabaseModels/GlobalConfig.js +1 -1
- package/Models/DatabaseModels/IoTDeviceCredential.js +3 -1
- package/Models/DatabaseModels/Monitor.d.mts +4 -0
- package/Models/DatabaseModels/Monitor.d.ts +4 -0
- package/Models/DatabaseModels/Monitor.js +108 -5
- package/Models/DatabaseModels/NetworkDevice.js +43 -17
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +38 -15
- package/Models/DatabaseModels/NetworkSnmpCredentialProfile.js +4 -4
- package/Models/DatabaseModels/OpenStackProjectNotice.js +29 -10
- package/Models/DatabaseModels/Probe.js +2 -0
- package/Models/DatabaseModels/ProjectSCIM.d.mts +2 -1
- package/Models/DatabaseModels/ProjectSCIM.d.ts +2 -1
- package/Models/DatabaseModels/ProjectSCIM.js +21 -9
- package/Models/DatabaseModels/Runbook.js +3 -2
- package/Models/DatabaseModels/Runner.js +2 -0
- package/Models/DatabaseModels/StatusPage.js +3 -2
- package/Models/DatabaseModels/StatusPageSCIM.d.mts +2 -1
- package/Models/DatabaseModels/StatusPageSCIM.d.ts +2 -1
- package/Models/DatabaseModels/StatusPageSCIM.js +17 -8
- package/Models/DatabaseModels/StatusPageSubscriber.js +35 -15
- package/Models/DatabaseModels/TelemetryIngestionKey.d.mts +2 -0
- package/Models/DatabaseModels/TelemetryIngestionKey.d.ts +2 -0
- package/Models/DatabaseModels/TelemetryIngestionKey.js +36 -1
- package/Models/DatabaseModels/UserWebhook.js +25 -17
- package/Models/DatabaseModels/WebhookLog.js +12 -2
- package/Models/DatabaseModels/Workflow.d.mts +3 -0
- package/Models/DatabaseModels/Workflow.d.ts +3 -0
- package/Models/DatabaseModels/Workflow.js +70 -1
- package/Server/Services/DatabaseService.d.mts +21 -1
- package/Server/Services/DatabaseService.d.ts +21 -1
- package/Types/AI/AIActionWords.js +1 -1
- package/Types/AI/CarriedRecords.d.mts +35 -0
- package/Types/AI/CarriedRecords.d.ts +35 -0
- package/Types/AI/CarriedRecords.js +211 -0
- package/Types/AI/CarriedRecords.mjs +3 -0
- package/Types/Accounts/SetPasswordLink.d.mts +6 -0
- package/Types/Accounts/SetPasswordLink.d.ts +6 -0
- package/Types/Accounts/SetPasswordLink.js +47 -0
- package/Types/Accounts/SetPasswordLink.mjs +7 -0
- package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +1 -1
- package/Types/CodeRepository/ProductionReview.d.mts +5 -0
- package/Types/CodeRepository/ProductionReview.d.ts +5 -0
- package/Types/CodeRepository/ProductionReview.js +108 -0
- package/Types/Database/DatabaseProperty.d.mts +1 -0
- package/Types/Database/DatabaseProperty.d.ts +1 -0
- package/Types/Database/DatabaseProperty.js +27 -0
- package/Types/Database/EncryptedValue.d.mts +2 -0
- package/Types/Database/EncryptedValue.d.ts +2 -0
- package/Types/Database/EncryptedValue.js +27 -0
- package/Types/Database/EncryptedValue.mjs +3 -0
- package/Types/Database/TableColumn.d.mts +3 -0
- package/Types/Database/TableColumn.d.ts +3 -0
- package/Types/Docs/GlossaryTerm.d.mts +1 -0
- package/Types/Docs/GlossaryTerm.d.ts +1 -0
- package/Types/Docs/GlossaryTerm.js +2 -0
- package/Types/Email/EmailSendFailure.d.mts +20 -0
- package/Types/Email/EmailSendFailure.d.ts +20 -0
- package/Types/Email/EmailSendFailure.js +244 -0
- package/Types/Email/EmailSendFailure.mjs +3 -0
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +5 -0
- package/Types/Runner/RunnerCodeFixCapability.d.mts +3 -1
- package/Types/Runner/RunnerCodeFixCapability.d.ts +3 -1
- package/Types/Runner/RunnerCodeFixCapability.js +19 -1
- package/Types/Runner/RunnerCodeFixCapability.mjs +1 -0
- package/Types/SSO/SessionsWithoutSso.js +2 -2
- package/Types/ServerSending/ServerSendingStatus.d.mts +23 -2
- package/Types/ServerSending/ServerSendingStatus.d.ts +23 -2
- package/Types/ServerSending/ServerSendingStatus.js +208 -10
- package/Types/ServerSending/ServerSendingStatus.mjs +3 -0
- package/Types/ServerSetup/ServerSetupChecklist.js +5 -0
- package/Types/StatusPage/StatusPageMagicLink.js +1 -1
- package/Types/StatusPage/StatusPageSignInMessages.d.mts +3 -0
- package/Types/StatusPage/StatusPageSignInMessages.d.ts +3 -0
- package/Types/StatusPage/StatusPageSignInMessages.js +16 -0
- package/Types/StatusPage/StatusPageSignInMessages.mjs +4 -0
- package/Types/StatusPage/StatusPageSingleSignOnProtocol.d.mts +12 -0
- package/Types/StatusPage/StatusPageSingleSignOnProtocol.d.ts +12 -0
- package/Types/StatusPage/StatusPageSingleSignOnProtocol.js +63 -0
- package/Types/StatusPage/StatusPageSingleSignOnProtocol.mjs +8 -0
- package/Types/StatusPage/StatusPageSubscriberChannel.d.mts +18 -0
- package/Types/StatusPage/StatusPageSubscriberChannel.d.ts +18 -0
- package/Types/StatusPage/StatusPageSubscriberChannel.js +91 -0
- package/Types/StatusPage/StatusPageSubscriberChannel.mjs +10 -0
- package/Types/Workspace/ConnectCallback.d.mts +2 -1
- package/Types/Workspace/ConnectCallback.d.ts +2 -1
- package/Types/Workspace/ConnectCallback.js +8 -0
- package/Utils/AiRemediation/DeclaredCodeChange.d.mts +4 -1
- package/Utils/AiRemediation/DeclaredCodeChange.d.ts +4 -1
- package/Utils/AiRemediation/DeclaredCodeChange.js +6 -0
- package/Utils/Dashboard/MonitorListWidgetFormat.js +1 -1
- package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +2 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +2 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.js +22 -5
- package/Utils/Incident/PostmortemActionItemCodeTask.mjs +1 -0
- package/Utils/LookupTable.d.mts +1 -0
- package/Utils/LookupTable.d.ts +1 -0
- package/Utils/LookupTable.js +19 -0
- package/Utils/LookupTable.mjs +1 -0
- package/Utils/Monitor/MonitorFirstCheckOverdue.js +5 -5
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +2 -10
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +2 -10
- package/Utils/Monitor/MonitorOverviewFamily.js +19 -99
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +1 -1
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +1 -1
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +6 -6
- package/Utils/Monitor/MonitorRowStatus.js +2 -2
- package/Utils/Monitor/MonitorTypeFamily.d.mts +14 -0
- package/Utils/Monitor/MonitorTypeFamily.d.ts +14 -0
- package/Utils/Monitor/MonitorTypeFamily.js +105 -0
- package/Utils/Monitor/MonitorTypeFamily.mjs +3 -0
- package/Utils/Monitor/StoredCheckEvidence.d.mts +10 -0
- package/Utils/Monitor/StoredCheckEvidence.d.ts +10 -0
- package/Utils/Monitor/StoredCheckEvidence.js +53 -0
- package/Utils/Monitor/StoredCheckEvidence.mjs +5 -0
- package/Utils/NetworkDiscovery/SnmpScanConfigUtil.js +11 -4
- package/Utils/Project/ProjectBilling.d.mts +1 -0
- package/Utils/Project/ProjectBilling.d.ts +1 -0
- package/Utils/Project/ProjectBilling.js +9 -1
- package/Utils/Project/ProjectBilling.mjs +1 -0
- package/Utils/StatusPage/HistoryWindow.d.mts +3 -0
- package/Utils/StatusPage/HistoryWindow.d.ts +3 -0
- package/Utils/StatusPage/HistoryWindow.js +24 -0
- package/Utils/StatusPage/HistoryWindow.mjs +4 -0
- package/Utils/Suggestions/CodeFixSuggestion.d.mts +2 -1
- package/Utils/Suggestions/CodeFixSuggestion.d.ts +2 -1
- package/Utils/Suggestions/CodeFixSuggestion.js +9 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.mts +1 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.ts +1 -0
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.js +24 -3
- package/Utils/Suggestions/InvestigationCodeFixSuggestion.mjs +1 -0
- package/Utils/Suggestions/ProfileFixSuggestion.d.mts +1 -0
- package/Utils/Suggestions/ProfileFixSuggestion.d.ts +1 -0
- package/Utils/Suggestions/ProfileFixSuggestion.js +16 -4
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -0
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -0
- package/Utils/Suggestions/TelemetryAiFixSuggestion.js +17 -5
- package/Utils/Suggestions/TelemetryAiFixSuggestion.mjs +1 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.js +16 -7
- package/Utils/WebhookAddressMask.d.mts +9 -0
- package/Utils/WebhookAddressMask.d.ts +9 -0
- package/Utils/WebhookAddressMask.js +66 -0
- package/Utils/WebhookAddressMask.mjs +2 -0
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* Dashboard, the Accounts pages and their tests all read it.
|
|
45
45
|
*/
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.MAX_SERVER_SENDING_FAILURE_LENGTH = exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS = exports.SERVER_SENDING_CHANNELS = exports.ServerSendingState = exports.ServerSendingChannel = void 0;
|
|
47
|
+
exports.MAX_SERVER_SENDING_RECIPIENT_REFUSALS = exports.SERVER_SENDING_THROTTLE_SUSTAINED_MS = exports.MAX_SERVER_SENDING_FAILURE_LENGTH = exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS = exports.SERVER_SENDING_CHANNELS = exports.ServerSendingFailureScope = exports.ServerSendingState = exports.ServerSendingChannel = void 0;
|
|
48
48
|
var ServerSendingChannel;
|
|
49
49
|
(function (ServerSendingChannel) {
|
|
50
50
|
ServerSendingChannel["Email"] = "email";
|
|
@@ -59,6 +59,22 @@ var ServerSendingState;
|
|
|
59
59
|
ServerSendingState["Working"] = "working";
|
|
60
60
|
ServerSendingState["Failing"] = "failing";
|
|
61
61
|
})(ServerSendingState || (exports.ServerSendingState = ServerSendingState = {}));
|
|
62
|
+
/*
|
|
63
|
+
* Whose problem a failed send is (#9217): the server's - its settings, the
|
|
64
|
+
* way to the provider, its account - which every admin is told of; one
|
|
65
|
+
* recipient's or one message's, which is said on that email's log row and
|
|
66
|
+
* the record that sent it, never in the banner; or the provider asking to
|
|
67
|
+
* slow down, which is the server's only once it has lasted
|
|
68
|
+
* (SERVER_SENDING_THROTTLE_SUSTAINED_MS). Email works it out from what the
|
|
69
|
+
* mail service said (Types/Email/EmailSendFailure); SMS and calls say
|
|
70
|
+
* nothing, and every failure of theirs is the server's, as it always was.
|
|
71
|
+
*/
|
|
72
|
+
var ServerSendingFailureScope;
|
|
73
|
+
(function (ServerSendingFailureScope) {
|
|
74
|
+
ServerSendingFailureScope["Server"] = "server";
|
|
75
|
+
ServerSendingFailureScope["Recipient"] = "recipient";
|
|
76
|
+
ServerSendingFailureScope["Throttled"] = "throttled";
|
|
77
|
+
})(ServerSendingFailureScope || (exports.ServerSendingFailureScope = ServerSendingFailureScope = {}));
|
|
62
78
|
exports.SERVER_SENDING_CHANNELS = [
|
|
63
79
|
ServerSendingChannel.Email,
|
|
64
80
|
ServerSendingChannel.SMS,
|
|
@@ -75,6 +91,17 @@ exports.SERVER_SENDING_CHANNELS = [
|
|
|
75
91
|
exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS = 60 * 60 * 1000;
|
|
76
92
|
// The longest failure reason kept: a mail server's answer can be long.
|
|
77
93
|
exports.MAX_SERVER_SENDING_FAILURE_LENGTH = 500;
|
|
94
|
+
/*
|
|
95
|
+
* How long a provider may ask to slow down, with nothing going out, before
|
|
96
|
+
* the server's sends are said to fail: a burst is the provider pacing a
|
|
97
|
+
* busy hour, and the email is sent again; a quarter of an hour of it is the
|
|
98
|
+
* account's limit, and email is late.
|
|
99
|
+
*/
|
|
100
|
+
exports.SERVER_SENDING_THROTTLE_SUSTAINED_MS = 15 * 60 * 1000;
|
|
101
|
+
// The most recipient refusals kept, newest first.
|
|
102
|
+
exports.MAX_SERVER_SENDING_RECIPIENT_REFUSALS = 5;
|
|
103
|
+
// The longest recipient address kept.
|
|
104
|
+
const MAX_RECIPIENT_LENGTH = 320;
|
|
78
105
|
const EMPTY_ENTRY = {
|
|
79
106
|
lastSucceededAt: null,
|
|
80
107
|
lastFailedAt: null,
|
|
@@ -117,6 +144,41 @@ const readCount = (value) => {
|
|
|
117
144
|
const isObject = (value) => {
|
|
118
145
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
119
146
|
};
|
|
147
|
+
const readRecipient = (value) => {
|
|
148
|
+
if (typeof value !== "string") {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const recipient = value.trim();
|
|
152
|
+
return recipient && recipient.length <= MAX_RECIPIENT_LENGTH
|
|
153
|
+
? recipient
|
|
154
|
+
: null;
|
|
155
|
+
};
|
|
156
|
+
const isSameRecipient = (a, b) => {
|
|
157
|
+
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
158
|
+
};
|
|
159
|
+
// The recipient refusals kept, read whole: a row that is not one is left out.
|
|
160
|
+
const readRecipientRefusals = (value) => {
|
|
161
|
+
if (!Array.isArray(value)) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
const refusals = [];
|
|
165
|
+
for (const row of value) {
|
|
166
|
+
if (!isObject(row)) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const recipient = readRecipient(row["recipient"]);
|
|
170
|
+
const reason = readText(row["reason"]);
|
|
171
|
+
const at = readDate(row["at"]);
|
|
172
|
+
if (!recipient || !reason || !at) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
refusals.push({ recipient: recipient, reason: reason, at: at });
|
|
176
|
+
if (refusals.length >= exports.MAX_SERVER_SENDING_RECIPIENT_REFUSALS) {
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return refusals;
|
|
181
|
+
};
|
|
120
182
|
class ServerSendingStatusUtil {
|
|
121
183
|
// One channel's entry, read whole from whatever was stored.
|
|
122
184
|
static readEntry(value) {
|
|
@@ -133,6 +195,17 @@ class ServerSendingStatusUtil {
|
|
|
133
195
|
if (settingsFingerprint) {
|
|
134
196
|
entry.settingsFingerprint = settingsFingerprint;
|
|
135
197
|
}
|
|
198
|
+
if (ServerSendingStatusUtil.isFailureScope(value["failureScope"])) {
|
|
199
|
+
entry.failureScope = value["failureScope"];
|
|
200
|
+
}
|
|
201
|
+
const throttledSince = readDate(value["throttledSince"]);
|
|
202
|
+
if (throttledSince) {
|
|
203
|
+
entry.throttledSince = throttledSince;
|
|
204
|
+
}
|
|
205
|
+
const refusals = readRecipientRefusals(value["recipientRefusals"]);
|
|
206
|
+
if (refusals.length > 0) {
|
|
207
|
+
entry.recipientRefusals = refusals;
|
|
208
|
+
}
|
|
136
209
|
return entry;
|
|
137
210
|
}
|
|
138
211
|
/*
|
|
@@ -199,8 +272,9 @@ class ServerSendingStatusUtil {
|
|
|
199
272
|
return ServerSendingState.Untested;
|
|
200
273
|
}
|
|
201
274
|
static getStatus(data) {
|
|
275
|
+
var _a;
|
|
202
276
|
const isSetUp = !data.setUpProblem;
|
|
203
|
-
|
|
277
|
+
const status = {
|
|
204
278
|
channel: data.channel,
|
|
205
279
|
state: ServerSendingStatusUtil.getState({
|
|
206
280
|
isSetUp: isSetUp,
|
|
@@ -212,6 +286,12 @@ class ServerSendingStatusUtil {
|
|
|
212
286
|
lastFailure: data.entry.lastFailure,
|
|
213
287
|
setUpProblem: data.setUpProblem,
|
|
214
288
|
};
|
|
289
|
+
if (isSetUp && ((_a = data.entry.recipientRefusals) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
290
|
+
status.recipientRefusals = data.entry.recipientRefusals.map((refusal) => {
|
|
291
|
+
return { ...refusal };
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return status;
|
|
215
295
|
}
|
|
216
296
|
/*
|
|
217
297
|
* What a page anybody can open may say: the server is known not to be
|
|
@@ -236,29 +316,103 @@ class ServerSendingStatusUtil {
|
|
|
236
316
|
return (status.state === ServerSendingState.NotSetUp ||
|
|
237
317
|
status.state === ServerSendingState.Failing);
|
|
238
318
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
319
|
+
/*
|
|
320
|
+
* The entry after a send went out through the settings the entry is
|
|
321
|
+
* learned with - the same settings, sender and way to the provider every
|
|
322
|
+
* failure of the server's was about: the server's sends go out again, and
|
|
323
|
+
* the provider no longer asks to slow down. A recipient refused before is
|
|
324
|
+
* taken off only by a send to that recipient, never by a test to another.
|
|
325
|
+
*/
|
|
326
|
+
static withSucceeded(entry, now, recipient) {
|
|
327
|
+
const next = {
|
|
242
328
|
...entry,
|
|
243
329
|
lastSucceededAt: now.toISOString(),
|
|
244
330
|
failingSince: null,
|
|
245
331
|
};
|
|
332
|
+
delete next.failureScope;
|
|
333
|
+
delete next.throttledSince;
|
|
334
|
+
const refusals = (entry.recipientRefusals || []).filter((refusal) => {
|
|
335
|
+
return !recipient || !isSameRecipient(refusal.recipient, recipient);
|
|
336
|
+
});
|
|
337
|
+
if (refusals.length > 0) {
|
|
338
|
+
next.recipientRefusals = refusals;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
delete next.recipientRefusals;
|
|
342
|
+
}
|
|
343
|
+
return next;
|
|
246
344
|
}
|
|
247
|
-
// The entry after a send failed, and why.
|
|
345
|
+
// The entry after a send failed for a reason of the server's, and why.
|
|
248
346
|
static withFailed(entry, reason, now) {
|
|
249
347
|
return {
|
|
250
348
|
...entry,
|
|
251
349
|
lastFailedAt: now.toISOString(),
|
|
252
350
|
failingSince: entry.failingSince || now.toISOString(),
|
|
253
351
|
lastFailure: readText(reason) || "Unknown error.",
|
|
352
|
+
failureScope: ServerSendingFailureScope.Server,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/*
|
|
356
|
+
* The entry after the provider asked to slow down: failing, since it
|
|
357
|
+
* first did, once it has lasted SERVER_SENDING_THROTTLE_SUSTAINED_MS with
|
|
358
|
+
* nothing going out.
|
|
359
|
+
*/
|
|
360
|
+
static withThrottled(entry, reason, now) {
|
|
361
|
+
const throttledSince = entry.throttledSince || now.toISOString();
|
|
362
|
+
const next = {
|
|
363
|
+
...entry,
|
|
364
|
+
throttledSince: throttledSince,
|
|
365
|
+
};
|
|
366
|
+
if (!entry.failingSince &&
|
|
367
|
+
now.getTime() - new Date(throttledSince).getTime() <
|
|
368
|
+
exports.SERVER_SENDING_THROTTLE_SUSTAINED_MS) {
|
|
369
|
+
return next;
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
...next,
|
|
373
|
+
lastFailedAt: now.toISOString(),
|
|
374
|
+
failingSince: entry.failingSince || throttledSince,
|
|
375
|
+
lastFailure: readText(reason) || "Unknown error.",
|
|
376
|
+
failureScope: entry.failingSince
|
|
377
|
+
? entry.failureScope || ServerSendingFailureScope.Server
|
|
378
|
+
: ServerSendingFailureScope.Throttled,
|
|
254
379
|
};
|
|
255
380
|
}
|
|
381
|
+
/*
|
|
382
|
+
* The entry after one recipient was refused: kept among the recipient
|
|
383
|
+
* refusals, newest first. Whether the server's sends fail is left as it
|
|
384
|
+
* was - every other email still goes out.
|
|
385
|
+
*/
|
|
386
|
+
static withRecipientRefused(entry, recipient, reason, now) {
|
|
387
|
+
const address = readRecipient(recipient);
|
|
388
|
+
if (!address) {
|
|
389
|
+
return { ...entry };
|
|
390
|
+
}
|
|
391
|
+
const refusals = [
|
|
392
|
+
{
|
|
393
|
+
recipient: address,
|
|
394
|
+
reason: readText(reason) || "Unknown error.",
|
|
395
|
+
at: now.toISOString(),
|
|
396
|
+
},
|
|
397
|
+
...(entry.recipientRefusals || []).filter((refusal) => {
|
|
398
|
+
return !isSameRecipient(refusal.recipient, address);
|
|
399
|
+
}),
|
|
400
|
+
].slice(0, exports.MAX_SERVER_SENDING_RECIPIENT_REFUSALS);
|
|
401
|
+
return { ...entry, recipientRefusals: refusals };
|
|
402
|
+
}
|
|
256
403
|
/*
|
|
257
404
|
* Whether a send that went out is news worth a write: the first ever, the
|
|
258
405
|
* first after failures, or the same news an hour later.
|
|
259
406
|
*/
|
|
260
|
-
static shouldWriteSucceeded(entry, now) {
|
|
261
|
-
if (!entry.lastSucceededAt || entry.failingSince) {
|
|
407
|
+
static shouldWriteSucceeded(entry, now, recipient) {
|
|
408
|
+
if (!entry.lastSucceededAt || entry.failingSince || entry.throttledSince) {
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
// A recipient refused before, that a send has now gone out to.
|
|
412
|
+
if (recipient &&
|
|
413
|
+
(entry.recipientRefusals || []).some((refusal) => {
|
|
414
|
+
return isSameRecipient(refusal.recipient, recipient);
|
|
415
|
+
})) {
|
|
262
416
|
return true;
|
|
263
417
|
}
|
|
264
418
|
return (now.getTime() - new Date(entry.lastSucceededAt).getTime() >=
|
|
@@ -278,6 +432,45 @@ class ServerSendingStatusUtil {
|
|
|
278
432
|
return (now.getTime() - new Date(entry.lastFailedAt).getTime() >=
|
|
279
433
|
exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS);
|
|
280
434
|
}
|
|
435
|
+
/*
|
|
436
|
+
* Whether a slow-down is news worth a write: the first, the one that
|
|
437
|
+
* makes it last long enough to be failing, or the same an hour later.
|
|
438
|
+
*/
|
|
439
|
+
static shouldWriteThrottled(entry, now) {
|
|
440
|
+
if (!entry.throttledSince) {
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
if (!entry.failingSince) {
|
|
444
|
+
return (now.getTime() - new Date(entry.throttledSince).getTime() >=
|
|
445
|
+
exports.SERVER_SENDING_THROTTLE_SUSTAINED_MS);
|
|
446
|
+
}
|
|
447
|
+
return (!entry.lastFailedAt ||
|
|
448
|
+
now.getTime() - new Date(entry.lastFailedAt).getTime() >=
|
|
449
|
+
exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS);
|
|
450
|
+
}
|
|
451
|
+
/*
|
|
452
|
+
* Whether a recipient's refusal is news worth a write: one not kept, a
|
|
453
|
+
* new reason, or the same an hour later.
|
|
454
|
+
*/
|
|
455
|
+
static shouldWriteRecipientRefused(entry, recipient, reason, now) {
|
|
456
|
+
if (!readRecipient(recipient)) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
const kept = (entry.recipientRefusals || []).find((refusal) => {
|
|
460
|
+
return isSameRecipient(refusal.recipient, recipient);
|
|
461
|
+
});
|
|
462
|
+
if (!kept) {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
if ((readText(reason) || "Unknown error.") !== kept.reason) {
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
return (now.getTime() - new Date(kept.at).getTime() >=
|
|
469
|
+
exports.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS);
|
|
470
|
+
}
|
|
471
|
+
static isFailureScope(value) {
|
|
472
|
+
return Object.values(ServerSendingFailureScope).includes(value);
|
|
473
|
+
}
|
|
281
474
|
static isChannel(value) {
|
|
282
475
|
return exports.SERVER_SENDING_CHANNELS.includes(value);
|
|
283
476
|
}
|
|
@@ -300,7 +493,7 @@ class ServerSendingStatusUtil {
|
|
|
300
493
|
!ServerSendingStatusUtil.isState(row["state"])) {
|
|
301
494
|
continue;
|
|
302
495
|
}
|
|
303
|
-
|
|
496
|
+
const status = {
|
|
304
497
|
channel: row["channel"],
|
|
305
498
|
state: row["state"],
|
|
306
499
|
hasWorked: row["hasWorked"] === true,
|
|
@@ -308,7 +501,12 @@ class ServerSendingStatusUtil {
|
|
|
308
501
|
failingSince: readDate(row["failingSince"]),
|
|
309
502
|
lastFailure: readText(row["lastFailure"]),
|
|
310
503
|
setUpProblem: readText(row["setUpProblem"]),
|
|
311
|
-
}
|
|
504
|
+
};
|
|
505
|
+
const refusals = readRecipientRefusals(row["recipientRefusals"]);
|
|
506
|
+
if (refusals.length > 0) {
|
|
507
|
+
status.recipientRefusals = refusals;
|
|
508
|
+
}
|
|
509
|
+
channels.push(status);
|
|
312
510
|
}
|
|
313
511
|
const probes = value["globalProbes"];
|
|
314
512
|
return {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import commonJsModule from "./ServerSendingStatus.js";
|
|
2
2
|
export default commonJsModule.default;
|
|
3
3
|
export const MAX_SERVER_SENDING_FAILURE_LENGTH = commonJsModule.MAX_SERVER_SENDING_FAILURE_LENGTH;
|
|
4
|
+
export const MAX_SERVER_SENDING_RECIPIENT_REFUSALS = commonJsModule.MAX_SERVER_SENDING_RECIPIENT_REFUSALS;
|
|
4
5
|
export const SERVER_SENDING_CHANNELS = commonJsModule.SERVER_SENDING_CHANNELS;
|
|
5
6
|
export const SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS = commonJsModule.SERVER_SENDING_HEALTH_REWRITE_INTERVAL_MS;
|
|
7
|
+
export const SERVER_SENDING_THROTTLE_SUSTAINED_MS = commonJsModule.SERVER_SENDING_THROTTLE_SUSTAINED_MS;
|
|
6
8
|
export const ServerSendingChannel = commonJsModule.ServerSendingChannel;
|
|
9
|
+
export const ServerSendingFailureScope = commonJsModule.ServerSendingFailureScope;
|
|
7
10
|
export const ServerSendingState = commonJsModule.ServerSendingState;
|
|
@@ -485,6 +485,11 @@ class ServerSetupChecklistUtil {
|
|
|
485
485
|
tests: status === ServerSetupStatus.NotSetUp
|
|
486
486
|
? []
|
|
487
487
|
: [ServerSendingStatus_1.ServerSendingChannel.Email],
|
|
488
|
+
/*
|
|
489
|
+
* Email's own status, for what Settings > Emails says beside the
|
|
490
|
+
* check: the addresses refused while email works (#9217).
|
|
491
|
+
*/
|
|
492
|
+
channels: [{ ...facts.email, sentThrough: facts.emailSentThrough }],
|
|
488
493
|
});
|
|
489
494
|
}
|
|
490
495
|
/*
|
|
@@ -53,7 +53,7 @@ exports.STATUS_PAGE_MAGIC_LINK_ROUTE = "magic-link";
|
|
|
53
53
|
*/
|
|
54
54
|
exports.STATUS_PAGE_MAGIC_LINK_INVALID_MESSAGE = "This sign-in link has expired or has already been used. Please ask for a new one.";
|
|
55
55
|
exports.STATUS_PAGE_MAGIC_LINK_SSO_REQUIRED_MESSAGE = "Status Page supports authentication by SSO. You cannot use a sign-in link for authentication.";
|
|
56
|
-
exports.STATUS_PAGE_MAGIC_LINK_TURNED_OFF_MESSAGE = "Sign-in links are turned off for this status page. Please
|
|
56
|
+
exports.STATUS_PAGE_MAGIC_LINK_TURNED_OFF_MESSAGE = "Sign-in links are turned off for this status page. Please sign in with your email and password.";
|
|
57
57
|
exports.STATUS_PAGE_MAGIC_LINK_NOT_AVAILABLE_MESSAGE = "Sign-in links are not available for this status page.";
|
|
58
58
|
/*
|
|
59
59
|
* Why a status page does not take sign-in links now, or null when it does.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* What the server tells a private status page's reader about signing in.
|
|
4
|
+
* Shared with the status page, which says each one in the reader's language
|
|
5
|
+
* (StatusPage/src/Utils/ServerMessageWords.ts, locale keys serverMessages.*).
|
|
6
|
+
* They say "sign in", the name the status page's own pages use (#9132,
|
|
7
|
+
* #9212); they used to say "Please login".
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.STATUS_PAGE_SIGNED_OUT_MESSAGE = exports.STATUS_PAGE_SESSION_EXPIRED_MESSAGE = exports.STATUS_PAGE_SIGN_IN_TO_VIEW_MESSAGE = void 0;
|
|
11
|
+
// A private page asked for by somebody who is not signed in to it.
|
|
12
|
+
exports.STATUS_PAGE_SIGN_IN_TO_VIEW_MESSAGE = "You do not have access to this status page. Please sign in to view it.";
|
|
13
|
+
// The session behind the reader's refresh cookie has ended, or is not this page's.
|
|
14
|
+
exports.STATUS_PAGE_SESSION_EXPIRED_MESSAGE = "Session expired. Please sign in again.";
|
|
15
|
+
// The reader's browser sent no refresh cookie at all.
|
|
16
|
+
exports.STATUS_PAGE_SIGNED_OUT_MESSAGE = "You are signed out. Please sign in again.";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import commonJsModule from "./StatusPageSignInMessages.js";
|
|
2
|
+
export const STATUS_PAGE_SESSION_EXPIRED_MESSAGE = commonJsModule.STATUS_PAGE_SESSION_EXPIRED_MESSAGE;
|
|
3
|
+
export const STATUS_PAGE_SIGNED_OUT_MESSAGE = commonJsModule.STATUS_PAGE_SIGNED_OUT_MESSAGE;
|
|
4
|
+
export const STATUS_PAGE_SIGN_IN_TO_VIEW_MESSAGE = commonJsModule.STATUS_PAGE_SIGN_IN_TO_VIEW_MESSAGE;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Dictionary from "../Dictionary.mjs";
|
|
2
|
+
declare enum StatusPageSingleSignOnProtocol {
|
|
3
|
+
SAML = "saml",
|
|
4
|
+
OIDC = "oidc"
|
|
5
|
+
}
|
|
6
|
+
export declare const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS: ReadonlyArray<StatusPageSingleSignOnProtocol>;
|
|
7
|
+
export declare const DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL: StatusPageSingleSignOnProtocol;
|
|
8
|
+
export declare const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM: string;
|
|
9
|
+
export declare const MOVED_SINGLE_SIGN_ON_PATHS: Readonly<Record<string, StatusPageSingleSignOnProtocol>>;
|
|
10
|
+
export declare const readStatusPageSingleSignOnProtocol: (value: string | null | undefined) => StatusPageSingleSignOnProtocol | null;
|
|
11
|
+
export declare const getStatusPageSingleSignOnProtocolQuery: (protocol: StatusPageSingleSignOnProtocol) => Dictionary<string>;
|
|
12
|
+
export default StatusPageSingleSignOnProtocol;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Dictionary from "../Dictionary";
|
|
2
|
+
declare enum StatusPageSingleSignOnProtocol {
|
|
3
|
+
SAML = "saml",
|
|
4
|
+
OIDC = "oidc"
|
|
5
|
+
}
|
|
6
|
+
export declare const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS: ReadonlyArray<StatusPageSingleSignOnProtocol>;
|
|
7
|
+
export declare const DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL: StatusPageSingleSignOnProtocol;
|
|
8
|
+
export declare const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM: string;
|
|
9
|
+
export declare const MOVED_SINGLE_SIGN_ON_PATHS: Readonly<Record<string, StatusPageSingleSignOnProtocol>>;
|
|
10
|
+
export declare const readStatusPageSingleSignOnProtocol: (value: string | null | undefined) => StatusPageSingleSignOnProtocol | null;
|
|
11
|
+
export declare const getStatusPageSingleSignOnProtocolQuery: (protocol: StatusPageSingleSignOnProtocol) => Dictionary<string>;
|
|
12
|
+
export default StatusPageSingleSignOnProtocol;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStatusPageSingleSignOnProtocolQuery = exports.readStatusPageSingleSignOnProtocol = exports.MOVED_SINGLE_SIGN_ON_PATHS = exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM = exports.DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL = exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* The protocols a status page's single sign-on providers speak, as the
|
|
6
|
+
* dashboard's one Single Sign-On page names its tabs in the address
|
|
7
|
+
* (`…/status-pages/:id/sso?protocol=oidc`).
|
|
8
|
+
*
|
|
9
|
+
* They were two menu entries until #9130, "SSO" and "OIDC", side by side
|
|
10
|
+
* with the same lock icon: one kind of record (a sign-on provider) on two
|
|
11
|
+
* pages, under one name ("SSO") that is also what OIDC is. The SAML page
|
|
12
|
+
* kept its address and is the first tab; the OIDC page's address is still
|
|
13
|
+
* in bookmarks and wikis, so the dashboard forwards it to its tab
|
|
14
|
+
* (MOVED_SINGLE_SIGN_ON_PATHS).
|
|
15
|
+
*
|
|
16
|
+
* React-free and database-free, so the dashboard and a test can both read
|
|
17
|
+
* it.
|
|
18
|
+
*/
|
|
19
|
+
var StatusPageSingleSignOnProtocol;
|
|
20
|
+
(function (StatusPageSingleSignOnProtocol) {
|
|
21
|
+
StatusPageSingleSignOnProtocol["SAML"] = "saml";
|
|
22
|
+
StatusPageSingleSignOnProtocol["OIDC"] = "oidc";
|
|
23
|
+
})(StatusPageSingleSignOnProtocol || (StatusPageSingleSignOnProtocol = {}));
|
|
24
|
+
// In tab order. The first is the tab a bare address opens.
|
|
25
|
+
exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS = [StatusPageSingleSignOnProtocol.SAML, StatusPageSingleSignOnProtocol.OIDC];
|
|
26
|
+
exports.DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL = StatusPageSingleSignOnProtocol.SAML;
|
|
27
|
+
// The query parameter that names the open tab.
|
|
28
|
+
exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM = "protocol";
|
|
29
|
+
/*
|
|
30
|
+
* Where each protocol's page used to be, under a status page's own address,
|
|
31
|
+
* and the tab it is now. SAML's page ("sso") is the Single Sign-On page
|
|
32
|
+
* itself, so only OIDC's moved.
|
|
33
|
+
*/
|
|
34
|
+
exports.MOVED_SINGLE_SIGN_ON_PATHS = {
|
|
35
|
+
oidc: StatusPageSingleSignOnProtocol.OIDC,
|
|
36
|
+
};
|
|
37
|
+
// The protocol a value names, or null when it names none.
|
|
38
|
+
const readStatusPageSingleSignOnProtocol = (value) => {
|
|
39
|
+
if (typeof value !== "string") {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const normalized = value.trim().toLowerCase();
|
|
43
|
+
for (const protocol of exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS) {
|
|
44
|
+
if (protocol === normalized) {
|
|
45
|
+
return protocol;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
exports.readStatusPageSingleSignOnProtocol = readStatusPageSingleSignOnProtocol;
|
|
51
|
+
/*
|
|
52
|
+
* The query that opens the Single Sign-On page on a protocol's tab:
|
|
53
|
+
* { protocol: "oidc" }, and nothing for the first tab, whose address is
|
|
54
|
+
* the bare one - the address the page itself shows once that tab is open.
|
|
55
|
+
*/
|
|
56
|
+
const getStatusPageSingleSignOnProtocolQuery = (protocol) => {
|
|
57
|
+
if (protocol === exports.DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
return { [exports.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM]: protocol };
|
|
61
|
+
};
|
|
62
|
+
exports.getStatusPageSingleSignOnProtocolQuery = getStatusPageSingleSignOnProtocolQuery;
|
|
63
|
+
exports.default = StatusPageSingleSignOnProtocol;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import commonJsModule from "./StatusPageSingleSignOnProtocol.js";
|
|
2
|
+
export default commonJsModule.default;
|
|
3
|
+
export const DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL = commonJsModule.DEFAULT_STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL;
|
|
4
|
+
export const MOVED_SINGLE_SIGN_ON_PATHS = commonJsModule.MOVED_SINGLE_SIGN_ON_PATHS;
|
|
5
|
+
export const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS = commonJsModule.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOLS;
|
|
6
|
+
export const STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM = commonJsModule.STATUS_PAGE_SINGLE_SIGN_ON_PROTOCOL_QUERY_PARAM;
|
|
7
|
+
export const getStatusPageSingleSignOnProtocolQuery = commonJsModule.getStatusPageSingleSignOnProtocolQuery;
|
|
8
|
+
export const readStatusPageSingleSignOnProtocol = commonJsModule.readStatusPageSingleSignOnProtocol;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Dictionary from "../Dictionary.mjs";
|
|
2
|
+
import { StatusPageSubscriberUnsubscribeChannel } from "./StatusPageSubscriberUnsubscribe.mjs";
|
|
3
|
+
declare enum StatusPageSubscriberChannel {
|
|
4
|
+
Email = "email",
|
|
5
|
+
SMS = "sms",
|
|
6
|
+
Slack = "slack",
|
|
7
|
+
MicrosoftTeams = "microsoft-teams",
|
|
8
|
+
Webhook = "webhook"
|
|
9
|
+
}
|
|
10
|
+
export declare const STATUS_PAGE_SUBSCRIBER_CHANNELS: ReadonlyArray<StatusPageSubscriberChannel>;
|
|
11
|
+
export declare const DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL: StatusPageSubscriberChannel;
|
|
12
|
+
export declare const STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM: string;
|
|
13
|
+
export declare const STATUS_PAGE_SUBSCRIBERS_PAGE_PATH: string;
|
|
14
|
+
export declare const MOVED_SUBSCRIBER_LIST_PATHS: Readonly<Record<string, StatusPageSubscriberChannel>>;
|
|
15
|
+
export declare const readStatusPageSubscriberChannel: (value: string | null | undefined) => StatusPageSubscriberChannel | null;
|
|
16
|
+
export declare const getStatusPageSubscriberChannelQuery: (channel: StatusPageSubscriberChannel) => Dictionary<string>;
|
|
17
|
+
export declare const getStatusPageSubscriberChannelForUnsubscribeChannel: (channel: StatusPageSubscriberUnsubscribeChannel) => StatusPageSubscriberChannel;
|
|
18
|
+
export default StatusPageSubscriberChannel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Dictionary from "../Dictionary";
|
|
2
|
+
import { StatusPageSubscriberUnsubscribeChannel } from "./StatusPageSubscriberUnsubscribe";
|
|
3
|
+
declare enum StatusPageSubscriberChannel {
|
|
4
|
+
Email = "email",
|
|
5
|
+
SMS = "sms",
|
|
6
|
+
Slack = "slack",
|
|
7
|
+
MicrosoftTeams = "microsoft-teams",
|
|
8
|
+
Webhook = "webhook"
|
|
9
|
+
}
|
|
10
|
+
export declare const STATUS_PAGE_SUBSCRIBER_CHANNELS: ReadonlyArray<StatusPageSubscriberChannel>;
|
|
11
|
+
export declare const DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL: StatusPageSubscriberChannel;
|
|
12
|
+
export declare const STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM: string;
|
|
13
|
+
export declare const STATUS_PAGE_SUBSCRIBERS_PAGE_PATH: string;
|
|
14
|
+
export declare const MOVED_SUBSCRIBER_LIST_PATHS: Readonly<Record<string, StatusPageSubscriberChannel>>;
|
|
15
|
+
export declare const readStatusPageSubscriberChannel: (value: string | null | undefined) => StatusPageSubscriberChannel | null;
|
|
16
|
+
export declare const getStatusPageSubscriberChannelQuery: (channel: StatusPageSubscriberChannel) => Dictionary<string>;
|
|
17
|
+
export declare const getStatusPageSubscriberChannelForUnsubscribeChannel: (channel: StatusPageSubscriberUnsubscribeChannel) => StatusPageSubscriberChannel;
|
|
18
|
+
export default StatusPageSubscriberChannel;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStatusPageSubscriberChannelForUnsubscribeChannel = exports.getStatusPageSubscriberChannelQuery = exports.readStatusPageSubscriberChannel = exports.MOVED_SUBSCRIBER_LIST_PATHS = exports.STATUS_PAGE_SUBSCRIBERS_PAGE_PATH = exports.STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM = exports.DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL = exports.STATUS_PAGE_SUBSCRIBER_CHANNELS = void 0;
|
|
4
|
+
const StatusPageSubscriberUnsubscribe_1 = require("./StatusPageSubscriberUnsubscribe");
|
|
5
|
+
/*
|
|
6
|
+
* The channels a status page's subscribers are reached on, as the
|
|
7
|
+
* dashboard's one Subscribers page names its tabs in the address
|
|
8
|
+
* (`…/status-pages/:id/subscribers?channel=sms`).
|
|
9
|
+
*
|
|
10
|
+
* Each channel was a page of its own until #9125 - Email Subscribers, SMS
|
|
11
|
+
* Subscribers, Slack Subscribers, Microsoft Teams Subscribers and Webhook
|
|
12
|
+
* Subscribers, five menu entries for one kind of record - and those
|
|
13
|
+
* addresses are still in bookmarks, wikis and the emails the server sent.
|
|
14
|
+
* They are named here, once, and the dashboard forwards each to its tab
|
|
15
|
+
* (MOVED_SUBSCRIBER_LIST_PATHS). Anything that links to a channel's list,
|
|
16
|
+
* the server's emails included, builds the address from this vocabulary.
|
|
17
|
+
*
|
|
18
|
+
* React-free and database-free, so the server, the dashboard and a test can
|
|
19
|
+
* all read it.
|
|
20
|
+
*/
|
|
21
|
+
var StatusPageSubscriberChannel;
|
|
22
|
+
(function (StatusPageSubscriberChannel) {
|
|
23
|
+
StatusPageSubscriberChannel["Email"] = "email";
|
|
24
|
+
StatusPageSubscriberChannel["SMS"] = "sms";
|
|
25
|
+
StatusPageSubscriberChannel["Slack"] = "slack";
|
|
26
|
+
StatusPageSubscriberChannel["MicrosoftTeams"] = "microsoft-teams";
|
|
27
|
+
StatusPageSubscriberChannel["Webhook"] = "webhook";
|
|
28
|
+
})(StatusPageSubscriberChannel || (StatusPageSubscriberChannel = {}));
|
|
29
|
+
// In tab order. The first is the tab a bare address opens.
|
|
30
|
+
exports.STATUS_PAGE_SUBSCRIBER_CHANNELS = [
|
|
31
|
+
StatusPageSubscriberChannel.Email,
|
|
32
|
+
StatusPageSubscriberChannel.SMS,
|
|
33
|
+
StatusPageSubscriberChannel.Slack,
|
|
34
|
+
StatusPageSubscriberChannel.MicrosoftTeams,
|
|
35
|
+
StatusPageSubscriberChannel.Webhook,
|
|
36
|
+
];
|
|
37
|
+
exports.DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL = StatusPageSubscriberChannel.Email;
|
|
38
|
+
// The query parameter that names the open tab.
|
|
39
|
+
exports.STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM = "channel";
|
|
40
|
+
// The Subscribers page, under a status page's own address.
|
|
41
|
+
exports.STATUS_PAGE_SUBSCRIBERS_PAGE_PATH = "subscribers";
|
|
42
|
+
/*
|
|
43
|
+
* Where each channel's list used to be, under a status page's own address,
|
|
44
|
+
* and the tab it is now.
|
|
45
|
+
*/
|
|
46
|
+
exports.MOVED_SUBSCRIBER_LIST_PATHS = {
|
|
47
|
+
"email-subscribers": StatusPageSubscriberChannel.Email,
|
|
48
|
+
"sms-subscribers": StatusPageSubscriberChannel.SMS,
|
|
49
|
+
"slack-subscribers": StatusPageSubscriberChannel.Slack,
|
|
50
|
+
"microsoft-teams-subscribers": StatusPageSubscriberChannel.MicrosoftTeams,
|
|
51
|
+
"webhook-subscribers": StatusPageSubscriberChannel.Webhook,
|
|
52
|
+
};
|
|
53
|
+
// The channel a value names, or null when it names none.
|
|
54
|
+
const readStatusPageSubscriberChannel = (value) => {
|
|
55
|
+
if (typeof value !== "string") {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const normalized = value.trim().toLowerCase();
|
|
59
|
+
for (const channel of exports.STATUS_PAGE_SUBSCRIBER_CHANNELS) {
|
|
60
|
+
if (channel === normalized) {
|
|
61
|
+
return channel;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
exports.readStatusPageSubscriberChannel = readStatusPageSubscriberChannel;
|
|
67
|
+
/*
|
|
68
|
+
* The query that opens the Subscribers page on a channel's tab:
|
|
69
|
+
* { channel: "sms" }, and nothing for the first tab, whose address is the
|
|
70
|
+
* bare one - the address the page itself shows once that tab is open.
|
|
71
|
+
*/
|
|
72
|
+
const getStatusPageSubscriberChannelQuery = (channel) => {
|
|
73
|
+
if (channel === exports.DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL) {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
return { [exports.STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM]: channel };
|
|
77
|
+
};
|
|
78
|
+
exports.getStatusPageSubscriberChannelQuery = getStatusPageSubscriberChannelQuery;
|
|
79
|
+
const CHANNEL_BY_UNSUBSCRIBE_CHANNEL = {
|
|
80
|
+
[StatusPageSubscriberUnsubscribe_1.StatusPageSubscriberUnsubscribeChannel.Email]: StatusPageSubscriberChannel.Email,
|
|
81
|
+
[StatusPageSubscriberUnsubscribe_1.StatusPageSubscriberUnsubscribeChannel.SMS]: StatusPageSubscriberChannel.SMS,
|
|
82
|
+
[StatusPageSubscriberUnsubscribe_1.StatusPageSubscriberUnsubscribeChannel.Slack]: StatusPageSubscriberChannel.Slack,
|
|
83
|
+
[StatusPageSubscriberUnsubscribe_1.StatusPageSubscriberUnsubscribeChannel.MicrosoftTeams]: StatusPageSubscriberChannel.MicrosoftTeams,
|
|
84
|
+
[StatusPageSubscriberUnsubscribe_1.StatusPageSubscriberUnsubscribeChannel.Webhook]: StatusPageSubscriberChannel.Webhook,
|
|
85
|
+
};
|
|
86
|
+
// The tab a subscriber's channel is on, as the server's emails name it.
|
|
87
|
+
const getStatusPageSubscriberChannelForUnsubscribeChannel = (channel) => {
|
|
88
|
+
return CHANNEL_BY_UNSUBSCRIBE_CHANNEL[channel];
|
|
89
|
+
};
|
|
90
|
+
exports.getStatusPageSubscriberChannelForUnsubscribeChannel = getStatusPageSubscriberChannelForUnsubscribeChannel;
|
|
91
|
+
exports.default = StatusPageSubscriberChannel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import commonJsModule from "./StatusPageSubscriberChannel.js";
|
|
2
|
+
export default commonJsModule.default;
|
|
3
|
+
export const DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL = commonJsModule.DEFAULT_STATUS_PAGE_SUBSCRIBER_CHANNEL;
|
|
4
|
+
export const MOVED_SUBSCRIBER_LIST_PATHS = commonJsModule.MOVED_SUBSCRIBER_LIST_PATHS;
|
|
5
|
+
export const STATUS_PAGE_SUBSCRIBERS_PAGE_PATH = commonJsModule.STATUS_PAGE_SUBSCRIBERS_PAGE_PATH;
|
|
6
|
+
export const STATUS_PAGE_SUBSCRIBER_CHANNELS = commonJsModule.STATUS_PAGE_SUBSCRIBER_CHANNELS;
|
|
7
|
+
export const STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM = commonJsModule.STATUS_PAGE_SUBSCRIBER_CHANNEL_QUERY_PARAM;
|
|
8
|
+
export const getStatusPageSubscriberChannelForUnsubscribeChannel = commonJsModule.getStatusPageSubscriberChannelForUnsubscribeChannel;
|
|
9
|
+
export const getStatusPageSubscriberChannelQuery = commonJsModule.getStatusPageSubscriberChannelQuery;
|
|
10
|
+
export const readStatusPageSubscriberChannel = commonJsModule.readStatusPageSubscriberChannel;
|
|
@@ -39,7 +39,8 @@ export declare const CONNECT_ERROR_QUERY_PARAM: string;
|
|
|
39
39
|
export declare const CONNECT_PROVIDER_QUERY_PARAM: string;
|
|
40
40
|
export declare const CONNECT_NOTICE_QUERY_PARAM: string;
|
|
41
41
|
export declare enum ConnectProviderNotice {
|
|
42
|
-
GitHubInstalled = "github-installed"
|
|
42
|
+
GitHubInstalled = "github-installed",
|
|
43
|
+
ZoomAdded = "zoom-added"
|
|
43
44
|
}
|
|
44
45
|
export declare const CONNECT_CONNECTED_QUERY_PARAM: string;
|
|
45
46
|
export declare const CONNECT_START_PAGE_QUERY_PARAM: string;
|
|
@@ -39,7 +39,8 @@ export declare const CONNECT_ERROR_QUERY_PARAM: string;
|
|
|
39
39
|
export declare const CONNECT_PROVIDER_QUERY_PARAM: string;
|
|
40
40
|
export declare const CONNECT_NOTICE_QUERY_PARAM: string;
|
|
41
41
|
export declare enum ConnectProviderNotice {
|
|
42
|
-
GitHubInstalled = "github-installed"
|
|
42
|
+
GitHubInstalled = "github-installed",
|
|
43
|
+
ZoomAdded = "zoom-added"
|
|
43
44
|
}
|
|
44
45
|
export declare const CONNECT_CONNECTED_QUERY_PARAM: string;
|
|
45
46
|
export declare const CONNECT_START_PAGE_QUERY_PARAM: string;
|