@oneuptime/common 14.0.91 → 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 (174) 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/AutoRemediationRule.js +1 -1
  6. package/Models/DatabaseModels/CodeRepository.d.mts +1 -0
  7. package/Models/DatabaseModels/CodeRepository.d.ts +1 -0
  8. package/Models/DatabaseModels/CodeRepository.js +69 -6
  9. package/Models/DatabaseModels/IncidentEpisodeMember.d.mts +1 -0
  10. package/Models/DatabaseModels/IncidentEpisodeMember.d.ts +1 -0
  11. package/Models/DatabaseModels/IncidentEpisodeMember.js +50 -0
  12. package/Models/DatabaseModels/IncomingCallPolicy.js +1 -1
  13. package/Models/DatabaseModels/LlmProvider.js +1 -1
  14. package/Models/DatabaseModels/MonitorTemplate.js +10 -4
  15. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +13 -13
  16. package/Models/DatabaseModels/OnCallDutyPolicy.js +1 -1
  17. package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +1 -1
  18. package/Models/DatabaseModels/StatusPage.d.mts +2 -0
  19. package/Models/DatabaseModels/StatusPage.d.ts +2 -0
  20. package/Models/DatabaseModels/StatusPage.js +100 -0
  21. package/Types/AI/CodeTask.d.mts +1 -0
  22. package/Types/AI/CodeTask.d.ts +1 -0
  23. package/Types/AI/TelemetryAiActivity.d.mts +1 -0
  24. package/Types/AI/TelemetryAiActivity.d.ts +1 -0
  25. package/Types/AI/TelemetryAiActivity.js +4 -0
  26. package/Types/CodeRepository/CodeRepositorySetting.d.mts +15 -0
  27. package/Types/CodeRepository/CodeRepositorySetting.d.ts +15 -0
  28. package/Types/CodeRepository/CodeRepositorySetting.js +49 -0
  29. package/Types/CodeRepository/CodeRepositorySetting.mjs +3 -0
  30. package/Types/Database/BlankColumnValue.d.mts +6 -0
  31. package/Types/Database/BlankColumnValue.d.ts +6 -0
  32. package/Types/Database/BlankColumnValue.js +77 -0
  33. package/Types/Database/BlankColumnValue.mjs +4 -0
  34. package/Types/Date.d.mts +10 -0
  35. package/Types/Date.d.ts +10 -0
  36. package/Types/Date.js +385 -98
  37. package/Types/DateLanguage.d.mts +67 -0
  38. package/Types/DateLanguage.d.ts +67 -0
  39. package/Types/DateLanguage.js +478 -0
  40. package/Types/DateLanguage.mjs +21 -0
  41. package/Types/Email/EmailTemplateType.d.mts +1 -0
  42. package/Types/Email/EmailTemplateType.d.ts +1 -0
  43. package/Types/Email/EmailTemplateType.js +1 -0
  44. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.mts +6 -0
  45. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.ts +6 -0
  46. package/Types/IncomingCall/IncomingCallPolicyRepeat.js +41 -14
  47. package/Types/IncomingCall/IncomingCallPolicyRepeat.mjs +3 -0
  48. package/Types/Monitor/CriteriaFilter.d.mts +1 -0
  49. package/Types/Monitor/CriteriaFilter.d.ts +1 -0
  50. package/Types/Monitor/CriteriaFilter.js +9 -0
  51. package/Types/Monitor/DatabaseMetricCatalog.js +2 -2
  52. package/Types/Monitor/KubernetesEventAlertTemplates.d.mts +20 -0
  53. package/Types/Monitor/KubernetesEventAlertTemplates.d.ts +20 -0
  54. package/Types/Monitor/KubernetesEventAlertTemplates.js +232 -0
  55. package/Types/Monitor/KubernetesEventAlertTemplates.mjs +8 -0
  56. package/Types/Monitor/MonitorType.js +12 -2
  57. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +27 -2
  58. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.mts +1 -0
  59. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.ts +1 -0
  60. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +31 -1
  61. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +3 -1
  62. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +3 -1
  63. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +3 -2
  64. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.mts +1 -0
  65. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.ts +1 -0
  66. package/Types/NotificationSetting/NotificationEmailRollupCategory.js +2 -0
  67. package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +10 -3
  68. package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
  69. package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
  70. package/Types/NotificationSetting/NotificationSettingEventType.js +7 -0
  71. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.mts +7 -0
  72. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.ts +7 -0
  73. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.js +51 -0
  74. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.mjs +4 -0
  75. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.mts +8 -0
  76. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.ts +8 -0
  77. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.js +55 -0
  78. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.mjs +5 -0
  79. package/Types/Runner/CodeRepositoryRunner.d.mts +7 -0
  80. package/Types/Runner/CodeRepositoryRunner.d.ts +7 -0
  81. package/Types/Runner/CodeRepositoryRunner.js +60 -14
  82. package/Types/Runner/CodeRepositoryRunner.mjs +1 -0
  83. package/Types/SecurityEvent/OcsfProcessActivity.d.mts +25 -0
  84. package/Types/SecurityEvent/OcsfProcessActivity.d.ts +25 -0
  85. package/Types/SecurityEvent/OcsfProcessActivity.js +131 -0
  86. package/Types/SecurityEvent/OcsfProcessActivity.mjs +8 -0
  87. package/Types/Workflow/Templates.js +2 -5
  88. package/UI/Utils/TranslateTemplate.d.mts +73 -0
  89. package/UI/Utils/TranslateTemplate.d.ts +73 -0
  90. package/Utils/ColorContrast.d.mts +3 -0
  91. package/Utils/ColorContrast.d.ts +3 -0
  92. package/Utils/ColorContrast.js +41 -3
  93. package/Utils/ColorContrast.mjs +2 -0
  94. package/Utils/CronTab.d.mts +41 -3
  95. package/Utils/CronTab.d.ts +41 -3
  96. package/Utils/CronTab.js +112 -38
  97. package/Utils/Incident/WhoOpenedItRootCause.d.mts +2 -0
  98. package/Utils/Incident/WhoOpenedItRootCause.d.ts +2 -0
  99. package/Utils/Incident/WhoOpenedItRootCause.js +50 -0
  100. package/Utils/Incident/WhoOpenedItRootCause.mjs +3 -0
  101. package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +2 -0
  102. package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +2 -0
  103. package/Utils/Monitor/MonitorOverviewTargetUtil.js +13 -2
  104. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.mts +18 -0
  105. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.ts +18 -0
  106. package/Utils/Monitor/SyntheticMonitorStepsUtil.js +129 -0
  107. package/Utils/Monitor/SyntheticMonitorStepsUtil.mjs +4 -0
  108. package/Utils/Rules/RuleRunSummary.d.mts +1 -0
  109. package/Utils/Rules/RuleRunSummary.d.ts +1 -0
  110. package/Utils/Rules/RuleRunSummary.js +19 -1
  111. package/Utils/Rules/RuleRunSummary.mjs +1 -0
  112. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.mts +5 -0
  113. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.ts +5 -0
  114. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.js +219 -58
  115. package/Utils/SecurityEvent/OcsfNormalizer.js +22 -13
  116. package/Utils/Slo/SloDuration.d.mts +1 -0
  117. package/Utils/Slo/SloDuration.d.ts +1 -0
  118. package/Utils/Slo/SloDuration.js +57 -8
  119. package/Utils/Slo/SloDuration.mjs +1 -0
  120. package/Utils/Sms/Gsm7Text.js +9 -1
  121. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  122. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  123. package/Utils/Sms/OnCallPageSms.js +19 -2
  124. package/Utils/Sms/OnCallPageSms.mjs +1 -0
  125. package/Utils/Sms/SubscriberSms.d.mts +2 -0
  126. package/Utils/Sms/SubscriberSms.d.ts +2 -0
  127. package/Utils/Sms/SubscriberSms.js +35 -0
  128. package/Utils/Sms/SubscriberSms.mjs +3 -0
  129. package/Utils/Suggestions/CodeFixSuggestion.d.mts +15 -0
  130. package/Utils/Suggestions/CodeFixSuggestion.d.ts +15 -0
  131. package/Utils/Suggestions/CodeFixSuggestion.js +62 -1
  132. package/Utils/Suggestions/CodeFixSuggestion.mjs +4 -0
  133. package/Utils/Suggestions/ProfileFixSuggestion.js +4 -0
  134. package/Utils/Suggestions/SuggestionBlocker.d.mts +8 -0
  135. package/Utils/Suggestions/SuggestionBlocker.d.ts +8 -0
  136. package/Utils/Suggestions/SuggestionBlocker.js +51 -0
  137. package/Utils/Suggestions/SuggestionBlocker.mjs +4 -0
  138. package/Utils/Suggestions/SuggestionOffer.d.mts +2 -1
  139. package/Utils/Suggestions/SuggestionOffer.d.ts +2 -1
  140. package/Utils/Suggestions/SuggestionOffer.js +5 -0
  141. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -7
  142. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -7
  143. package/Utils/Suggestions/TelemetryAiFixSuggestion.js +8 -36
  144. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.mts +1 -0
  145. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.ts +1 -0
  146. package/Utils/Suggestions/TelemetryImprovementSuggestion.js +1 -0
  147. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +6 -0
  148. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +6 -0
  149. package/Utils/Suggestions/TracePerformanceFixSuggestion.js +46 -5
  150. package/package.json +8 -1
  151. package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +0 -61
  152. package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +0 -61
  153. package/Utils/Monitor/MonitorCheckScheduleUtil.js +0 -476
  154. package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +0 -3
  155. package/Utils/Monitor/MonitorOverviewFamily.d.mts +0 -39
  156. package/Utils/Monitor/MonitorOverviewFamily.d.ts +0 -39
  157. package/Utils/Monitor/MonitorOverviewFamily.js +0 -206
  158. package/Utils/Monitor/MonitorOverviewFamily.mjs +0 -4
  159. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +0 -189
  160. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +0 -189
  161. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +0 -1480
  162. package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +0 -5
  163. package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +0 -112
  164. package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +0 -112
  165. package/Utils/Monitor/MonitorOverviewProbeUtil.js +0 -640
  166. package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +0 -3
  167. package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +0 -27
  168. package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +0 -27
  169. package/Utils/Monitor/MonitorStatusHistoryUtil.js +0 -132
  170. package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +0 -2
  171. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +0 -42
  172. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +0 -42
  173. package/Utils/Monitor/MonitorUptimeSummaryUtil.js +0 -468
  174. package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +0 -2
@@ -14,6 +14,7 @@ export interface SnmpOidResponse {
14
14
  name?: string | undefined;
15
15
  value: string | number | null;
16
16
  type: SnmpDataType;
17
+ ratePerSecond?: number | undefined;
17
18
  }
18
19
  export default interface SnmpMonitorResponse {
19
20
  isOnline: boolean;
@@ -86,6 +86,8 @@ exports.ROLLUP_CATEGORY_BY_EVENT_TYPE = {
86
86
  [NotificationSettingEventType_1.default.SEND_INCIDENT_OWNER_ADDED_NOTIFICATION]: RollupCategory.Incidents,
87
87
  [NotificationSettingEventType_1.default.SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION]: RollupCategory.Incidents,
88
88
  [NotificationSettingEventType_1.default.SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION]: RollupCategory.Incidents,
89
+ // Never held back (NEVER_ROLLED_UP_EVENT_TYPES): filed here all the same.
90
+ [NotificationSettingEventType_1.default.SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION]: RollupCategory.Incidents,
89
91
  // Alerts
90
92
  [NotificationSettingEventType_1.default.SEND_ALERT_CREATED_OWNER_NOTIFICATION]: RollupCategory.Alerts,
91
93
  [NotificationSettingEventType_1.default.SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION]: RollupCategory.Alerts,
@@ -15,8 +15,8 @@ const NotificationSettingEventType_1 = __importDefault(require("./NotificationSe
15
15
  * between them.
16
16
  */
17
17
  /*
18
- * Time-critical on-call mail. Never held back, never counted, never written to
19
- * the queue table at all.
18
+ * Time-critical mail. Never held back, never counted, never written to the
19
+ * queue table at all.
20
20
  *
21
21
  * A five-minute coalescing window eats a thirty-minute shift lead time, which
22
22
  * is the entire value of "your shift starts soon". And "you are on call now",
@@ -24,6 +24,12 @@ const NotificationSettingEventType_1 = __importDefault(require("./NotificationSe
24
24
  * allowed to have. The saving from rolling these up would be nil anyway: they
25
25
  * fire once per roster transition, not per resource, so they are not what
26
26
  * floods anyone's inbox.
27
+ *
28
+ * An SLA breach is a deadline that has already passed: holding it back five
29
+ * minutes to batch it with the incident chatter that caused it is exactly
30
+ * backwards, and it fires once per deadline. It borrowed "Incident created"
31
+ * until it had an event of its own, so its sender asked for the bypass
32
+ * (forceImmediate) every time; now the event type says it.
27
33
  */
28
34
  exports.NEVER_ROLLED_UP_EVENT_TYPES = new Set([
29
35
  NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_ON_CALL_ROSTER,
@@ -31,6 +37,7 @@ exports.NEVER_ROLLED_UP_EVENT_TYPES = new Set([
31
37
  NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_NO_LONGER_ACTIVE_ON_ON_CALL_ROSTER,
32
38
  NotificationSettingEventType_1.default.SEND_BEFORE_USER_ON_CALL_SHIFT_STARTS,
33
39
  NotificationSettingEventType_1.default.SEND_WHEN_USER_ON_CALL_SHIFT_IS_REASSIGNED,
40
+ NotificationSettingEventType_1.default.SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION,
34
41
  ]);
35
42
  /*
36
43
  * SHRINK-ONLY. These two carry ON_CALL in their member name and are still
@@ -63,7 +70,7 @@ exports.ROLLUP_ELIGIBLE_ON_CALL_ADMIN_EVENT_TYPES = new Set([
63
70
  NotificationSettingEventType_1.default.SEND_WHEN_USER_IS_REMOVED_FROM_ON_CALL_POLICY,
64
71
  ]);
65
72
  /*
66
- * Everything else - the other 43 members. Derived from the enum by exclusion
73
+ * Everything else - every other member. Derived from the enum by exclusion
67
74
  * rather than listed by hand, so the two sets are a partition by construction
68
75
  * and cannot drift: there is no edit that adds a member to both, and no edit
69
76
  * that drops one from both.
@@ -5,6 +5,7 @@ declare enum NotificationSettingEventType {
5
5
  SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the incident",
6
6
  SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION = "Send notification when I am assigned to an incident as a member",
7
7
  SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION = "Send reminder notification when an incident I own is still open",
8
+ SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION = "Send notification when an incident I own misses an SLA deadline",
8
9
  SEND_ALERT_CREATED_OWNER_NOTIFICATION = "Send alert created notification when I am the owner of the alert",
9
10
  SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION = "Send alert note posted notification when I am the owner of the alert",
10
11
  SEND_ALERT_STATE_CHANGED_OWNER_NOTIFICATION = "Send alert state changed notification when I am the owner of the alert",
@@ -5,6 +5,7 @@ declare enum NotificationSettingEventType {
5
5
  SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the incident",
6
6
  SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION = "Send notification when I am assigned to an incident as a member",
7
7
  SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION = "Send reminder notification when an incident I own is still open",
8
+ SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION = "Send notification when an incident I own misses an SLA deadline",
8
9
  SEND_ALERT_CREATED_OWNER_NOTIFICATION = "Send alert created notification when I am the owner of the alert",
9
10
  SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION = "Send alert note posted notification when I am the owner of the alert",
10
11
  SEND_ALERT_STATE_CHANGED_OWNER_NOTIFICATION = "Send alert state changed notification when I am the owner of the alert",
@@ -9,6 +9,13 @@ var NotificationSettingEventType;
9
9
  NotificationSettingEventType["SEND_INCIDENT_OWNER_ADDED_NOTIFICATION"] = "Send notification when I am added as a owner to the incident";
10
10
  NotificationSettingEventType["SEND_INCIDENT_MEMBER_ADDED_NOTIFICATION"] = "Send notification when I am assigned to an incident as a member";
11
11
  NotificationSettingEventType["SEND_INCIDENT_REMINDER_OWNER_NOTIFICATION"] = "Send reminder notification when an incident I own is still open";
12
+ /*
13
+ * An incident SLA rule's response or resolution deadline passed
14
+ * (Workers IncidentSla/CheckSlaBreaches). Its own event since it had
15
+ * borrowed SEND_INCIDENT_CREATED_OWNER_NOTIFICATION, so switching off
16
+ * "Incident created" silenced SLA breaches too.
17
+ */
18
+ NotificationSettingEventType["SEND_INCIDENT_SLA_BREACHED_OWNER_NOTIFICATION"] = "Send notification when an incident I own misses an SLA deadline";
12
19
  // Alerts
13
20
  NotificationSettingEventType["SEND_ALERT_CREATED_OWNER_NOTIFICATION"] = "Send alert created notification when I am the owner of the alert";
14
21
  NotificationSettingEventType["SEND_ALERT_NOTE_POSTED_OWNER_NOTIFICATION"] = "Send alert note posted notification when I am the owner of the alert";
@@ -3,3 +3,10 @@ export interface OnCallDutyPolicyRepeatSettings {
3
3
  repeatPolicyIfNoOneAcknowledgesNoOfTimes?: number | null | undefined;
4
4
  }
5
5
  export declare function getOnCallPolicyRepeatsAllowed(policy: OnCallDutyPolicyRepeatSettings | null | undefined): number;
6
+ export declare const ON_CALL_POLICY_REPEAT_COLUMNS: ReadonlyArray<string>;
7
+ export declare const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL: string;
8
+ export declare function isRepeatCountOfAtLeastOne(value: unknown): boolean;
9
+ export declare function getOnCallPolicyRepeatRefusal(policy: {
10
+ repeatPolicyIfNoOneAcknowledges?: unknown;
11
+ repeatPolicyIfNoOneAcknowledgesNoOfTimes?: unknown;
12
+ }): string | null;
@@ -3,3 +3,10 @@ export interface OnCallDutyPolicyRepeatSettings {
3
3
  repeatPolicyIfNoOneAcknowledgesNoOfTimes?: number | null | undefined;
4
4
  }
5
5
  export declare function getOnCallPolicyRepeatsAllowed(policy: OnCallDutyPolicyRepeatSettings | null | undefined): number;
6
+ export declare const ON_CALL_POLICY_REPEAT_COLUMNS: ReadonlyArray<string>;
7
+ export declare const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL: string;
8
+ export declare function isRepeatCountOfAtLeastOne(value: unknown): boolean;
9
+ export declare function getOnCallPolicyRepeatRefusal(policy: {
10
+ repeatPolicyIfNoOneAcknowledges?: unknown;
11
+ repeatPolicyIfNoOneAcknowledgesNoOfTimes?: unknown;
12
+ }): string | null;
@@ -18,7 +18,10 @@
18
18
  * Slack and Microsoft Teams message of a run (OnCallPolicyRunMessage).
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = exports.ON_CALL_POLICY_REPEAT_COLUMNS = void 0;
21
22
  exports.getOnCallPolicyRepeatsAllowed = getOnCallPolicyRepeatsAllowed;
23
+ exports.isRepeatCountOfAtLeastOne = isRepeatCountOfAtLeastOne;
24
+ exports.getOnCallPolicyRepeatRefusal = getOnCallPolicyRepeatRefusal;
22
25
  /*
23
26
  * The number of repeats a run may make: 0 while "Repeat if no one
24
27
  * acknowledges" is off, otherwise "Number of times to repeat" - a whole
@@ -35,3 +38,51 @@ function getOnCallPolicyRepeatsAllowed(policy) {
35
38
  }
36
39
  return Math.floor(times);
37
40
  }
41
+ /*
42
+ * A POLICY THAT SAYS IT REPEATS MUST REPEAT AT LEAST ONCE.
43
+ *
44
+ * "Repeat if no one acknowledges" on with "Number of times to repeat" at 0
45
+ * (or below it, or not a whole number) says the policy starts again and
46
+ * never does: the run reads 0 repeats (above), and every screen reads the
47
+ * pair as "Stop paging". The Dashboard's Repeat Policy card cannot make it -
48
+ * its "How many more times?" box takes a whole number of 1 or more - and the
49
+ * server holds the API, Terraform, MCP and workflows to the same
50
+ * (OnCallDutyPolicyService, through Server/Utils/Database/ColumnRuleCheck).
51
+ * A policy stored that way before keeps running as it did, once, and an edit
52
+ * that leaves the pair as it is still saves.
53
+ *
54
+ * A number not given is the column's default, 0: a create that turns the
55
+ * switch on must say how many times.
56
+ */
57
+ exports.ON_CALL_POLICY_REPEAT_COLUMNS = [
58
+ "repeatPolicyIfNoOneAcknowledges",
59
+ "repeatPolicyIfNoOneAcknowledgesNoOfTimes",
60
+ ];
61
+ exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = "An on-call policy that repeats must start again at least once: set Repeat Policy Times If No One Acknowledges to a whole number of 1 or more, or turn off Repeat Policy If No One Acknowledges.";
62
+ /*
63
+ * Whether a count, as a write sends it, is a whole number of at least 1. A
64
+ * number or its digits; anything else - nothing, an empty box, a part of a
65
+ * number, 0 or below - is not.
66
+ */
67
+ function isRepeatCountOfAtLeastOne(value) {
68
+ if (typeof value !== "number" && typeof value !== "string") {
69
+ return false;
70
+ }
71
+ if (typeof value === "string" && !value.trim()) {
72
+ return false;
73
+ }
74
+ const times = Number(value);
75
+ return Number.isFinite(times) && Number.isInteger(times) && times >= 1;
76
+ }
77
+ /*
78
+ * The refusal for a pair that says it repeats and never does, or null: the
79
+ * switch off (the number then means nothing), or on with 1 or more.
80
+ */
81
+ function getOnCallPolicyRepeatRefusal(policy) {
82
+ if (policy.repeatPolicyIfNoOneAcknowledges !== true) {
83
+ return null;
84
+ }
85
+ return isRepeatCountOfAtLeastOne(policy.repeatPolicyIfNoOneAcknowledgesNoOfTimes)
86
+ ? null
87
+ : exports.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL;
88
+ }
@@ -1,2 +1,6 @@
1
1
  import commonJsModule from "./OnCallDutyPolicyRepeat.js";
2
+ export const ON_CALL_POLICY_REPEAT_COLUMNS = commonJsModule.ON_CALL_POLICY_REPEAT_COLUMNS;
3
+ export const ON_CALL_POLICY_REPEAT_TIMES_REFUSAL = commonJsModule.ON_CALL_POLICY_REPEAT_TIMES_REFUSAL;
4
+ export const getOnCallPolicyRepeatRefusal = commonJsModule.getOnCallPolicyRepeatRefusal;
2
5
  export const getOnCallPolicyRepeatsAllowed = commonJsModule.getOnCallPolicyRepeatsAllowed;
6
+ export const isRepeatCountOfAtLeastOne = commonJsModule.isRepeatCountOfAtLeastOne;
@@ -0,0 +1,8 @@
1
+ export declare const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS: ReadonlyArray<string>;
2
+ export interface ScheduledMaintenanceReminderTimingValues {
3
+ remindWhileScheduled?: unknown;
4
+ stopRemindersOnState?: unknown;
5
+ }
6
+ export declare function doesScheduledMaintenanceReminderRuleNeverRemind(values: ScheduledMaintenanceReminderTimingValues): boolean;
7
+ export declare const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL: string;
8
+ export declare function getScheduledMaintenanceReminderRuleRefusal(values: ScheduledMaintenanceReminderTimingValues): string | null;
@@ -0,0 +1,8 @@
1
+ export declare const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS: ReadonlyArray<string>;
2
+ export interface ScheduledMaintenanceReminderTimingValues {
3
+ remindWhileScheduled?: unknown;
4
+ stopRemindersOnState?: unknown;
5
+ }
6
+ export declare function doesScheduledMaintenanceReminderRuleNeverRemind(values: ScheduledMaintenanceReminderTimingValues): boolean;
7
+ export declare const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL: string;
8
+ export declare function getScheduledMaintenanceReminderRuleRefusal(values: ScheduledMaintenanceReminderTimingValues): string | null;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = exports.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = void 0;
7
+ exports.doesScheduledMaintenanceReminderRuleNeverRemind = doesScheduledMaintenanceReminderRuleNeverRemind;
8
+ exports.getScheduledMaintenanceReminderRuleRefusal = getScheduledMaintenanceReminderRuleRefusal;
9
+ const ScheduledMaintenanceReminderStopState_1 = __importDefault(require("./ScheduledMaintenanceReminderStopState"));
10
+ /*
11
+ * A SCHEDULED MAINTENANCE REMINDER RULE THAT WOULD NEVER REMIND.
12
+ *
13
+ * A reminder rule says when it reminds an event's owners with two columns:
14
+ * "Remind While Event is Scheduled" (remindWhileScheduled) and "Stop
15
+ * Reminders When" (stopRemindersOnState). With the switch off, the worker
16
+ * holds the first reminder back until the event starts
17
+ * (Workers/Jobs/ScheduledMaintenanceOwners/SendUnresolvedReminderNotification);
18
+ * with Ongoing, the start is where reminders stop. Together they wait for
19
+ * the start and stop at it: the rule matches every event it is meant for
20
+ * and reminds nobody.
21
+ *
22
+ * The Dashboard's form never makes that pair - it asks one question with
23
+ * three answers (Dashboard Components/Reminders/MaintenanceReminderTiming) -
24
+ * and the server holds every other way of saving a rule to the same: the
25
+ * API, Terraform, MCP and workflows (ScheduledMaintenanceReminderRuleService,
26
+ * through Server/Utils/Database/ColumnRuleCheck). A rule stored that way
27
+ * before the server refused it keeps working as it did: the rules list marks
28
+ * it "Never reminds", and an edit that leaves the pair as it is (a rename)
29
+ * still saves.
30
+ *
31
+ * Server-free and React-free: the server, the Dashboard and the tests read
32
+ * the same rule.
33
+ */
34
+ // The two columns the rule reads, as the model names them.
35
+ exports.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = ["remindWhileScheduled", "stopRemindersOnState"];
36
+ /*
37
+ * Whether the pair waits for the event to start and stops when it starts. A
38
+ * column not given is what a new rule stores: the switch off, Completed.
39
+ */
40
+ function doesScheduledMaintenanceReminderRuleNeverRemind(values) {
41
+ return (values.remindWhileScheduled !== true &&
42
+ values.stopRemindersOnState ===
43
+ ScheduledMaintenanceReminderStopState_1.default.Ongoing);
44
+ }
45
+ /*
46
+ * What saving that pair is refused with, in the API's own column names:
47
+ * what each of the two columns does to the rule, then the two ways out.
48
+ */
49
+ exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = "This reminder rule would never send a reminder: Remind While Event is Scheduled is off, so it waits for the event to start, and Stop Reminders When is Ongoing, so it stops when the event starts. Turn on Remind While Event is Scheduled, or set Stop Reminders When to Completed.";
50
+ // The refusal for a pair that never reminds, or null for one that reminds.
51
+ function getScheduledMaintenanceReminderRuleRefusal(values) {
52
+ return doesScheduledMaintenanceReminderRuleNeverRemind(values)
53
+ ? exports.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL
54
+ : null;
55
+ }
@@ -0,0 +1,5 @@
1
+ import commonJsModule from "./ScheduledMaintenanceReminderNeverReminds.js";
2
+ export const SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL = commonJsModule.SCHEDULED_MAINTENANCE_REMINDER_NEVER_REMINDS_REFUSAL;
3
+ export const SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS = commonJsModule.SCHEDULED_MAINTENANCE_REMINDER_TIMING_COLUMNS;
4
+ export const doesScheduledMaintenanceReminderRuleNeverRemind = commonJsModule.doesScheduledMaintenanceReminderRuleNeverRemind;
5
+ export const getScheduledMaintenanceReminderRuleRefusal = commonJsModule.getScheduledMaintenanceReminderRuleRefusal;
@@ -1,12 +1,16 @@
1
1
  import ObjectID from "../ObjectID.mjs";
2
2
  export declare enum CodeRepositoryRunnerChoiceKind {
3
3
  Custom = "custom",
4
+ ProjectDefault = "project-default",
4
5
  Global = "global",
5
6
  NoRunner = "no-runner"
6
7
  }
7
8
  export type CodeRepositoryRunnerDecision = {
8
9
  kind: CodeRepositoryRunnerChoiceKind.Custom;
9
10
  runnerId: string;
11
+ } | {
12
+ kind: CodeRepositoryRunnerChoiceKind.ProjectDefault;
13
+ runnerId: string;
10
14
  } | {
11
15
  kind: CodeRepositoryRunnerChoiceKind.Global;
12
16
  } | {
@@ -14,8 +18,11 @@ export type CodeRepositoryRunnerDecision = {
14
18
  };
15
19
  export interface CodeRepositoryRunnerFacts {
16
20
  repositoryRunnerId?: ObjectID | string | null | undefined;
21
+ picksGlobalRunner?: boolean | null | undefined;
22
+ projectDefaultRunnerId?: ObjectID | string | null | undefined;
17
23
  projectUsesGlobalRunners: boolean;
18
24
  }
25
+ export declare function followsProjectDefaultRunner(facts: Pick<CodeRepositoryRunnerFacts, "repositoryRunnerId" | "picksGlobalRunner">): boolean;
19
26
  export declare enum CodeWorkerKind {
20
27
  ProjectRunner = "project-runner",
21
28
  GlobalRunner = "global-runner",
@@ -1,12 +1,16 @@
1
1
  import ObjectID from "../ObjectID";
2
2
  export declare enum CodeRepositoryRunnerChoiceKind {
3
3
  Custom = "custom",
4
+ ProjectDefault = "project-default",
4
5
  Global = "global",
5
6
  NoRunner = "no-runner"
6
7
  }
7
8
  export type CodeRepositoryRunnerDecision = {
8
9
  kind: CodeRepositoryRunnerChoiceKind.Custom;
9
10
  runnerId: string;
11
+ } | {
12
+ kind: CodeRepositoryRunnerChoiceKind.ProjectDefault;
13
+ runnerId: string;
10
14
  } | {
11
15
  kind: CodeRepositoryRunnerChoiceKind.Global;
12
16
  } | {
@@ -14,8 +18,11 @@ export type CodeRepositoryRunnerDecision = {
14
18
  };
15
19
  export interface CodeRepositoryRunnerFacts {
16
20
  repositoryRunnerId?: ObjectID | string | null | undefined;
21
+ picksGlobalRunner?: boolean | null | undefined;
22
+ projectDefaultRunnerId?: ObjectID | string | null | undefined;
17
23
  projectUsesGlobalRunners: boolean;
18
24
  }
25
+ export declare function followsProjectDefaultRunner(facts: Pick<CodeRepositoryRunnerFacts, "repositoryRunnerId" | "picksGlobalRunner">): boolean;
19
26
  export declare enum CodeWorkerKind {
20
27
  ProjectRunner = "project-runner",
21
28
  GlobalRunner = "global-runner",
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CODE_REPOSITORY_RUNNER_TOKEN_REFUSAL = exports.CodeWorkerKind = exports.CodeRepositoryRunnerChoiceKind = void 0;
7
+ exports.followsProjectDefaultRunner = followsProjectDefaultRunner;
7
8
  exports.getRepositoryRunnerId = getRepositoryRunnerId;
8
9
  exports.decideCodeRepositoryRunner = decideCodeRepositoryRunner;
9
10
  exports.mayWorkInCodeRepository = mayWorkInCodeRepository;
@@ -11,14 +12,26 @@ const ObjectID_1 = __importDefault(require("../ObjectID"));
11
12
  /*
12
13
  * WHERE AI WORKS IN A CODE REPOSITORY - the repository's one rule.
13
14
  *
14
- * A repository picks the Runner AI works in it on (CodeRepository.runnerId,
15
- * its Runner setting in Code). A pick always wins: only that Runner may take
16
- * the repository's AI work and be handed a token for the repository. A
17
- * repository that picked none runs on a global Runner - the one OneUptime
18
- * runs for every project (on a self-hosted install, the bundled `runner`
19
- * service of Docker Compose and the Helm chart) - unless its project turned
20
- * global Runners off (Project.useGlobalRunners), in which case it needs one
21
- * of the project's own Runners.
15
+ * The default order a runbook step's Runner follows (Types/Runner/
16
+ * RunnerChoice), for a repository:
17
+ *
18
+ * 1. the Runner the repository picked (CodeRepository.runnerId, its
19
+ * Runner setting in Code) - a pick always wins: only that Runner may
20
+ * take the repository's AI work and be handed a token for it;
21
+ * 2. for a repository that picked none, the project's default Runner
22
+ * (Runner.isProjectDefault, Types/Runner/ProjectDefaultRunner) when it
23
+ * has one - followed, not copied: making another Runner the default
24
+ * moves every repository that picks none onto it;
25
+ * 3. otherwise a global Runner - the one OneUptime runs for every project
26
+ * (on a self-hosted install, the bundled `runner` service of Docker
27
+ * Compose and the Helm chart) - unless its project turned global
28
+ * Runners off (Project.useGlobalRunners), in which case it needs one of
29
+ * the project's own Runners.
30
+ *
31
+ * A repository may also pick the Global Runner itself
32
+ * (CodeRepository.isGlobalRunnerPicked): it then never follows the
33
+ * project's default Runner, as a step that picked the Global Runner never
34
+ * does (GLOBAL_RUNNER_CHOICE_ID).
22
35
  *
23
36
  * An AI agent of the project's own from before Runners (an AIAgent row with
24
37
  * a project) still serves the project's repositories that picked no Runner,
@@ -32,11 +45,28 @@ var CodeRepositoryRunnerChoiceKind;
32
45
  (function (CodeRepositoryRunnerChoiceKind) {
33
46
  // The repository picked one of its project's Runners.
34
47
  CodeRepositoryRunnerChoiceKind["Custom"] = "custom";
35
- // The repository picked none, and its project uses global Runners.
48
+ // The repository picked none, and its project has a default Runner.
49
+ CodeRepositoryRunnerChoiceKind["ProjectDefault"] = "project-default";
50
+ /*
51
+ * The repository picked none and its project has no default Runner, or
52
+ * it picked the Global Runner; its project uses global Runners.
53
+ */
36
54
  CodeRepositoryRunnerChoiceKind["Global"] = "global";
37
- // The repository picked none, and its project turned global Runners off.
55
+ /*
56
+ * The repository picked none and its project has no default Runner, or
57
+ * it picked the Global Runner; its project turned global Runners off.
58
+ */
38
59
  CodeRepositoryRunnerChoiceKind["NoRunner"] = "no-runner";
39
60
  })(CodeRepositoryRunnerChoiceKind || (exports.CodeRepositoryRunnerChoiceKind = CodeRepositoryRunnerChoiceKind = {}));
61
+ /*
62
+ * Whether a repository's work follows its project's default Runner: it
63
+ * picked no Runner, and did not pick the Global Runner either. Such a
64
+ * repository runs on the project's default Runner whenever there is one.
65
+ */
66
+ function followsProjectDefaultRunner(facts) {
67
+ return (!getRepositoryRunnerId(facts.repositoryRunnerId) &&
68
+ facts.picksGlobalRunner !== true);
69
+ }
40
70
  // Who asks to work in a repository.
41
71
  var CodeWorkerKind;
42
72
  (function (CodeWorkerKind) {
@@ -64,6 +94,14 @@ function decideCodeRepositoryRunner(facts) {
64
94
  if (runnerId) {
65
95
  return { kind: CodeRepositoryRunnerChoiceKind.Custom, runnerId };
66
96
  }
97
+ // Then the project's default Runner, unless it picked the Global Runner.
98
+ const defaultRunnerId = getRepositoryRunnerId(facts.projectDefaultRunnerId);
99
+ if (defaultRunnerId && followsProjectDefaultRunner(facts)) {
100
+ return {
101
+ kind: CodeRepositoryRunnerChoiceKind.ProjectDefault,
102
+ runnerId: defaultRunnerId,
103
+ };
104
+ }
67
105
  if (facts.projectUsesGlobalRunners) {
68
106
  return { kind: CodeRepositoryRunnerChoiceKind.Global };
69
107
  }
@@ -74,10 +112,13 @@ function decideCodeRepositoryRunner(facts) {
74
112
  * take its AI work, and be handed a token for it.
75
113
  *
76
114
  * - a repository that picked a Runner: that Runner, and nothing else;
77
- * - one that picked none: a global Runner while its project uses them,
78
- * and an AI agent of the project's own either way.
115
+ * - one that follows its project's default Runner: that Runner, and an
116
+ * AI agent of the project's own;
117
+ * - one that runs on a global Runner: a global Runner while its project
118
+ * uses them, and an AI agent of the project's own either way.
79
119
  *
80
- * A project's Runner never works in a repository that did not pick it.
120
+ * A project's Runner never works in a repository that did not pick it,
121
+ * unless it is the project's default Runner and the repository follows it.
81
122
  */
82
123
  function mayWorkInCodeRepository(data) {
83
124
  const workerId = getRepositoryRunnerId(data.worker.id);
@@ -86,6 +127,11 @@ function mayWorkInCodeRepository(data) {
86
127
  return (data.worker.kind === CodeWorkerKind.ProjectRunner &&
87
128
  Boolean(workerId) &&
88
129
  workerId === data.decision.runnerId);
130
+ case CodeRepositoryRunnerChoiceKind.ProjectDefault:
131
+ return ((data.worker.kind === CodeWorkerKind.ProjectRunner &&
132
+ Boolean(workerId) &&
133
+ workerId === data.decision.runnerId) ||
134
+ data.worker.kind === CodeWorkerKind.ProjectAgent);
89
135
  case CodeRepositoryRunnerChoiceKind.Global:
90
136
  return (data.worker.kind === CodeWorkerKind.GlobalRunner ||
91
137
  data.worker.kind === CodeWorkerKind.ProjectAgent);
@@ -103,4 +149,4 @@ function mayWorkInCodeRepository(data) {
103
149
  * without naming the Runner the repository picked: the worker asking is not
104
150
  * told about another Runner of the project.
105
151
  */
106
- exports.CODE_REPOSITORY_RUNNER_TOKEN_REFUSAL = "This repository's AI work runs on the Runner its settings in Code pick, and that is not this Runner, so it was not given access to the repository. Start the task again: it goes to the repository's Runner.";
152
+ exports.CODE_REPOSITORY_RUNNER_TOKEN_REFUSAL = "This repository's AI work runs on the Runner its settings in Code pick - the project's default Runner when they pick none - and that is not this Runner, so it was not given access to the repository. Start the task again: it goes to the repository's Runner.";
@@ -3,5 +3,6 @@ export const CODE_REPOSITORY_RUNNER_TOKEN_REFUSAL = commonJsModule.CODE_REPOSITO
3
3
  export const CodeRepositoryRunnerChoiceKind = commonJsModule.CodeRepositoryRunnerChoiceKind;
4
4
  export const CodeWorkerKind = commonJsModule.CodeWorkerKind;
5
5
  export const decideCodeRepositoryRunner = commonJsModule.decideCodeRepositoryRunner;
6
+ export const followsProjectDefaultRunner = commonJsModule.followsProjectDefaultRunner;
6
7
  export const getRepositoryRunnerId = commonJsModule.getRepositoryRunnerId;
7
8
  export const mayWorkInCodeRepository = commonJsModule.mayWorkInCodeRepository;
@@ -0,0 +1,25 @@
1
+ export declare const OCSF_PROCESS_ACTIVITY_CLASS_UID: number;
2
+ export declare enum OcsfProcessActivityId {
3
+ Unknown = 0,
4
+ Launch = 1,
5
+ Terminate = 2,
6
+ Open = 3,
7
+ Inject = 4,
8
+ SetUserId = 5,
9
+ Other = 99
10
+ }
11
+ export declare const OCSF_PROCESS_ACTIVITY_NAMES: Readonly<Record<OcsfProcessActivityId, string>>;
12
+ export declare function ocsfProcessActivityName(activityId: number | null | undefined): string;
13
+ export declare enum ProcessActivityKind {
14
+ Launch = "Launch",
15
+ Terminate = "Terminate",
16
+ Open = "Open",
17
+ Inject = "Inject",
18
+ PrivilegeEscalation = "PrivilegeEscalation",
19
+ Other = "Other"
20
+ }
21
+ export declare function getProcessActivityKind(data: {
22
+ activityId?: number | null | undefined;
23
+ activityName?: string | null | undefined;
24
+ }): ProcessActivityKind;
25
+ export declare function readProcessActivityId(value: unknown): number | null;
@@ -0,0 +1,25 @@
1
+ export declare const OCSF_PROCESS_ACTIVITY_CLASS_UID: number;
2
+ export declare enum OcsfProcessActivityId {
3
+ Unknown = 0,
4
+ Launch = 1,
5
+ Terminate = 2,
6
+ Open = 3,
7
+ Inject = 4,
8
+ SetUserId = 5,
9
+ Other = 99
10
+ }
11
+ export declare const OCSF_PROCESS_ACTIVITY_NAMES: Readonly<Record<OcsfProcessActivityId, string>>;
12
+ export declare function ocsfProcessActivityName(activityId: number | null | undefined): string;
13
+ export declare enum ProcessActivityKind {
14
+ Launch = "Launch",
15
+ Terminate = "Terminate",
16
+ Open = "Open",
17
+ Inject = "Inject",
18
+ PrivilegeEscalation = "PrivilegeEscalation",
19
+ Other = "Other"
20
+ }
21
+ export declare function getProcessActivityKind(data: {
22
+ activityId?: number | null | undefined;
23
+ activityName?: string | null | undefined;
24
+ }): ProcessActivityKind;
25
+ export declare function readProcessActivityId(value: unknown): number | null;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /*
3
+ * What a Process Activity event (OCSF class 1007) says was done to its
4
+ * process: launched, ended, opened, injected into, or something else.
5
+ *
6
+ * OCSF names it by `activity_id` and `activity_name`; Google SecOps' UDM by
7
+ * its event type (PROCESS_LAUNCH, PROCESS_OPEN, ...), which the UDM
8
+ * normalizer reads in as these names. The process fields are read by it -
9
+ * in a launch the process that acted is the parent of the one launched,
10
+ * in any other activity some other process (OcsfNormalizer) - and a
11
+ * destination sends the event as the activity it is (GoogleSecOpsUdmMapper),
12
+ * so all of them read an event's activity by the one rule below.
13
+ *
14
+ * https://schema.ocsf.io/classes/process_activity
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ProcessActivityKind = exports.OCSF_PROCESS_ACTIVITY_NAMES = exports.OcsfProcessActivityId = exports.OCSF_PROCESS_ACTIVITY_CLASS_UID = void 0;
18
+ exports.ocsfProcessActivityName = ocsfProcessActivityName;
19
+ exports.getProcessActivityKind = getProcessActivityKind;
20
+ exports.readProcessActivityId = readProcessActivityId;
21
+ exports.OCSF_PROCESS_ACTIVITY_CLASS_UID = 1007;
22
+ var OcsfProcessActivityId;
23
+ (function (OcsfProcessActivityId) {
24
+ OcsfProcessActivityId[OcsfProcessActivityId["Unknown"] = 0] = "Unknown";
25
+ OcsfProcessActivityId[OcsfProcessActivityId["Launch"] = 1] = "Launch";
26
+ OcsfProcessActivityId[OcsfProcessActivityId["Terminate"] = 2] = "Terminate";
27
+ OcsfProcessActivityId[OcsfProcessActivityId["Open"] = 3] = "Open";
28
+ OcsfProcessActivityId[OcsfProcessActivityId["Inject"] = 4] = "Inject";
29
+ OcsfProcessActivityId[OcsfProcessActivityId["SetUserId"] = 5] = "SetUserId";
30
+ OcsfProcessActivityId[OcsfProcessActivityId["Other"] = 99] = "Other";
31
+ })(OcsfProcessActivityId || (exports.OcsfProcessActivityId = OcsfProcessActivityId = {}));
32
+ // Each activity id as OCSF captions it, which is what activity_name holds.
33
+ exports.OCSF_PROCESS_ACTIVITY_NAMES = {
34
+ [OcsfProcessActivityId.Unknown]: "Unknown",
35
+ [OcsfProcessActivityId.Launch]: "Launch",
36
+ [OcsfProcessActivityId.Terminate]: "Terminate",
37
+ [OcsfProcessActivityId.Open]: "Open",
38
+ [OcsfProcessActivityId.Inject]: "Inject",
39
+ [OcsfProcessActivityId.SetUserId]: "Set User ID",
40
+ [OcsfProcessActivityId.Other]: "Other",
41
+ };
42
+ function isProcessActivityId(value) {
43
+ return Object.prototype.hasOwnProperty.call(exports.OCSF_PROCESS_ACTIVITY_NAMES, value);
44
+ }
45
+ /*
46
+ * The name of a Process Activity's activity id, for an event that gives
47
+ * only the id; "" for an id OCSF does not define.
48
+ */
49
+ function ocsfProcessActivityName(activityId) {
50
+ if (activityId === null ||
51
+ activityId === undefined ||
52
+ !Number.isInteger(activityId) ||
53
+ !isProcessActivityId(activityId)) {
54
+ return "";
55
+ }
56
+ return exports.OCSF_PROCESS_ACTIVITY_NAMES[activityId];
57
+ }
58
+ /*
59
+ * The kinds of process activity told apart downstream. Privilege
60
+ * Escalation is UDM's own (PROCESS_PRIVILEGE_ESCALATION, read in under that
61
+ * name); OCSF's Set User ID, Unknown and Other, and any name not listed
62
+ * here, are Other.
63
+ */
64
+ var ProcessActivityKind;
65
+ (function (ProcessActivityKind) {
66
+ ProcessActivityKind["Launch"] = "Launch";
67
+ ProcessActivityKind["Terminate"] = "Terminate";
68
+ ProcessActivityKind["Open"] = "Open";
69
+ ProcessActivityKind["Inject"] = "Inject";
70
+ ProcessActivityKind["PrivilegeEscalation"] = "PrivilegeEscalation";
71
+ ProcessActivityKind["Other"] = "Other";
72
+ })(ProcessActivityKind || (exports.ProcessActivityKind = ProcessActivityKind = {}));
73
+ const KIND_BY_ID = {
74
+ [OcsfProcessActivityId.Unknown]: ProcessActivityKind.Other,
75
+ [OcsfProcessActivityId.Launch]: ProcessActivityKind.Launch,
76
+ [OcsfProcessActivityId.Terminate]: ProcessActivityKind.Terminate,
77
+ [OcsfProcessActivityId.Open]: ProcessActivityKind.Open,
78
+ [OcsfProcessActivityId.Inject]: ProcessActivityKind.Inject,
79
+ [OcsfProcessActivityId.SetUserId]: ProcessActivityKind.Other,
80
+ [OcsfProcessActivityId.Other]: ProcessActivityKind.Other,
81
+ };
82
+ /*
83
+ * A Map, not an object: the name is the source's text, and an object would
84
+ * answer "constructor" or "toString" with what every object inherits.
85
+ */
86
+ const KIND_BY_NAME = new Map([
87
+ ["launch", ProcessActivityKind.Launch],
88
+ ["terminate", ProcessActivityKind.Terminate],
89
+ ["open", ProcessActivityKind.Open],
90
+ ["inject", ProcessActivityKind.Inject],
91
+ ["privilege escalation", ProcessActivityKind.PrivilegeEscalation],
92
+ ]);
93
+ /*
94
+ * The kind of a process activity, from what its event says: its activity
95
+ * id when it gives one (the id wins over the name, as OCSF has it), else
96
+ * its activity name. An event that names no activity at all is a launch,
97
+ * which is what nearly every process event is.
98
+ */
99
+ function getProcessActivityKind(data) {
100
+ const activityId = data.activityId;
101
+ if (activityId !== null && activityId !== undefined) {
102
+ return Number.isInteger(activityId) && isProcessActivityId(activityId)
103
+ ? KIND_BY_ID[activityId]
104
+ : ProcessActivityKind.Other;
105
+ }
106
+ const name = (data.activityName || "").trim().toLowerCase();
107
+ if (!name) {
108
+ return ProcessActivityKind.Launch;
109
+ }
110
+ return KIND_BY_NAME.get(name) || ProcessActivityKind.Other;
111
+ }
112
+ /*
113
+ * An activity id as a stored event keeps it: a number, or the text its
114
+ * flattened payload holds ("3"); null when it holds none, or no number.
115
+ * The same reading ingest gave the payload's activity_id (readNumber), so
116
+ * a stored event is sent as the activity its process fields were read by.
117
+ */
118
+ function readProcessActivityId(value) {
119
+ if (typeof value === "number") {
120
+ return Number.isFinite(value) ? value : null;
121
+ }
122
+ if (typeof value !== "string") {
123
+ return null;
124
+ }
125
+ const text = value.trim();
126
+ if (!text) {
127
+ return null;
128
+ }
129
+ const parsed = Number(text);
130
+ return Number.isFinite(parsed) ? parsed : null;
131
+ }