@oneuptime/common 14.1.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/Models/DatabaseModels/Alert.d.mts +1 -0
  2. package/Models/DatabaseModels/Alert.d.ts +1 -0
  3. package/Models/DatabaseModels/Alert.js +34 -0
  4. package/Models/DatabaseModels/AutoRemediationSuggestion.d.mts +2 -0
  5. package/Models/DatabaseModels/AutoRemediationSuggestion.d.ts +2 -0
  6. package/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
  7. package/Models/DatabaseModels/Incident.d.mts +1 -0
  8. package/Models/DatabaseModels/Incident.d.ts +1 -0
  9. package/Models/DatabaseModels/Incident.js +35 -0
  10. package/Models/DatabaseModels/IncidentPostmortemActionItem.d.mts +31 -0
  11. package/Models/DatabaseModels/IncidentPostmortemActionItem.d.ts +31 -0
  12. package/Models/DatabaseModels/IncidentPostmortemActionItem.js +591 -0
  13. package/Models/DatabaseModels/IncidentPostmortemActionItem.mjs +3 -0
  14. package/Models/DatabaseModels/Index.js +2 -0
  15. package/Models/DatabaseModels/TelemetryIngestionKey.js +1 -1
  16. package/Types/AI/AIActionWords.d.mts +3 -1
  17. package/Types/AI/AIActionWords.d.ts +3 -1
  18. package/Types/AI/AIActionWords.js +70 -1
  19. package/Types/AI/AIActionWords.mjs +2 -0
  20. package/Types/AI/AIChatTypes.d.mts +2 -1
  21. package/Types/AI/AIChatTypes.d.ts +2 -1
  22. package/Types/AI/AIReadTableWords.d.mts +192 -0
  23. package/Types/AI/AIReadTableWords.d.ts +192 -0
  24. package/Types/AI/AIReadTableWords.js +368 -0
  25. package/Types/AI/AIReadTableWords.mjs +18 -0
  26. package/Types/AI/AiRunRefusal.d.mts +3 -0
  27. package/Types/AI/AiRunRefusal.d.ts +3 -0
  28. package/Types/AI/AiRunRefusal.js +22 -1
  29. package/Types/AI/ResourceAiAccessPermissions.js +7 -18
  30. package/Types/AuditLog/AuditLogActionLabel.js +19 -9
  31. package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -0
  32. package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -0
  33. package/Types/BaseDatabase/AggregationIntervalUtil.js +123 -16
  34. package/Types/Cloud/CloudResourceHealth.d.mts +30 -1
  35. package/Types/Cloud/CloudResourceHealth.d.ts +30 -1
  36. package/Types/Cloud/CloudResourceHealth.js +405 -13
  37. package/Types/Cloud/CloudResourceHealth.mjs +28 -0
  38. package/Types/DataObservability/DataCheckRefusals.d.mts +32 -0
  39. package/Types/DataObservability/DataCheckRefusals.d.ts +32 -0
  40. package/Types/DataObservability/DataCheckRefusals.js +77 -0
  41. package/Types/DataObservability/DataCheckRefusals.mjs +8 -0
  42. package/Types/Database/AccessControl/PermissionScopeNarrowing.js +4 -0
  43. package/Types/Date.d.mts +2 -0
  44. package/Types/Date.d.ts +2 -0
  45. package/Types/Date.js +22 -0
  46. package/Types/DateLanguage.d.mts +2 -0
  47. package/Types/DateLanguage.d.ts +2 -0
  48. package/Types/DateLanguage.js +8 -5
  49. package/Types/Email/EmailTemplateType.d.mts +1 -0
  50. package/Types/Email/EmailTemplateType.d.ts +1 -0
  51. package/Types/Email/EmailTemplateType.js +2 -0
  52. package/Types/Exception/EgressGuardException.js +1 -1
  53. package/Types/Exception/ErrorMessageRule.d.mts +1 -0
  54. package/Types/Exception/ErrorMessageRule.d.ts +1 -0
  55. package/Types/Exception/ErrorMessageRule.js +67 -13
  56. package/Types/Exception/ErrorMessageRule.mjs +1 -0
  57. package/Types/Exception/ExceptionMessages.d.mts +2 -0
  58. package/Types/Exception/ExceptionMessages.d.ts +2 -0
  59. package/Types/Exception/ExceptionMessages.js +2 -0
  60. package/Types/Incident/PostmortemActionItemStatus.d.mts +17 -0
  61. package/Types/Incident/PostmortemActionItemStatus.d.ts +17 -0
  62. package/Types/Incident/PostmortemActionItemStatus.js +74 -0
  63. package/Types/Incident/PostmortemActionItemStatus.mjs +5 -0
  64. package/Types/JSONFunctions.js +10 -3
  65. package/Types/Link.d.mts +1 -0
  66. package/Types/Link.d.ts +1 -0
  67. package/Types/MeaningKeys.d.mts +4 -0
  68. package/Types/MeaningKeys.d.ts +4 -0
  69. package/Types/MeaningKeys.js +74 -0
  70. package/Types/MeaningKeys.mjs +5 -0
  71. package/Types/Monitor/WhoIsTold.d.mts +3 -0
  72. package/Types/Monitor/WhoIsTold.d.ts +3 -0
  73. package/Types/Monitor/WhoIsTold.js +63 -13
  74. package/Types/NoBreakSpaces.d.mts +16 -0
  75. package/Types/NoBreakSpaces.d.ts +16 -0
  76. package/Types/NoBreakSpaces.js +419 -0
  77. package/Types/NoBreakSpaces.mjs +9 -0
  78. package/Types/NotificationRule/PagingLadder.d.mts +12 -0
  79. package/Types/NotificationRule/PagingLadder.d.ts +12 -0
  80. package/Types/NotificationRule/PagingLadder.js +159 -11
  81. package/Types/NotificationRule/PagingLadder.mjs +3 -0
  82. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.mts +3 -0
  83. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.ts +3 -0
  84. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.js +42 -0
  85. package/Types/OnCallDutyPolicy/OnCallPageRecordGone.mjs +4 -0
  86. package/Types/OnCallDutyPolicy/OnCallPageWords.d.mts +6 -2
  87. package/Types/OnCallDutyPolicy/OnCallPageWords.d.ts +6 -2
  88. package/Types/OnCallDutyPolicy/OnCallPageWords.js +21 -20
  89. package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +4 -0
  90. package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +4 -0
  91. package/Types/OnCallDutyPolicy/OnCallPersonPage.js +125 -1
  92. package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +1 -0
  93. package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +2 -0
  94. package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +2 -0
  95. package/Types/OnCallDutyPolicy/OnCallTestPage.js +12 -0
  96. package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
  97. package/Types/OpenStack/OpenStackCapacity.js +12 -5
  98. package/Types/Permission.d.mts +4 -0
  99. package/Types/Permission.d.ts +4 -0
  100. package/Types/Permission.js +64 -8
  101. package/Types/Product/ProductUsage.js +2 -1
  102. package/Types/Product/ProjectProductsAnswer.js +2 -1
  103. package/Types/ResourceAiAgent/AiResourceType.d.mts +1 -0
  104. package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
  105. package/Types/ResourceAiAgent/AiResourceType.js +12 -0
  106. package/Types/Rum/ProductAnalyticsEventReads.js +10 -1
  107. package/Types/Rum/ProductAnalyticsEvents.js +13 -1
  108. package/Types/Rum/SessionReplayCustomEvents.d.mts +4 -1
  109. package/Types/Rum/SessionReplayCustomEvents.d.ts +4 -1
  110. package/Types/Rum/SessionReplayCustomEvents.js +12 -0
  111. package/Types/Rum/SessionReplayCustomEvents.mjs +1 -0
  112. package/Types/SetupHealth/SetupHealth.d.mts +1 -0
  113. package/Types/SetupHealth/SetupHealth.d.ts +1 -0
  114. package/Types/SetupHealth/SetupHealth.js +13 -5
  115. package/Types/StatusPage/DefaultStatusNames.d.mts +11 -3
  116. package/Types/StatusPage/DefaultStatusNames.d.ts +11 -3
  117. package/Types/StatusPage/DefaultStatusNames.js +74 -28
  118. package/Types/StatusPage/DefaultStatusNames.mjs +9 -2
  119. package/Types/StatusPage/StateChangeNoteMessage.d.mts +3 -2
  120. package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
  121. package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
  122. package/Types/Telemetry/TelemetryIngestionKeyType.js +7 -6
  123. package/Types/Translator.d.mts +1 -0
  124. package/Types/Translator.d.ts +1 -0
  125. package/Types/Translator.js +100 -19
  126. package/Types/Translator.mjs +1 -0
  127. package/Types/UserSession/SessionLength.d.mts +33 -0
  128. package/Types/UserSession/SessionLength.d.ts +33 -0
  129. package/Types/UserSession/SessionLength.js +134 -5
  130. package/Types/UserSession/SessionLength.mjs +5 -0
  131. package/Types/Workflow/WorkflowStatus.js +21 -10
  132. package/Utils/AI/InvestigationReport.js +2 -2
  133. package/Utils/API.d.mts +0 -11
  134. package/Utils/API.d.ts +0 -11
  135. package/Utils/API.js +0 -432
  136. package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +2 -2
  137. package/Utils/AiRemediation/VerifiedFixRunbook.d.mts +39 -0
  138. package/Utils/AiRemediation/VerifiedFixRunbook.d.ts +39 -0
  139. package/Utils/AiRemediation/VerifiedFixRunbook.js +231 -0
  140. package/Utils/AiRemediation/VerifiedFixRunbook.mjs +10 -0
  141. package/Utils/Dashboard/DashboardWidgetSorts.js +11 -2
  142. package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +2 -1
  143. package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +2 -1
  144. package/Utils/Dashboard/MonitorListWidgetFormat.js +5 -3
  145. package/Utils/DefaultRecordNames.d.mts +6 -0
  146. package/Utils/DefaultRecordNames.d.ts +6 -0
  147. package/Utils/DefaultRecordNames.js +122 -0
  148. package/Utils/DefaultRecordNames.mjs +6 -0
  149. package/Utils/Grok/Grok.js +7 -4
  150. package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +20 -0
  151. package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +20 -0
  152. package/Utils/Incident/PostmortemActionItemCodeTask.js +107 -0
  153. package/Utils/Incident/PostmortemActionItemCodeTask.mjs +10 -0
  154. package/Utils/Incident/PostmortemActionItemMarkdown.d.mts +39 -0
  155. package/Utils/Incident/PostmortemActionItemMarkdown.d.ts +39 -0
  156. package/Utils/Incident/PostmortemActionItemMarkdown.js +118 -0
  157. package/Utils/Incident/PostmortemActionItemMarkdown.mjs +12 -0
  158. package/Utils/Incident/PostmortemNoteActionItems.d.mts +29 -0
  159. package/Utils/Incident/PostmortemNoteActionItems.d.ts +29 -0
  160. package/Utils/Incident/PostmortemNoteActionItems.js +544 -0
  161. package/Utils/Incident/PostmortemNoteActionItems.mjs +7 -0
  162. package/Utils/LookupTable.d.mts +3 -0
  163. package/Utils/LookupTable.d.ts +3 -0
  164. package/Utils/LookupTable.js +61 -0
  165. package/Utils/LookupTable.mjs +3 -0
  166. package/Utils/Markdown/LinkReferenceDefinitions.d.mts +2 -0
  167. package/Utils/Markdown/LinkReferenceDefinitions.d.ts +2 -0
  168. package/Utils/Markdown/LinkReferenceDefinitions.js +101 -1
  169. package/Utils/Markdown/LinkReferenceDefinitions.mjs +2 -0
  170. package/Utils/Markdown/OverLongText.js +296 -2
  171. package/Utils/Markdown/SlowMarkdown.d.mts +1 -0
  172. package/Utils/Markdown/SlowMarkdown.d.ts +1 -0
  173. package/Utils/Markdown/SlowMarkdown.js +354 -4
  174. package/Utils/Markdown/SlowMarkdown.mjs +1 -0
  175. package/Utils/Metrics/MetricFormulaEvaluator.js +10 -4
  176. package/Utils/Metrics/MetricSeriesFingerprint.js +13 -4
  177. package/Utils/Metrics/MetricSeriesScope.d.mts +5 -0
  178. package/Utils/Metrics/MetricSeriesScope.d.ts +5 -0
  179. package/Utils/Metrics/MetricSeriesScope.js +5 -1
  180. package/Utils/Monitor/MonitorRootCauseWording.d.mts +3 -0
  181. package/Utils/Monitor/MonitorRootCauseWording.d.ts +3 -0
  182. package/Utils/Monitor/MonitorRootCauseWording.js +100 -11
  183. package/Utils/Monitor/ProbeAgreementRule.d.mts +10 -0
  184. package/Utils/Monitor/ProbeAgreementRule.d.ts +10 -0
  185. package/Utils/Monitor/ProbeAgreementRule.js +58 -0
  186. package/Utils/Monitor/ProbeAgreementRule.mjs +3 -0
  187. package/Utils/Monitor/ProbeFailureReading.d.mts +4 -0
  188. package/Utils/Monitor/ProbeFailureReading.d.ts +4 -0
  189. package/Utils/Monitor/ProbeFailureReading.js +30 -1
  190. package/Utils/Monitor/ProbeFailureReading.mjs +1 -0
  191. package/Utils/Monitor/RequestFailureDescriptions.d.mts +61 -0
  192. package/Utils/Monitor/RequestFailureDescriptions.d.ts +61 -0
  193. package/Utils/Monitor/RequestFailureDescriptions.js +252 -0
  194. package/Utils/Monitor/RequestFailureDescriptions.mjs +6 -0
  195. package/Utils/PromQL/PromQLEngine.js +18 -9
  196. package/Utils/PromQL/PromQLFunctionEvaluators.js +114 -58
  197. package/Utils/PromQL/PromQLLabelOrder.d.mts +8 -0
  198. package/Utils/PromQL/PromQLLabelOrder.d.ts +8 -0
  199. package/Utils/PromQL/PromQLLabelOrder.js +212 -0
  200. package/Utils/PromQL/PromQLLabelOrder.mjs +6 -0
  201. package/Utils/PromQL/PromQLLabels.js +4 -3
  202. package/Utils/PromQL/PromQLMetricNames.js +8 -2
  203. package/Utils/PromQL/PromQLParser.js +11 -6
  204. package/Utils/PromQL/PromQLRegex.d.mts +11 -0
  205. package/Utils/PromQL/PromQLRegex.d.ts +11 -0
  206. package/Utils/PromQL/PromQLRegex.js +990 -50
  207. package/Utils/PromQL/PromQLRegex.mjs +3 -0
  208. package/Utils/PromQL/PrometheusResponse.js +3 -1
  209. package/Utils/PromQL/RE2CharacterClass.d.mts +24 -0
  210. package/Utils/PromQL/RE2CharacterClass.d.ts +24 -0
  211. package/Utils/PromQL/RE2CharacterClass.js +532 -0
  212. package/Utils/PromQL/RE2CharacterClass.mjs +16 -0
  213. package/Utils/RequestFailedDetailsUtil.d.mts +15 -0
  214. package/Utils/RequestFailedDetailsUtil.d.ts +15 -0
  215. package/Utils/RequestFailedDetailsUtil.js +452 -0
  216. package/Utils/RequestFailedDetailsUtil.mjs +2 -0
  217. package/Utils/Rum/UrlScrubber.d.mts +1 -1
  218. package/Utils/Rum/UrlScrubber.d.ts +1 -1
  219. package/Utils/Rum/UrlScrubber.js +10 -4
  220. package/Utils/Rum/UserFlow.js +22 -4
  221. package/Utils/SecurityCase/SecurityOverviewMetrics.d.mts +11 -1
  222. package/Utils/SecurityCase/SecurityOverviewMetrics.d.ts +11 -1
  223. package/Utils/SecurityCase/SecurityOverviewMetrics.js +99 -17
  224. package/Utils/SecurityCase/SecurityOverviewMetrics.mjs +3 -0
  225. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  226. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  227. package/Utils/Sms/OnCallPageSms.js +3 -1
  228. package/Utils/StateListType.d.mts +11 -0
  229. package/Utils/StateListType.d.ts +11 -0
  230. package/Utils/StateListType.js +21 -0
  231. package/Utils/StateListType.mjs +2 -0
  232. package/Utils/StateOrder.d.mts +8 -11
  233. package/Utils/StateOrder.d.ts +8 -11
  234. package/Utils/StateOrder.js +49 -84
  235. package/Utils/StateOrder.mjs +2 -0
  236. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.mts +9 -0
  237. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.ts +9 -0
  238. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.js +25 -0
  239. package/Utils/Suggestions/ActionItemCodeTaskSuggestion.mjs +2 -0
  240. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.mts +5 -0
  241. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.ts +5 -0
  242. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.js +39 -0
  243. package/Utils/Suggestions/VerifiedFixRunbookSuggestion.mjs +2 -0
  244. package/Utils/Syslog/SyslogMessageParser.js +16 -6
  245. package/Utils/Telemetry/HeartbeatAvailability.js +16 -21
  246. package/Utils/ValueFormatter.d.mts +1 -0
  247. package/Utils/ValueFormatter.d.ts +1 -0
  248. package/Utils/ValueFormatter.js +258 -18
  249. package/package.json +1 -1
@@ -4,33 +4,109 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.utcDay = utcDay;
7
+ exports.dayInTimezone = dayInTimezone;
8
+ exports.calendarDaysBetween = calendarDaysBetween;
7
9
  exports.daysBetween = daysBetween;
10
+ exports.findCalendarDay = findCalendarDay;
8
11
  exports.computeSecurityOverviewMetrics = computeSecurityOverviewMetrics;
9
12
  exports.formatDurationInMinutes = formatDurationInMinutes;
10
13
  const SecurityCasePriorities_1 = __importDefault(require("./SecurityCasePriorities"));
11
14
  const SecurityCaseStatuses_1 = __importDefault(require("./SecurityCaseStatuses"));
15
+ const AggregationInterval_1 = __importDefault(require("../../Types/BaseDatabase/AggregationInterval"));
16
+ const AggregationIntervalUtil_1 = __importDefault(require("../../Types/BaseDatabase/AggregationIntervalUtil"));
17
+ const Date_1 = __importDefault(require("../../Types/Date"));
12
18
  const SecurityCaseVerdict_1 = __importDefault(require("../../Types/SecurityCase/SecurityCaseVerdict"));
13
19
  const SecurityDetectionSource_1 = require("../../Types/SecurityCase/SecurityDetectionSource");
20
+ const Timezone_1 = __importDefault(require("../../Types/Timezone"));
21
+ const TimezoneAlias_1 = __importDefault(require("../../Types/TimezoneAlias"));
14
22
  const MINUTE_IN_MS = 60 * 1000;
15
23
  function utcDay(date) {
16
24
  return date.toISOString().slice(0, 10);
17
25
  }
18
- // Every UTC day from the day of `start` to the day of `end`, oldest first.
19
- function daysBetween(start, end) {
26
+ // The zone the days are cut in, by its current name: UTC when none is given.
27
+ function calendarZoneOf(timezone) {
28
+ return timezone ? TimezoneAlias_1.default.getCanonicalTimezone(timezone) : Timezone_1.default.UTC;
29
+ }
30
+ /*
31
+ * The day `date` falls on in `timezone`, as YYYY-MM-DD: the reader's own day
32
+ * where the overview was asked in their zone, the UTC day where it was not.
33
+ * In New York a case opened at 20:00 on 4 November is on 4 November, not on
34
+ * the 5th, which is the UTC day it falls on.
35
+ */
36
+ function dayInTimezone(date, timezone) {
37
+ if (!timezone) {
38
+ return utcDay(date);
39
+ }
40
+ return Date_1.default.getDateAsCustomFormattedStringInTimezone({
41
+ date: date,
42
+ format: "YYYY-MM-DD",
43
+ timezone: calendarZoneOf(timezone),
44
+ });
45
+ }
46
+ /*
47
+ * Every day from the one `start` falls on to the one `end` falls on, in
48
+ * `timezone` (UTC's when none is given), oldest first, with the instants
49
+ * each starts and ends at. Each day starts where the one before it ends
50
+ * (AggregationIntervalUtil.getBucketEnd, as the server's day buckets are
51
+ * walked): 23 or 25 hours on where the clocks change, so no day is drawn
52
+ * twice, and none is skipped.
53
+ */
54
+ function calendarDaysBetween(start, end, timezone) {
55
+ const zone = calendarZoneOf(timezone);
20
56
  const days = [];
21
- const cursor = new Date(Date.UTC(start.getUTCFullYear(), start.getUTCMonth(), start.getUTCDate()));
22
- const last = utcDay(end);
57
+ const lastMs = end.getTime();
58
+ let startMs = Date_1.default.getStartOfDay(start, zone).getTime();
23
59
  // Bounded: a window is never more than a year of days.
24
- for (let index = 0; index < 400; index++) {
25
- const day = utcDay(cursor);
26
- days.push(day);
27
- if (day >= last) {
60
+ for (let index = 0; index < 400 && Number.isFinite(startMs); index++) {
61
+ const endMs = AggregationIntervalUtil_1.default.getBucketEnd({
62
+ bucketStart: new Date(startMs),
63
+ interval: AggregationInterval_1.default.Day,
64
+ timezone: zone,
65
+ }).getTime();
66
+ days.push({
67
+ day: dayInTimezone(new Date(startMs), zone),
68
+ startMs: startMs,
69
+ endMs: endMs,
70
+ });
71
+ if (!(endMs <= lastMs)) {
28
72
  break;
29
73
  }
30
- cursor.setUTCDate(cursor.getUTCDate() + 1);
74
+ startMs = endMs;
31
75
  }
32
76
  return days;
33
77
  }
78
+ /*
79
+ * Every day from the day of `start` to the day of `end`, oldest first: the
80
+ * reader's days in `timezone`, UTC's when none is given.
81
+ */
82
+ function daysBetween(start, end, timezone) {
83
+ return calendarDaysBetween(start, end, timezone).map((day) => {
84
+ return day.day;
85
+ });
86
+ }
87
+ /*
88
+ * The day of `days` (oldest first, one after another) that `date` falls in,
89
+ * or undefined when it is before the first or from the end of the last.
90
+ */
91
+ function findCalendarDay(days, date) {
92
+ const ms = new Date(date).getTime();
93
+ let low = 0;
94
+ let high = days.length - 1;
95
+ while (low <= high) {
96
+ const middle = Math.floor((low + high) / 2);
97
+ const day = days[middle];
98
+ if (ms < day.startMs) {
99
+ high = middle - 1;
100
+ }
101
+ else if (ms >= day.endMs) {
102
+ low = middle + 1;
103
+ }
104
+ else {
105
+ return day;
106
+ }
107
+ }
108
+ return undefined;
109
+ }
34
110
  function emptyCounts(keys) {
35
111
  const counts = {};
36
112
  for (const key of keys) {
@@ -103,9 +179,9 @@ function computeSecurityOverviewMetrics(data) {
103
179
  }
104
180
  }
105
181
  }
106
- const caseDays = daysBetween(data.windowStart, data.now);
182
+ const caseDays = calendarDaysBetween(data.windowStart, data.now, data.timezone);
107
183
  const casesPerDay = new Map();
108
- for (const day of caseDays) {
184
+ for (const { day } of caseDays) {
109
185
  casesPerDay.set(day, {
110
186
  day,
111
187
  total: 0,
@@ -114,7 +190,10 @@ function computeSecurityOverviewMetrics(data) {
114
190
  }
115
191
  const tacticCounts = new Map();
116
192
  for (const row of data.casesInWindow) {
117
- const bucket = casesPerDay.get(utcDay(new Date(row.createdAt)));
193
+ const openedOn = findCalendarDay(caseDays, new Date(row.createdAt));
194
+ const bucket = openedOn
195
+ ? casesPerDay.get(openedOn.day)
196
+ : undefined;
118
197
  if (bucket) {
119
198
  bucket.total++;
120
199
  if (row.priorityId && bucket.byKey[row.priorityId] !== undefined) {
@@ -125,9 +204,9 @@ function computeSecurityOverviewMetrics(data) {
125
204
  tacticCounts.set(tactic, (tacticCounts.get(tactic) || 0) + 1);
126
205
  }
127
206
  }
128
- const detectionDays = daysBetween(data.detectionWindowStart, data.now);
207
+ const detectionDays = calendarDaysBetween(data.detectionWindowStart, data.now, data.timezone);
129
208
  const detectionsPerDay = new Map();
130
- for (const day of detectionDays) {
209
+ for (const { day } of detectionDays) {
131
210
  detectionsPerDay.set(day, {
132
211
  day,
133
212
  total: 0,
@@ -136,7 +215,10 @@ function computeSecurityOverviewMetrics(data) {
136
215
  }
137
216
  const ruleCounts = new Map();
138
217
  for (const row of data.detectionsInWindow) {
139
- const bucket = detectionsPerDay.get(utcDay(new Date(row.firstSeenAt)));
218
+ const firstSeenOn = findCalendarDay(detectionDays, new Date(row.firstSeenAt));
219
+ const bucket = firstSeenOn
220
+ ? detectionsPerDay.get(firstSeenOn.day)
221
+ : undefined;
140
222
  if (bucket) {
141
223
  bucket.total++;
142
224
  if (row.source && bucket.byKey[row.source] !== undefined) {
@@ -178,10 +260,10 @@ function computeSecurityOverviewMetrics(data) {
178
260
  meanTimeToCloseInMinutes: meanMinutes(durationsTo(data.casesInWindow, (row) => {
179
261
  return row.closedAt;
180
262
  })),
181
- casesOpenedPerDay: caseDays.map((day) => {
263
+ casesOpenedPerDay: caseDays.map(({ day }) => {
182
264
  return casesPerDay.get(day);
183
265
  }),
184
- detectionsPerDay: detectionDays.map((day) => {
266
+ detectionsPerDay: detectionDays.map(({ day }) => {
185
267
  return detectionsPerDay.get(day);
186
268
  }),
187
269
  detectionsInWindow: data.detectionsInWindow.length,
@@ -1,5 +1,8 @@
1
1
  import commonJsModule from "./SecurityOverviewMetrics.js";
2
+ export const calendarDaysBetween = commonJsModule.calendarDaysBetween;
2
3
  export const computeSecurityOverviewMetrics = commonJsModule.computeSecurityOverviewMetrics;
4
+ export const dayInTimezone = commonJsModule.dayInTimezone;
3
5
  export const daysBetween = commonJsModule.daysBetween;
6
+ export const findCalendarDay = commonJsModule.findCalendarDay;
4
7
  export const formatDurationInMinutes = commonJsModule.formatDurationInMinutes;
5
8
  export const utcDay = commonJsModule.utcDay;
@@ -22,6 +22,7 @@ export interface OnCallPageSmsLanguage {
22
22
  projectName: string;
23
23
  isPageAgain: boolean;
24
24
  lead: string;
25
+ isPolicyLead?: boolean | undefined;
25
26
  }) => string;
26
27
  action: string;
27
28
  observerLead: string;
@@ -37,6 +38,7 @@ export interface OnCallPageSmsInput {
37
38
  link: string;
38
39
  isPageAgain?: boolean | undefined;
39
40
  lead?: string | null | undefined;
41
+ isPolicyLead?: boolean | undefined;
40
42
  isObserverPage?: boolean | undefined;
41
43
  sentAs?: ((text: string) => string) | undefined;
42
44
  language?: OnCallPageSmsLanguage | undefined;
@@ -22,6 +22,7 @@ export interface OnCallPageSmsLanguage {
22
22
  projectName: string;
23
23
  isPageAgain: boolean;
24
24
  lead: string;
25
+ isPolicyLead?: boolean | undefined;
25
26
  }) => string;
26
27
  action: string;
27
28
  observerLead: string;
@@ -37,6 +38,7 @@ export interface OnCallPageSmsInput {
37
38
  link: string;
38
39
  isPageAgain?: boolean | undefined;
39
40
  lead?: string | null | undefined;
41
+ isPolicyLead?: boolean | undefined;
40
42
  isObserverPage?: boolean | undefined;
41
43
  sentAs?: ((text: string) => string) | undefined;
42
44
  language?: OnCallPageSmsLanguage | undefined;
@@ -198,7 +198,7 @@ const compose = (parts, options) => {
198
198
  return composeInLanguage(parts, parts.language, options);
199
199
  }
200
200
  let head = parts.lead
201
- ? `${parts.productName}: ${parts.lead} about ${parts.what}`
201
+ ? `${parts.productName}: ${parts.lead} ${parts.isPolicyLead ? "for" : "about"} ${parts.what}`
202
202
  : parts.isObserverPage
203
203
  ? `${parts.productName} ${OnCallObserverPage_1.ON_CALL_OBSERVER_PAGE_SMS_LEAD}: ${parts.what}`
204
204
  : `${parts.productName}: ${parts.what}`;
@@ -253,6 +253,7 @@ const composeInLanguage = (parts, language, options) => {
253
253
  projectName: options.withProject ? parts.projectName : "",
254
254
  isPageAgain: parts.isPageAgain,
255
255
  lead: parts.lead,
256
+ isPolicyLead: parts.isPolicyLead,
256
257
  }))}`;
257
258
  if (options.title) {
258
259
  sentence += `: ${options.title}`;
@@ -340,6 +341,7 @@ const buildOnCallPageSms = (input) => {
340
341
  link: input.link.trim(),
341
342
  isPageAgain: input.isPageAgain === true,
342
343
  lead: toValue(input.lead),
344
+ isPolicyLead: input.isPolicyLead === true && Boolean(toValue(input.lead)),
343
345
  isObserverPage: input.isObserverPage === true,
344
346
  language: input.language,
345
347
  writesWordsInGsm7: Boolean(input.language) && !isWrittenInUcs2,
@@ -0,0 +1,11 @@
1
+ export declare enum StateListType {
2
+ IncidentState = "IncidentState",
3
+ AlertState = "AlertState",
4
+ ScheduledMaintenanceState = "ScheduledMaintenanceState",
5
+ MonitorStatus = "MonitorStatus",
6
+ IncidentSeverity = "IncidentSeverity",
7
+ AlertSeverity = "AlertSeverity",
8
+ IncidentPostmortemStatus = "IncidentPostmortemStatus",
9
+ SecurityCaseStatus = "SecurityCaseStatus",
10
+ SecurityCasePriority = "SecurityCasePriority"
11
+ }
@@ -0,0 +1,11 @@
1
+ export declare enum StateListType {
2
+ IncidentState = "IncidentState",
3
+ AlertState = "AlertState",
4
+ ScheduledMaintenanceState = "ScheduledMaintenanceState",
5
+ MonitorStatus = "MonitorStatus",
6
+ IncidentSeverity = "IncidentSeverity",
7
+ AlertSeverity = "AlertSeverity",
8
+ IncidentPostmortemStatus = "IncidentPostmortemStatus",
9
+ SecurityCaseStatus = "SecurityCaseStatus",
10
+ SecurityCasePriority = "SecurityCasePriority"
11
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StateListType = void 0;
4
+ /*
5
+ * The lists a project orders (Utils/StateOrder), each by its records'
6
+ * table. A module of its own, so what only names a list - DefaultRecordNames,
7
+ * which every form loads, sign-in and sign-up pages included - loads none of
8
+ * StateOrder's lists and rules with it.
9
+ */
10
+ var StateListType;
11
+ (function (StateListType) {
12
+ StateListType["IncidentState"] = "IncidentState";
13
+ StateListType["AlertState"] = "AlertState";
14
+ StateListType["ScheduledMaintenanceState"] = "ScheduledMaintenanceState";
15
+ StateListType["MonitorStatus"] = "MonitorStatus";
16
+ StateListType["IncidentSeverity"] = "IncidentSeverity";
17
+ StateListType["AlertSeverity"] = "AlertSeverity";
18
+ StateListType["IncidentPostmortemStatus"] = "IncidentPostmortemStatus";
19
+ StateListType["SecurityCaseStatus"] = "SecurityCaseStatus";
20
+ StateListType["SecurityCasePriority"] = "SecurityCasePriority";
21
+ })(StateListType || (exports.StateListType = StateListType = {}));
@@ -0,0 +1,2 @@
1
+ import commonJsModule from "./StateListType.js";
2
+ export const StateListType = commonJsModule.StateListType;
@@ -1,14 +1,5 @@
1
- export declare enum StateListType {
2
- IncidentState = "IncidentState",
3
- AlertState = "AlertState",
4
- ScheduledMaintenanceState = "ScheduledMaintenanceState",
5
- MonitorStatus = "MonitorStatus",
6
- IncidentSeverity = "IncidentSeverity",
7
- AlertSeverity = "AlertSeverity",
8
- IncidentPostmortemStatus = "IncidentPostmortemStatus",
9
- SecurityCaseStatus = "SecurityCaseStatus",
10
- SecurityCasePriority = "SecurityCasePriority"
11
- }
1
+ import { StateListType } from "./StateListType.mjs";
2
+ export { StateListType };
12
3
  export interface StateListBuiltIn {
13
4
  flag: string;
14
5
  role: string;
@@ -24,8 +15,14 @@ export interface StateListDefinition {
24
15
  keepsBuiltInOrder: boolean;
25
16
  insertAboveFlag?: string | undefined;
26
17
  orderReason?: string | undefined;
18
+ worstAt: StateListEnd;
19
+ }
20
+ export declare enum StateListEnd {
21
+ Top = "Top",
22
+ Bottom = "Bottom"
27
23
  }
28
24
  export declare const STATE_LISTS: Record<StateListType, StateListDefinition>;
25
+ export declare const getStateListOfTable: (tableName: string | null | undefined) => StateListDefinition | null;
29
26
  export interface StateListRow {
30
27
  id: string;
31
28
  name: string;
@@ -1,14 +1,5 @@
1
- export declare enum StateListType {
2
- IncidentState = "IncidentState",
3
- AlertState = "AlertState",
4
- ScheduledMaintenanceState = "ScheduledMaintenanceState",
5
- MonitorStatus = "MonitorStatus",
6
- IncidentSeverity = "IncidentSeverity",
7
- AlertSeverity = "AlertSeverity",
8
- IncidentPostmortemStatus = "IncidentPostmortemStatus",
9
- SecurityCaseStatus = "SecurityCaseStatus",
10
- SecurityCasePriority = "SecurityCasePriority"
11
- }
1
+ import { StateListType } from "./StateListType";
2
+ export { StateListType };
12
3
  export interface StateListBuiltIn {
13
4
  flag: string;
14
5
  role: string;
@@ -24,8 +15,14 @@ export interface StateListDefinition {
24
15
  keepsBuiltInOrder: boolean;
25
16
  insertAboveFlag?: string | undefined;
26
17
  orderReason?: string | undefined;
18
+ worstAt: StateListEnd;
19
+ }
20
+ export declare enum StateListEnd {
21
+ Top = "Top",
22
+ Bottom = "Bottom"
27
23
  }
28
24
  export declare const STATE_LISTS: Record<StateListType, StateListDefinition>;
25
+ export declare const getStateListOfTable: (tableName: string | null | undefined) => StateListDefinition | null;
29
26
  export interface StateListRow {
30
27
  id: string;
31
28
  name: string;
@@ -3,98 +3,43 @@ 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.getStateListDeleteRefusalMessage = exports.getStateListOrderViolationMessage = exports.getStateListDeleteRefusal = exports.getStateListInsertValue = exports.getStateListRowsAfterCreate = exports.getStateListRowsAfterMove = exports.getStateListOrderViolationIntroduced = exports.getStateListOrderViolation = exports.isStateListRowAfter = exports.getStateListReachedBuiltIn = exports.getStateListBuiltInRows = exports.getStateListBuiltIn = exports.sortStateListRows = exports.toStateListRow = exports.STATE_LISTS = exports.StateListType = void 0;
6
+ exports.getStateListDeleteRefusalMessage = exports.getStateListOrderViolationMessage = exports.getStateListDeleteRefusal = exports.getStateListInsertValue = exports.getStateListRowsAfterCreate = exports.getStateListRowsAfterMove = exports.getStateListOrderViolationIntroduced = exports.getStateListOrderViolation = exports.isStateListRowAfter = exports.getStateListReachedBuiltIn = exports.getStateListBuiltInRows = exports.getStateListBuiltIn = exports.sortStateListRows = exports.toStateListRow = exports.getStateListOfTable = exports.STATE_LISTS = exports.StateListEnd = exports.StateListType = void 0;
7
7
  const SortOrder_1 = __importDefault(require("../Types/BaseDatabase/SortOrder"));
8
8
  const ListOrder_1 = require("./ListOrder");
9
- /*
10
- * What the order of a project's states, severities, monitor statuses,
11
- * postmortem statuses and security case statuses and priorities means, and
12
- * what it has to keep. No database and no React in it, so the server that
13
- * guards these lists and the settings pages that show them read the same
14
- * rules.
15
- *
16
- * All nine are drag-ordered lists (@ListOrderColumn, Common/Utils/ListOrder):
17
- * 1 is the top. On top of that:
18
- *
19
- * - Incident, alert and scheduled maintenance states are a path. An
20
- * incident, an alert, an episode or a maintenance event only ever moves
21
- * down its list (every state timeline refuses a move back up, by the one
22
- * rule in Common/Utils/StateMove), and the built-in states mark the
23
- * points that mean something: a state at or below the acknowledged one
24
- * counts as acknowledged (on-call stops escalating), at or below the
25
- * resolved one as resolved. So the built-in states have to stay in their
26
- * order - Resolved above Acknowledged would page nobody and resolve
27
- * nothing - and a new state goes just above the state that closes the
28
- * list, never after it, where it would quietly count as resolved.
29
- * - Monitor statuses run from the healthiest to the worst: where monitors
30
- * are shown together (a status page, a monitor group) the lowest one in
31
- * the list wins. A new status goes just above the offline one, so that
32
- * an outage still shows as an outage.
33
- * - Severities are ranked, most severe first. Any order goes, and a new
34
- * one goes to the end.
35
- * - Postmortem statuses are how far an incident's postmortem has come: not
36
- * started, then a draft, then completed. A status at or below the
37
- * completed one counts as done - the postmortem is no longer owed - so a
38
- * project's own "Not Needed" goes after it, and a new status goes just
39
- * above it, where it counts as in progress ("In Review"). Unlike a
40
- * state, a postmortem can move back up (reopened for another look); the
41
- * order only says what each status counts as
42
- * (Common/Utils/Incident/PostmortemStatus).
43
- * - Security case statuses are how far a case has come: new, taken on
44
- * (acknowledged), contained, closed. A status at or below the
45
- * acknowledged one counts as acknowledged, at or below the contained one
46
- * as contained, at or below the closed one as closed - a project's own
47
- * "Closed - Duplicate" goes after it - so the four built-in statuses keep
48
- * that order, and a new status goes just above the closed one. Like a
49
- * postmortem, a case can move back up (reopened); the order only says
50
- * what each status counts as (Common/Utils/SecurityCase/
51
- * SecurityCaseStatuses).
52
- * - Security case priorities are ranked, most urgent first, like
53
- * severities, but five of them are built in: the priorities a Critical,
54
- * High, Medium, Low and Informational detection opens its case at. They
55
- * keep that order, so a more severe detection never lands lower, and
56
- * the project's own go anywhere among them; a new one goes to the end
57
- * (Common/Utils/SecurityCase/SecurityCasePriorities).
58
- * - Every built-in row (the created, acknowledged and resolved states, the
59
- * operational and offline statuses...) is something OneUptime itself
60
- * moves things into, so a list keeps at least one of each kind.
61
- */
62
- var StateListType;
63
- (function (StateListType) {
64
- StateListType["IncidentState"] = "IncidentState";
65
- StateListType["AlertState"] = "AlertState";
66
- StateListType["ScheduledMaintenanceState"] = "ScheduledMaintenanceState";
67
- StateListType["MonitorStatus"] = "MonitorStatus";
68
- StateListType["IncidentSeverity"] = "IncidentSeverity";
69
- StateListType["AlertSeverity"] = "AlertSeverity";
70
- StateListType["IncidentPostmortemStatus"] = "IncidentPostmortemStatus";
71
- StateListType["SecurityCaseStatus"] = "SecurityCaseStatus";
72
- StateListType["SecurityCasePriority"] = "SecurityCasePriority";
73
- })(StateListType || (exports.StateListType = StateListType = {}));
9
+ const StateListType_1 = require("./StateListType");
10
+ Object.defineProperty(exports, "StateListType", { enumerable: true, get: function () { return StateListType_1.StateListType; } });
11
+ // An end of a project's list: the top (1) or the bottom.
12
+ var StateListEnd;
13
+ (function (StateListEnd) {
14
+ StateListEnd["Top"] = "Top";
15
+ StateListEnd["Bottom"] = "Bottom";
16
+ })(StateListEnd || (exports.StateListEnd = StateListEnd = {}));
74
17
  const INCIDENT_AND_ALERT_STATE_BUILT_INS = [
75
18
  { flag: "isCreatedState", role: "created state" },
76
19
  { flag: "isAcknowledgedState", role: "acknowledged state" },
77
20
  { flag: "isResolvedState", role: "resolved state" },
78
21
  ];
79
22
  exports.STATE_LISTS = {
80
- [StateListType.IncidentState]: {
81
- type: StateListType.IncidentState,
23
+ [StateListType_1.StateListType.IncidentState]: {
24
+ type: StateListType_1.StateListType.IncidentState,
82
25
  orderColumn: "order",
83
26
  subject: { singular: "incident", plural: "incidents" },
84
27
  builtIns: INCIDENT_AND_ALERT_STATE_BUILT_INS,
85
28
  keepsBuiltInOrder: true,
86
29
  insertAboveFlag: "isResolvedState",
30
+ worstAt: StateListEnd.Top,
87
31
  },
88
- [StateListType.AlertState]: {
89
- type: StateListType.AlertState,
32
+ [StateListType_1.StateListType.AlertState]: {
33
+ type: StateListType_1.StateListType.AlertState,
90
34
  orderColumn: "order",
91
35
  subject: { singular: "alert", plural: "alerts" },
92
36
  builtIns: INCIDENT_AND_ALERT_STATE_BUILT_INS,
93
37
  keepsBuiltInOrder: true,
94
38
  insertAboveFlag: "isResolvedState",
39
+ worstAt: StateListEnd.Top,
95
40
  },
96
- [StateListType.ScheduledMaintenanceState]: {
97
- type: StateListType.ScheduledMaintenanceState,
41
+ [StateListType_1.StateListType.ScheduledMaintenanceState]: {
42
+ type: StateListType_1.StateListType.ScheduledMaintenanceState,
98
43
  orderColumn: "order",
99
44
  subject: { singular: "maintenance event", plural: "maintenance events" },
100
45
  builtIns: [
@@ -105,9 +50,10 @@ exports.STATE_LISTS = {
105
50
  ],
106
51
  keepsBuiltInOrder: true,
107
52
  insertAboveFlag: "isResolvedState",
53
+ worstAt: StateListEnd.Top,
108
54
  },
109
- [StateListType.MonitorStatus]: {
110
- type: StateListType.MonitorStatus,
55
+ [StateListType_1.StateListType.MonitorStatus]: {
56
+ type: StateListType_1.StateListType.MonitorStatus,
111
57
  orderColumn: "priority",
112
58
  subject: { singular: "monitor", plural: "monitors" },
113
59
  builtIns: [
@@ -116,23 +62,26 @@ exports.STATE_LISTS = {
116
62
  ],
117
63
  keepsBuiltInOrder: false,
118
64
  insertAboveFlag: "isOfflineState",
65
+ worstAt: StateListEnd.Bottom,
119
66
  },
120
- [StateListType.IncidentSeverity]: {
121
- type: StateListType.IncidentSeverity,
67
+ [StateListType_1.StateListType.IncidentSeverity]: {
68
+ type: StateListType_1.StateListType.IncidentSeverity,
122
69
  orderColumn: "order",
123
70
  subject: { singular: "incident", plural: "incidents" },
124
71
  builtIns: [],
125
72
  keepsBuiltInOrder: false,
73
+ worstAt: StateListEnd.Top,
126
74
  },
127
- [StateListType.AlertSeverity]: {
128
- type: StateListType.AlertSeverity,
75
+ [StateListType_1.StateListType.AlertSeverity]: {
76
+ type: StateListType_1.StateListType.AlertSeverity,
129
77
  orderColumn: "order",
130
78
  subject: { singular: "alert", plural: "alerts" },
131
79
  builtIns: [],
132
80
  keepsBuiltInOrder: false,
81
+ worstAt: StateListEnd.Top,
133
82
  },
134
- [StateListType.IncidentPostmortemStatus]: {
135
- type: StateListType.IncidentPostmortemStatus,
83
+ [StateListType_1.StateListType.IncidentPostmortemStatus]: {
84
+ type: StateListType_1.StateListType.IncidentPostmortemStatus,
136
85
  orderColumn: "order",
137
86
  subject: { singular: "postmortem", plural: "postmortems" },
138
87
  builtIns: [
@@ -143,9 +92,10 @@ exports.STATE_LISTS = {
143
92
  keepsBuiltInOrder: true,
144
93
  insertAboveFlag: "isCompletedStatus",
145
94
  orderReason: "A postmortem is started, drafted and then completed",
95
+ worstAt: StateListEnd.Top,
146
96
  },
147
- [StateListType.SecurityCaseStatus]: {
148
- type: StateListType.SecurityCaseStatus,
97
+ [StateListType_1.StateListType.SecurityCaseStatus]: {
98
+ type: StateListType_1.StateListType.SecurityCaseStatus,
149
99
  orderColumn: "order",
150
100
  subject: { singular: "security case", plural: "security cases" },
151
101
  builtIns: [
@@ -157,9 +107,10 @@ exports.STATE_LISTS = {
157
107
  keepsBuiltInOrder: true,
158
108
  insertAboveFlag: "isClosedStatus",
159
109
  orderReason: "A case is opened, taken on, contained and then closed",
110
+ worstAt: StateListEnd.Top,
160
111
  },
161
- [StateListType.SecurityCasePriority]: {
162
- type: StateListType.SecurityCasePriority,
112
+ [StateListType_1.StateListType.SecurityCasePriority]: {
113
+ type: StateListType_1.StateListType.SecurityCasePriority,
163
114
  orderColumn: "order",
164
115
  subject: { singular: "security case", plural: "security cases" },
165
116
  builtIns: [
@@ -171,8 +122,22 @@ exports.STATE_LISTS = {
171
122
  ],
172
123
  keepsBuiltInOrder: true,
173
124
  orderReason: "Priorities are ranked most urgent first, and detections open their cases at the built-in priority of their severity",
125
+ worstAt: StateListEnd.Top,
174
126
  },
175
127
  };
128
+ /*
129
+ * The list a model's records make up, when they are one of these: its
130
+ * tableName is the list's type (IncidentSeverity, MonitorStatus). Null for
131
+ * any other model.
132
+ */
133
+ const getStateListOfTable = (tableName) => {
134
+ if (!tableName ||
135
+ !Object.prototype.hasOwnProperty.call(exports.STATE_LISTS, tableName)) {
136
+ return null;
137
+ }
138
+ return exports.STATE_LISTS[tableName];
139
+ };
140
+ exports.getStateListOfTable = getStateListOfTable;
176
141
  const toIdString = (value) => {
177
142
  if (value === null || value === undefined) {
178
143
  return "";
@@ -1,11 +1,13 @@
1
1
  import commonJsModule from "./StateOrder.js";
2
2
  export const STATE_LISTS = commonJsModule.STATE_LISTS;
3
+ export const StateListEnd = commonJsModule.StateListEnd;
3
4
  export const StateListType = commonJsModule.StateListType;
4
5
  export const getStateListBuiltIn = commonJsModule.getStateListBuiltIn;
5
6
  export const getStateListBuiltInRows = commonJsModule.getStateListBuiltInRows;
6
7
  export const getStateListDeleteRefusal = commonJsModule.getStateListDeleteRefusal;
7
8
  export const getStateListDeleteRefusalMessage = commonJsModule.getStateListDeleteRefusalMessage;
8
9
  export const getStateListInsertValue = commonJsModule.getStateListInsertValue;
10
+ export const getStateListOfTable = commonJsModule.getStateListOfTable;
9
11
  export const getStateListOrderViolation = commonJsModule.getStateListOrderViolation;
10
12
  export const getStateListOrderViolationIntroduced = commonJsModule.getStateListOrderViolationIntroduced;
11
13
  export const getStateListOrderViolationMessage = commonJsModule.getStateListOrderViolationMessage;
@@ -0,0 +1,9 @@
1
+ import { CodeTaskStage } from "../../Types/AI/CodeTaskStage.mjs";
2
+ import SuggestionOffer from "./SuggestionOffer.mjs";
3
+ export interface ActionItemCodeTaskOfferInput {
4
+ isAiEnabled: boolean;
5
+ isOpen: boolean;
6
+ taskStage: CodeTaskStage | null;
7
+ hasConnectedRepository: boolean;
8
+ }
9
+ export declare function getActionItemCodeTaskOffer(input: ActionItemCodeTaskOfferInput): SuggestionOffer;
@@ -0,0 +1,9 @@
1
+ import { CodeTaskStage } from "../../Types/AI/CodeTaskStage";
2
+ import SuggestionOffer from "./SuggestionOffer";
3
+ export interface ActionItemCodeTaskOfferInput {
4
+ isAiEnabled: boolean;
5
+ isOpen: boolean;
6
+ taskStage: CodeTaskStage | null;
7
+ hasConnectedRepository: boolean;
8
+ }
9
+ export declare function getActionItemCodeTaskOffer(input: ActionItemCodeTaskOfferInput): SuggestionOffer;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActionItemCodeTaskOffer = getActionItemCodeTaskOffer;
4
+ const CodeTaskStage_1 = require("../../Types/AI/CodeTaskStage");
5
+ const CodeFixSuggestion_1 = require("./CodeFixSuggestion");
6
+ const FINISHED_STAGES = [
7
+ CodeTaskStage_1.CodeTaskStage.PullRequestOpen,
8
+ CodeTaskStage_1.CodeTaskStage.Merged,
9
+ CodeTaskStage_1.CodeTaskStage.Done,
10
+ ];
11
+ const MOVING_STAGES = [
12
+ CodeTaskStage_1.CodeTaskStage.Queued,
13
+ CodeTaskStage_1.CodeTaskStage.Working,
14
+ CodeTaskStage_1.CodeTaskStage.Retrying,
15
+ ];
16
+ function getActionItemCodeTaskOffer(input) {
17
+ return (0, CodeFixSuggestion_1.getCodeFixOffer)({
18
+ isAiEnabled: input.isAiEnabled,
19
+ applies: input.isOpen,
20
+ hasActiveFix: Boolean(input.taskStage && MOVING_STAGES.includes(input.taskStage)),
21
+ hasFinishedFix: Boolean(input.taskStage && FINISHED_STAGES.includes(input.taskStage)),
22
+ hasConnectedRepository: input.hasConnectedRepository,
23
+ isBackedByEvidence: true,
24
+ });
25
+ }
@@ -0,0 +1,2 @@
1
+ import commonJsModule from "./ActionItemCodeTaskSuggestion.js";
2
+ export const getActionItemCodeTaskOffer = commonJsModule.getActionItemCodeTaskOffer;
@@ -0,0 +1,5 @@
1
+ import { VerifiedFixRunbookInput } from "../AiRemediation/VerifiedFixRunbook.mjs";
2
+ import SuggestionOffer from "./SuggestionOffer.mjs";
3
+ export declare function getVerifiedFixRunbookOffer(input: VerifiedFixRunbookInput & {
4
+ mayCreateRunbook: boolean;
5
+ }): SuggestionOffer;
@@ -0,0 +1,5 @@
1
+ import { VerifiedFixRunbookInput } from "../AiRemediation/VerifiedFixRunbook";
2
+ import SuggestionOffer from "./SuggestionOffer";
3
+ export declare function getVerifiedFixRunbookOffer(input: VerifiedFixRunbookInput & {
4
+ mayCreateRunbook: boolean;
5
+ }): SuggestionOffer;