@oneuptime/common 14.0.92 → 14.0.93

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 (85) hide show
  1. package/Models/DatabaseModels/Alert.js +8 -1
  2. package/Models/DatabaseModels/AlertEpisodeMember.d.mts +1 -0
  3. package/Models/DatabaseModels/AlertEpisodeMember.d.ts +1 -0
  4. package/Models/DatabaseModels/AlertEpisodeMember.js +50 -0
  5. package/Models/DatabaseModels/IncidentEpisodeMember.d.mts +1 -0
  6. package/Models/DatabaseModels/IncidentEpisodeMember.d.ts +1 -0
  7. package/Models/DatabaseModels/IncidentEpisodeMember.js +50 -0
  8. package/Models/DatabaseModels/IncomingCallPolicy.js +1 -1
  9. package/Models/DatabaseModels/LlmProvider.js +1 -1
  10. package/Models/DatabaseModels/MonitorTemplate.js +10 -4
  11. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +13 -13
  12. package/Models/DatabaseModels/OnCallDutyPolicy.js +1 -1
  13. package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +1 -1
  14. package/Models/DatabaseModels/StatusPage.d.mts +2 -0
  15. package/Models/DatabaseModels/StatusPage.d.ts +2 -0
  16. package/Models/DatabaseModels/StatusPage.js +100 -0
  17. package/Types/Database/BlankColumnValue.d.mts +6 -0
  18. package/Types/Database/BlankColumnValue.d.ts +6 -0
  19. package/Types/Database/BlankColumnValue.js +77 -0
  20. package/Types/Database/BlankColumnValue.mjs +4 -0
  21. package/Types/Email/EmailTemplateType.d.mts +1 -0
  22. package/Types/Email/EmailTemplateType.d.ts +1 -0
  23. package/Types/Email/EmailTemplateType.js +1 -0
  24. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.mts +6 -0
  25. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.ts +6 -0
  26. package/Types/IncomingCall/IncomingCallPolicyRepeat.js +41 -14
  27. package/Types/IncomingCall/IncomingCallPolicyRepeat.mjs +3 -0
  28. package/Types/Monitor/CriteriaFilter.d.mts +1 -0
  29. package/Types/Monitor/CriteriaFilter.d.ts +1 -0
  30. package/Types/Monitor/CriteriaFilter.js +9 -0
  31. package/Types/Monitor/DatabaseMetricCatalog.js +2 -2
  32. package/Types/Monitor/KubernetesEventAlertTemplates.d.mts +20 -0
  33. package/Types/Monitor/KubernetesEventAlertTemplates.d.ts +20 -0
  34. package/Types/Monitor/KubernetesEventAlertTemplates.js +232 -0
  35. package/Types/Monitor/KubernetesEventAlertTemplates.mjs +8 -0
  36. package/Types/Monitor/MonitorType.js +12 -2
  37. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +27 -2
  38. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.mts +1 -0
  39. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.ts +1 -0
  40. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +31 -1
  41. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +3 -1
  42. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +3 -1
  43. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +3 -2
  44. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.mts +1 -0
  45. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.ts +1 -0
  46. package/Types/NotificationSetting/NotificationEmailRollupCategory.js +2 -0
  47. package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +10 -3
  48. package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
  49. package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
  50. package/Types/NotificationSetting/NotificationSettingEventType.js +7 -0
  51. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.mts +7 -0
  52. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.ts +7 -0
  53. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.js +51 -0
  54. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.mjs +4 -0
  55. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.mts +8 -0
  56. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.ts +8 -0
  57. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.js +55 -0
  58. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.mjs +5 -0
  59. package/Types/Workflow/Templates.js +2 -5
  60. package/Utils/ColorContrast.d.mts +3 -0
  61. package/Utils/ColorContrast.d.ts +3 -0
  62. package/Utils/ColorContrast.js +41 -3
  63. package/Utils/ColorContrast.mjs +2 -0
  64. package/Utils/Incident/WhoOpenedItRootCause.d.mts +2 -0
  65. package/Utils/Incident/WhoOpenedItRootCause.d.ts +2 -0
  66. package/Utils/Incident/WhoOpenedItRootCause.js +50 -0
  67. package/Utils/Incident/WhoOpenedItRootCause.mjs +3 -0
  68. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.mts +18 -0
  69. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.ts +18 -0
  70. package/Utils/Monitor/SyntheticMonitorStepsUtil.js +129 -0
  71. package/Utils/Monitor/SyntheticMonitorStepsUtil.mjs +4 -0
  72. package/Utils/Rules/RuleRunSummary.d.mts +1 -0
  73. package/Utils/Rules/RuleRunSummary.d.ts +1 -0
  74. package/Utils/Rules/RuleRunSummary.js +19 -1
  75. package/Utils/Rules/RuleRunSummary.mjs +1 -0
  76. package/Utils/Sms/Gsm7Text.js +9 -1
  77. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  78. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  79. package/Utils/Sms/OnCallPageSms.js +19 -2
  80. package/Utils/Sms/OnCallPageSms.mjs +1 -0
  81. package/Utils/Sms/SubscriberSms.d.mts +2 -0
  82. package/Utils/Sms/SubscriberSms.d.ts +2 -0
  83. package/Utils/Sms/SubscriberSms.js +35 -0
  84. package/Utils/Sms/SubscriberSms.mjs +3 -0
  85. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { RuleRunResult, RuleRunType } from "../../Types/Rules/RuleRun.mjs";
2
+ export declare function withIndefiniteArticle(noun: string): string;
2
3
  export default class RuleRunSummary {
3
4
  static describeConfirmation(ruleType: RuleRunType): string;
4
5
  static describeRunNowCard(ruleType: RuleRunType): string;
@@ -1,4 +1,5 @@
1
1
  import { RuleRunResult, RuleRunType } from "../../Types/Rules/RuleRun";
2
+ export declare function withIndefiniteArticle(noun: string): string;
2
3
  export default class RuleRunSummary {
3
4
  static describeConfirmation(ruleType: RuleRunType): string;
4
5
  static describeRunNowCard(ruleType: RuleRunType): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withIndefiniteArticle = withIndefiniteArticle;
3
4
  const RuleRun_1 = require("../../Types/Rules/RuleRun");
4
5
  /*
5
6
  * The sentences a rule run shows: before it starts, while it is chaining
@@ -23,6 +24,23 @@ function wasOrWere(value) {
23
24
  function capitalize(text) {
24
25
  return text.charAt(0).toUpperCase() + text.slice(1);
25
26
  }
27
+ /*
28
+ * Initialisms said letter by letter whose first letter sounds like a vowel:
29
+ * "an SLO". Every other noun takes "an" before a vowel letter ("an
30
+ * incident", "an IoT fleet", "an on-call policy") and "a" otherwise ("a
31
+ * host", "a RUM application").
32
+ */
33
+ const INITIALISMS_SAID_WITH_A_VOWEL = ["SLO"];
34
+ /*
35
+ * The singular with its indefinite article, as it reads mid-sentence: "an
36
+ * incident", "a host". The Run Now card said "when a incident is created".
37
+ */
38
+ function withIndefiniteArticle(noun) {
39
+ const firstWord = noun.split(" ")[0] || "";
40
+ const isAn = INITIALISMS_SAID_WITH_A_VOWEL.includes(firstWord) ||
41
+ "aeiouAEIOU".includes(noun.charAt(0) || "-");
42
+ return `${isAn ? "an" : "a"} ${noun}`;
43
+ }
26
44
  class RuleRunSummary {
27
45
  // What the confirmation modal says the run is about to do.
28
46
  static describeConfirmation(ruleType) {
@@ -54,7 +72,7 @@ class RuleRunSummary {
54
72
  if (meta.action === RuleRun_1.RuleRunAction.SyncSloMonitors) {
55
73
  return "Re-sync this SLO's monitors now with its enabled rules. Monitors attached by hand are left alone.";
56
74
  }
57
- return `This rule runs only when a ${meta.resourceSingular} is created. Run it now for the ${meta.resourcePlural} that already exist.`;
75
+ return `This rule runs only when ${withIndefiniteArticle(meta.resourceSingular)} is created. Run it now for the ${meta.resourcePlural} that already exist.`;
58
76
  }
59
77
  /*
60
78
  * The confirmation for running several rules from the table's bulk actions.
@@ -1,2 +1,3 @@
1
1
  import commonJsModule from "./RuleRunSummary.js";
2
2
  export default commonJsModule.default;
3
+ export const withIndefiniteArticle = commonJsModule.withIndefiniteArticle;
@@ -420,6 +420,13 @@ const collapseSpaces = (text) => {
420
420
  let collapsed = "";
421
421
  // A space is written only once the next character shows it parts words.
422
422
  let pendingSpace = false;
423
+ /*
424
+ * The last character written, kept apart: reading it back from the string
425
+ * (collapsed[collapsed.length - 1]) made V8 flatten the string being
426
+ * built at every space, copying all of it - time that grew with the
427
+ * square of the text (400,000 characters of words took 12 seconds).
428
+ */
429
+ let last;
423
430
  for (const character of text) {
424
431
  if (character === SPACE) {
425
432
  pendingSpace = true;
@@ -428,16 +435,17 @@ const collapseSpaces = (text) => {
428
435
  if (character === "\n" || character === "\r") {
429
436
  pendingSpace = false;
430
437
  collapsed += character;
438
+ last = character;
431
439
  continue;
432
440
  }
433
441
  if (pendingSpace) {
434
- const last = collapsed[collapsed.length - 1];
435
442
  if (last !== undefined && last !== "\n" && last !== "\r") {
436
443
  collapsed += SPACE;
437
444
  }
438
445
  pendingSpace = false;
439
446
  }
440
447
  collapsed += character;
448
+ last = character;
441
449
  }
442
450
  return collapsed;
443
451
  };
@@ -7,6 +7,7 @@ export declare enum OnCallPageSmsKind {
7
7
  }
8
8
  export declare const ON_CALL_PAGE_SMS_KIND_WORDS: Readonly<Record<OnCallPageSmsKind, ReadonlyArray<string>>>;
9
9
  export declare const ON_CALL_PAGE_SMS_ACTION: string;
10
+ export declare const ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED: string;
10
11
  export declare const ON_CALL_PAGE_SMS_CUT_MARK: string;
11
12
  export declare const MIN_TITLE_CHARACTERS: number;
12
13
  export declare const MAX_PAGE_SMS_SEGMENTS: number;
@@ -18,6 +19,7 @@ export interface OnCallPageSmsInput {
18
19
  projectName?: string | null | undefined;
19
20
  title?: string | null | undefined;
20
21
  link: string;
22
+ isPageAgain?: boolean | undefined;
21
23
  sentAs?: ((text: string) => string) | undefined;
22
24
  }
23
25
  export interface OnCallPageSms {
@@ -7,6 +7,7 @@ export declare enum OnCallPageSmsKind {
7
7
  }
8
8
  export declare const ON_CALL_PAGE_SMS_KIND_WORDS: Readonly<Record<OnCallPageSmsKind, ReadonlyArray<string>>>;
9
9
  export declare const ON_CALL_PAGE_SMS_ACTION: string;
10
+ export declare const ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED: string;
10
11
  export declare const ON_CALL_PAGE_SMS_CUT_MARK: string;
11
12
  export declare const MIN_TITLE_CHARACTERS: number;
12
13
  export declare const MAX_PAGE_SMS_SEGMENTS: number;
@@ -18,6 +19,7 @@ export interface OnCallPageSmsInput {
18
19
  projectName?: string | null | undefined;
19
20
  title?: string | null | undefined;
20
21
  link: string;
22
+ isPageAgain?: boolean | undefined;
21
23
  sentAs?: ((text: string) => string) | undefined;
22
24
  }
23
25
  export interface OnCallPageSms {
@@ -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.buildOnCallPageSms = exports.describeWhatHappened = exports.MAX_PAGE_SMS_SEGMENTS = exports.MIN_TITLE_CHARACTERS = exports.ON_CALL_PAGE_SMS_CUT_MARK = exports.ON_CALL_PAGE_SMS_ACTION = exports.ON_CALL_PAGE_SMS_KIND_WORDS = exports.OnCallPageSmsKind = void 0;
6
+ exports.buildOnCallPageSms = exports.describeWhatHappened = exports.MAX_PAGE_SMS_SEGMENTS = exports.MIN_TITLE_CHARACTERS = exports.ON_CALL_PAGE_SMS_CUT_MARK = exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = exports.ON_CALL_PAGE_SMS_ACTION = exports.ON_CALL_PAGE_SMS_KIND_WORDS = exports.OnCallPageSmsKind = void 0;
7
7
  const Text_1 = __importDefault(require("../../Types/Text"));
8
8
  const Gsm7Text_1 = require("./Gsm7Text");
9
9
  const SmsSegments_1 = require("./SmsSegments");
@@ -24,6 +24,16 @@ const SmsSegments_1 = require("./SmsSegments");
24
24
  * project, the title and the link. A severity named after what it rates
25
25
  * ("Critical Incident") is not followed by the word again.
26
26
  *
27
+ * A PAGE AGAIN - a policy paging again because a record acknowledged a while
28
+ * ago is still not resolved (OnCallAcknowledgementTimeout) - says so after
29
+ * the project, where a first page goes straight on to the title:
30
+ *
31
+ * OneUptime: Critical Incident INC-42 in Acme Prod is still not resolved:
32
+ * Checkout API is down. Ack or escalate: https://oneuptime.com/l/XJlaZRsd
33
+ *
34
+ * The person paged acknowledged it once already; worded as a first page,
35
+ * the text read like a second alarm about something new.
36
+ *
27
37
  * THE FITTING RULE. The text takes the fewest parts it can, trying for one
28
38
  * part, then two, and so on. For each number of parts:
29
39
  *
@@ -35,7 +45,8 @@ const SmsSegments_1 = require("./SmsSegments");
35
45
  * happened, so then the text takes one more part instead.
36
46
  *
37
47
  * The product name, the severity, the number and the link are never cut:
38
- * they say who sends it, how bad it is, which one it is and where to act.
48
+ * they say who sends it, how bad it is, which one it is and where to act -
49
+ * and nor is a page again's "is still not resolved", which says why.
39
50
  *
40
51
  * Every value is written in the characters an SMS carries cheaply
41
52
  * (Gsm7Text): a curly quote or an emoji in a title no longer makes the page
@@ -68,6 +79,8 @@ exports.ON_CALL_PAGE_SMS_KIND_WORDS = {
68
79
  * it: the same word as every other place says (OnCallPagePassOn).
69
80
  */
70
81
  exports.ON_CALL_PAGE_SMS_ACTION = "Ack or escalate:";
82
+ // What a page again says after the project: the record is still open.
83
+ exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = "is still not resolved";
71
84
  // What a cut title ends with: three full stops, which GSM-7 has (… it has not).
72
85
  exports.ON_CALL_PAGE_SMS_CUT_MARK = "...";
73
86
  // The fewest characters of a title a cut leaves.
@@ -163,6 +176,9 @@ const compose = (parts, options) => {
163
176
  if (options.withProject && parts.projectName) {
164
177
  head += ` in ${parts.projectName}`;
165
178
  }
179
+ if (parts.isPageAgain) {
180
+ head += ` ${exports.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED}`;
181
+ }
166
182
  let sentence = head;
167
183
  if (options.title) {
168
184
  sentence += `: ${options.title}`;
@@ -230,6 +246,7 @@ const buildOnCallPageSms = (input) => {
230
246
  projectName: toSmsValue(input.projectName),
231
247
  title: Array.from(toSmsValue(input.title)),
232
248
  link: input.link.trim(),
249
+ isPageAgain: input.isPageAgain === true,
233
250
  };
234
251
  const wholeTitle = parts.title.join("");
235
252
  const measure = (text) => {
@@ -4,6 +4,7 @@ export const MIN_TITLE_CHARACTERS = commonJsModule.MIN_TITLE_CHARACTERS;
4
4
  export const ON_CALL_PAGE_SMS_ACTION = commonJsModule.ON_CALL_PAGE_SMS_ACTION;
5
5
  export const ON_CALL_PAGE_SMS_CUT_MARK = commonJsModule.ON_CALL_PAGE_SMS_CUT_MARK;
6
6
  export const ON_CALL_PAGE_SMS_KIND_WORDS = commonJsModule.ON_CALL_PAGE_SMS_KIND_WORDS;
7
+ export const ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED = commonJsModule.ON_CALL_PAGE_SMS_STILL_NOT_RESOLVED;
7
8
  export const OnCallPageSmsKind = commonJsModule.OnCallPageSmsKind;
8
9
  export const buildOnCallPageSms = commonJsModule.buildOnCallPageSms;
9
10
  export const describeWhatHappened = commonJsModule.describeWhatHappened;
@@ -0,0 +1,2 @@
1
+ export declare const writeDefaultSubscriberSms: (text: string) => string;
2
+ export default writeDefaultSubscriberSms;
@@ -0,0 +1,2 @@
1
+ export declare const writeDefaultSubscriberSms: (text: string) => string;
2
+ export default writeDefaultSubscriberSms;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeDefaultSubscriberSms = void 0;
4
+ const Gsm7Text_1 = require("./Gsm7Text");
5
+ /*
6
+ * THE TEXT MESSAGES A STATUS PAGE'S SUBSCRIBERS GET, AS ONEUPTIME WRITES THEM.
7
+ *
8
+ * A status page texts its SMS subscribers about incidents, their states and
9
+ * notes, incident episodes, scheduled maintenance, announcements and
10
+ * postmortems, and about their own subscription (the confirmation link, the
11
+ * welcome, the manage link). A single character outside the GSM 7-bit
12
+ * alphabet - a curly apostrophe in an incident's title or in the page's
13
+ * name, an en dash, an emoji - made the whole text UCS-2, 70 characters a
14
+ * part instead of 160, so each subscriber's text cost two or three times as
15
+ * much (SmsSegments).
16
+ *
17
+ * OneUptime's own texts are written in GSM-7's characters wherever a
18
+ * character has a plain look-alike (Gsm7Text: curly quotes as ' and ",
19
+ * dashes as -, an emoji left out), as an on-call page's are. The links - the
20
+ * details link, and the unsubscribe or confirmation link with its token -
21
+ * go out exactly as written: a link is an address, and a look-alike would
22
+ * lead somewhere else. Letters of other scripts are kept as written.
23
+ *
24
+ * A custom SMS template a team wrote for its page goes out as written, with
25
+ * every value it places: the team chose its words and texts through its own
26
+ * Twilio account (a custom SMS template is used only with one), where
27
+ * Twilio's own Smart Encoding can do the same if they want it.
28
+ *
29
+ * Pure, with no Node or browser APIs. Linear in the text's length.
30
+ */
31
+ const writeDefaultSubscriberSms = (text) => {
32
+ return (0, Gsm7Text_1.toGsm7Message)(text).trim();
33
+ };
34
+ exports.writeDefaultSubscriberSms = writeDefaultSubscriberSms;
35
+ exports.default = exports.writeDefaultSubscriberSms;
@@ -0,0 +1,3 @@
1
+ import commonJsModule from "./SubscriberSms.js";
2
+ export default commonJsModule.default;
3
+ export const writeDefaultSubscriberSms = commonJsModule.writeDefaultSubscriberSms;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneuptime/common",
3
- "version": "14.0.92",
3
+ "version": "14.0.93",
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": {