@oneuptime/common 14.0.93 → 14.0.94

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 (191) hide show
  1. package/Models/DatabaseModels/Alert.d.mts +2 -0
  2. package/Models/DatabaseModels/Alert.d.ts +2 -0
  3. package/Models/DatabaseModels/Alert.js +54 -0
  4. package/Models/DatabaseModels/CloudAccount.d.mts +29 -0
  5. package/Models/DatabaseModels/CloudAccount.d.ts +29 -0
  6. package/Models/DatabaseModels/CloudAccount.js +546 -0
  7. package/Models/DatabaseModels/CloudAccount.mjs +2 -0
  8. package/Models/DatabaseModels/CloudResource.d.mts +8 -0
  9. package/Models/DatabaseModels/CloudResource.d.ts +8 -0
  10. package/Models/DatabaseModels/CloudResource.js +169 -0
  11. package/Models/DatabaseModels/CloudResourceLabelRule.d.mts +1 -0
  12. package/Models/DatabaseModels/CloudResourceLabelRule.d.ts +1 -0
  13. package/Models/DatabaseModels/CloudResourceLabelRule.js +40 -0
  14. package/Models/DatabaseModels/CloudResourceOwnerRule.d.mts +1 -0
  15. package/Models/DatabaseModels/CloudResourceOwnerRule.d.ts +1 -0
  16. package/Models/DatabaseModels/CloudResourceOwnerRule.js +40 -0
  17. package/Models/DatabaseModels/Incident.d.mts +2 -0
  18. package/Models/DatabaseModels/Incident.d.ts +2 -0
  19. package/Models/DatabaseModels/Incident.js +54 -0
  20. package/Models/DatabaseModels/Index.js +2 -0
  21. package/Models/DatabaseModels/Monitor.d.mts +2 -0
  22. package/Models/DatabaseModels/Monitor.d.ts +2 -0
  23. package/Models/DatabaseModels/Monitor.js +54 -0
  24. package/Models/DatabaseModels/OpenSourceDeployment.d.mts +1 -0
  25. package/Models/DatabaseModels/OpenSourceDeployment.d.ts +1 -0
  26. package/Models/DatabaseModels/OpenSourceDeployment.js +25 -6
  27. package/Models/DatabaseModels/ScheduledMaintenance.d.mts +1 -0
  28. package/Models/DatabaseModels/ScheduledMaintenance.d.ts +1 -0
  29. package/Models/DatabaseModels/ScheduledMaintenance.js +50 -0
  30. package/Types/AI/AiAffectedResources.d.mts +40 -0
  31. package/Types/AI/AiAffectedResources.d.ts +40 -0
  32. package/Types/AI/AiAffectedResources.js +292 -0
  33. package/Types/AI/AiAffectedResources.mjs +10 -0
  34. package/Types/Cloud/CloudAccountSummary.d.mts +25 -0
  35. package/Types/Cloud/CloudAccountSummary.d.ts +25 -0
  36. package/Types/Cloud/CloudAccountSummary.js +114 -0
  37. package/Types/Cloud/CloudAccountSummary.mjs +5 -0
  38. package/Types/Cloud/CloudEndpointMatch.d.mts +26 -0
  39. package/Types/Cloud/CloudEndpointMatch.d.ts +26 -0
  40. package/Types/Cloud/CloudEndpointMatch.js +134 -0
  41. package/Types/Cloud/CloudEndpointMatch.mjs +5 -0
  42. package/Types/Cloud/CloudInventory.d.mts +34 -0
  43. package/Types/Cloud/CloudInventory.d.ts +34 -0
  44. package/Types/Cloud/CloudInventory.js +362 -0
  45. package/Types/Cloud/CloudInventory.mjs +22 -0
  46. package/Types/Cloud/CloudResourceCatalog.d.mts +2 -0
  47. package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
  48. package/Types/Cloud/CloudResourceCatalog.js +29 -1
  49. package/Types/Cloud/CloudResourceCatalog.mjs +2 -0
  50. package/Types/Cloud/CloudResourceIndex.d.mts +44 -0
  51. package/Types/Cloud/CloudResourceIndex.d.ts +44 -0
  52. package/Types/Cloud/CloudResourceIndex.js +191 -0
  53. package/Types/Cloud/CloudResourceIndex.mjs +4 -0
  54. package/Types/CloudConnection/CloudConnectionCatalog.d.mts +3 -0
  55. package/Types/CloudConnection/CloudConnectionCatalog.d.ts +3 -0
  56. package/Types/CloudConnection/CloudConnectionCatalog.js +70 -12
  57. package/Types/CloudConnection/CloudConnectionCatalog.mjs +2 -0
  58. package/Types/CloudConnection/CloudConnectionPaste.js +7 -1
  59. package/Types/CloudConnection/CloudConnectionSetupCommands.d.mts +43 -3
  60. package/Types/CloudConnection/CloudConnectionSetupCommands.d.ts +43 -3
  61. package/Types/CloudConnection/CloudConnectionSetupCommands.js +280 -30
  62. package/Types/CloudConnection/CloudConnectionSetupCommands.mjs +14 -0
  63. package/Types/CloudConnection/CloudConnectionTest.d.mts +1 -0
  64. package/Types/CloudConnection/CloudConnectionTest.d.ts +1 -0
  65. package/Types/CloudConnection/CloudConnectionTest.js +1 -0
  66. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.d.mts +19 -0
  67. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.d.ts +19 -0
  68. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.js +27 -1
  69. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.mjs +3 -0
  70. package/Types/Date.d.mts +1 -0
  71. package/Types/Date.d.ts +1 -0
  72. package/Types/Date.js +32 -6
  73. package/Types/DateLanguage.d.mts +2 -0
  74. package/Types/DateLanguage.d.ts +2 -0
  75. package/Types/DateLanguage.js +67 -12
  76. package/Types/DateLanguage.mjs +2 -0
  77. package/Types/Domain.d.mts +2 -0
  78. package/Types/Domain.d.ts +2 -0
  79. package/Types/Domain.js +27 -0
  80. package/Types/Email/EmailTemplateType.d.mts +1 -0
  81. package/Types/Email/EmailTemplateType.d.ts +1 -0
  82. package/Types/Email/EmailTemplateType.js +1 -0
  83. package/Types/Email.d.mts +1 -0
  84. package/Types/Email.d.ts +1 -0
  85. package/Types/Email.js +16 -0
  86. package/Types/Monitor/ExternalStatusPageMonitor/ExternalStatusPageMonitorResponse.d.mts +4 -0
  87. package/Types/Monitor/ExternalStatusPageMonitor/ExternalStatusPageMonitorResponse.d.ts +4 -0
  88. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.d.mts +3 -0
  89. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.d.ts +3 -0
  90. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.js +35 -0
  91. package/Types/Monitor/MonitorTemplateSyncField.js +6 -1
  92. package/Types/Monitor/UptimeBarTooltipMaintenance.d.mts +15 -0
  93. package/Types/Monitor/UptimeBarTooltipMaintenance.d.ts +15 -0
  94. package/Types/Monitor/UptimeBarTooltipMaintenance.js +2 -0
  95. package/Types/Monitor/UptimeBarTooltipMaintenance.mjs +1 -0
  96. package/Types/Monitor/UptimeHistoryLabels.d.mts +5 -0
  97. package/Types/Monitor/UptimeHistoryLabels.d.ts +5 -0
  98. package/Types/Monitor/UptimeHistoryLabels.js +5 -0
  99. package/Types/ReadingDirection.d.mts +10 -0
  100. package/Types/ReadingDirection.d.ts +10 -0
  101. package/Types/ReadingDirection.js +171 -0
  102. package/Types/ReadingDirection.mjs +10 -0
  103. package/Types/Rules/RuleCriteriaFieldRegistry.js +2 -0
  104. package/Types/Runbook/HttpStepVariables.d.mts +8 -0
  105. package/Types/Runbook/HttpStepVariables.d.ts +8 -0
  106. package/Types/Runbook/HttpStepVariables.js +109 -0
  107. package/Types/Runbook/HttpStepVariables.mjs +5 -0
  108. package/Types/Runbook/RunbookStep.d.mts +1 -0
  109. package/Types/Runbook/RunbookStep.d.ts +1 -0
  110. package/Types/Runbook/RunnerFeatures.d.mts +1 -0
  111. package/Types/Runbook/RunnerFeatures.d.ts +1 -0
  112. package/Types/Runbook/RunnerFeatures.js +15 -3
  113. package/Types/Runbook/RunnerFeatures.mjs +1 -0
  114. package/Types/Runbook/SshHostKey.d.mts +22 -0
  115. package/Types/Runbook/SshHostKey.d.ts +22 -0
  116. package/Types/Runbook/SshHostKey.js +201 -0
  117. package/Types/Runbook/SshHostKey.mjs +10 -0
  118. package/Types/Runner/CodeRepositoryRunner.js +2 -3
  119. package/Types/Runner/GlobalAIAgentsGone.d.mts +1 -0
  120. package/Types/Runner/GlobalAIAgentsGone.d.ts +1 -0
  121. package/Types/Runner/GlobalAIAgentsGone.js +19 -0
  122. package/Types/Runner/GlobalAIAgentsGone.mjs +2 -0
  123. package/Types/Runner/GlobalRunnerWork.d.mts +1 -0
  124. package/Types/Runner/GlobalRunnerWork.d.ts +1 -0
  125. package/Types/Runner/GlobalRunnerWork.js +21 -1
  126. package/Types/Runner/GlobalRunnerWork.mjs +1 -0
  127. package/Types/SSO/SignInMethods.d.mts +31 -0
  128. package/Types/SSO/SignInMethods.d.ts +31 -0
  129. package/Types/SSO/SignInMethods.js +160 -0
  130. package/Types/SSO/SignInMethods.mjs +8 -0
  131. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.d.mts +24 -0
  132. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.d.ts +24 -0
  133. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.js +159 -0
  134. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.mjs +8 -0
  135. package/Types/StatusPage/StatusPageLanguage.d.mts +6 -0
  136. package/Types/StatusPage/StatusPageLanguage.d.ts +6 -0
  137. package/Types/StatusPage/StatusPageLanguage.js +17 -1
  138. package/Types/StatusPage/StatusPageLanguage.mjs +1 -0
  139. package/Types/Workflow/WorkflowPlan.d.mts +7 -0
  140. package/Types/Workflow/WorkflowPlan.d.ts +7 -0
  141. package/Types/Workflow/WorkflowPlan.js +39 -0
  142. package/Types/Workflow/WorkflowPlan.mjs +3 -0
  143. package/Types/Workspace/WorkspaceMessagePayload.d.mts +11 -0
  144. package/Types/Workspace/WorkspaceMessagePayload.d.ts +11 -0
  145. package/Utils/Dashboard/TableThresholds.d.mts +44 -0
  146. package/Utils/Dashboard/TableThresholds.d.ts +44 -0
  147. package/Utils/Dashboard/TableThresholds.js +288 -0
  148. package/Utils/Dashboard/TableThresholds.mjs +17 -0
  149. package/Utils/Dashboard/ValueWidgetSeries.d.mts +6 -0
  150. package/Utils/Dashboard/ValueWidgetSeries.d.ts +6 -0
  151. package/Utils/Dashboard/ValueWidgetSeries.js +70 -1
  152. package/Utils/Dashboard/ValueWidgetSeries.mjs +2 -0
  153. package/Utils/DeveloperDocs/ResourceProfiles.js +16 -0
  154. package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
  155. package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
  156. package/Utils/DeveloperDocs/TerraformSchema.js +17 -0
  157. package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
  158. package/Utils/Monitor/ExternalStatusPageComponentNames.d.mts +17 -0
  159. package/Utils/Monitor/ExternalStatusPageComponentNames.d.ts +17 -0
  160. package/Utils/Monitor/ExternalStatusPageComponentNames.js +274 -0
  161. package/Utils/Monitor/ExternalStatusPageComponentNames.mjs +6 -0
  162. package/Utils/Monitor/ExternalStatusPageReading.d.mts +35 -0
  163. package/Utils/Monitor/ExternalStatusPageReading.d.ts +35 -0
  164. package/Utils/Monitor/ExternalStatusPageReading.js +380 -0
  165. package/Utils/Monitor/ExternalStatusPageReading.mjs +6 -0
  166. package/Utils/Monitor/ExternalStatusPageScope.d.mts +43 -0
  167. package/Utils/Monitor/ExternalStatusPageScope.d.ts +43 -0
  168. package/Utils/Monitor/ExternalStatusPageScope.js +213 -0
  169. package/Utils/Monitor/ExternalStatusPageScope.mjs +4 -0
  170. package/Utils/Runbook/SshHostKeyFingerprint.d.mts +8 -0
  171. package/Utils/Runbook/SshHostKeyFingerprint.d.ts +8 -0
  172. package/Utils/Runbook/SshHostKeyFingerprint.js +83 -0
  173. package/Utils/Runbook/SshHostKeyFingerprint.mjs +5 -0
  174. package/Utils/ScheduledMaintenanceStart.d.mts +6 -0
  175. package/Utils/ScheduledMaintenanceStart.d.ts +6 -0
  176. package/Utils/ScheduledMaintenanceStart.js +15 -0
  177. package/Utils/StatusPage/HistoryChartBarColors.d.mts +2 -0
  178. package/Utils/StatusPage/HistoryChartBarColors.d.ts +2 -0
  179. package/Utils/StatusPage/HistoryChartBarColors.js +12 -1
  180. package/Utils/StatusPage/HistoryChartBarColors.mjs +2 -0
  181. package/Utils/Telemetry/ChangeEventFields.d.mts +19 -1
  182. package/Utils/Telemetry/ChangeEventFields.d.ts +19 -1
  183. package/Utils/Telemetry/ChangeEventFields.js +52 -1
  184. package/Utils/Uptime/DayUptimeGraphUtil.d.mts +6 -0
  185. package/Utils/Uptime/DayUptimeGraphUtil.d.ts +6 -0
  186. package/Utils/Uptime/DayUptimeGraphUtil.js +37 -6
  187. package/Utils/Uptime/UptimeMaintenanceUtil.d.mts +60 -0
  188. package/Utils/Uptime/UptimeMaintenanceUtil.d.ts +60 -0
  189. package/Utils/Uptime/UptimeMaintenanceUtil.js +295 -0
  190. package/Utils/Uptime/UptimeMaintenanceUtil.mjs +3 -0
  191. package/package.json +1 -1
@@ -104,6 +104,14 @@ let ScheduledMaintenance = class ScheduledMaintenance extends DatabaseBaseModel_
104
104
  this.scheduledMaintenanceNumberWithPrefix = undefined;
105
105
  this.postUpdatesToWorkspaceChannels = undefined;
106
106
  this.isVisibleOnStatusPage = undefined;
107
+ /*
108
+ * When the event first shows on its status pages, and their subscribers
109
+ * hear that it is scheduled: none (null) - as every event created before
110
+ * this column - is as soon as it is created. Until a time set here has
111
+ * come the event is shown nowhere public, whatever Visible on Status Page
112
+ * says (Types/ScheduledMaintenance/ScheduledMaintenancePublication).
113
+ */
114
+ this.publishOnStatusPageAt = undefined;
107
115
  this.enableReminders = undefined;
108
116
  this.nextReminderNotificationAt = undefined;
109
117
  this.reminderNotificationSentCount = undefined;
@@ -2030,6 +2038,48 @@ __decorate([
2030
2038
  }),
2031
2039
  __metadata("design:type", Boolean)
2032
2040
  ], ScheduledMaintenance.prototype, "isVisibleOnStatusPage", void 0);
2041
+ __decorate([
2042
+ (0, ColumnAccessControl_1.default)({
2043
+ create: [
2044
+ Permission_1.default.ProjectOwner,
2045
+ Permission_1.default.ProjectAdmin,
2046
+ Permission_1.default.ProjectMember,
2047
+ Permission_1.default.ScheduledMaintenanceAdmin,
2048
+ Permission_1.default.ScheduledMaintenanceMember,
2049
+ Permission_1.default.CreateProjectScheduledMaintenance,
2050
+ ],
2051
+ read: [
2052
+ Permission_1.default.ProjectOwner,
2053
+ Permission_1.default.ProjectAdmin,
2054
+ Permission_1.default.ProjectMember,
2055
+ Permission_1.default.Viewer,
2056
+ Permission_1.default.ScheduledMaintenanceAdmin,
2057
+ Permission_1.default.ScheduledMaintenanceMember,
2058
+ Permission_1.default.ScheduledMaintenanceViewer,
2059
+ Permission_1.default.ReadProjectScheduledMaintenance,
2060
+ ],
2061
+ update: [
2062
+ Permission_1.default.ProjectOwner,
2063
+ Permission_1.default.ProjectAdmin,
2064
+ Permission_1.default.ProjectMember,
2065
+ Permission_1.default.ScheduledMaintenanceAdmin,
2066
+ Permission_1.default.ScheduledMaintenanceMember,
2067
+ Permission_1.default.EditProjectScheduledMaintenance,
2068
+ ],
2069
+ }),
2070
+ (0, TableColumn_1.default)({
2071
+ type: TableColumnType_1.default.Date,
2072
+ required: false,
2073
+ isDefaultValueColumn: false,
2074
+ title: "Publish on Status Page At",
2075
+ description: "When this event first shows on its status pages and their subscribers hear about it. Left empty, it shows as soon as it is created.",
2076
+ }),
2077
+ (0, typeorm_1.Column)({
2078
+ type: ColumnType_1.default.Date,
2079
+ nullable: true,
2080
+ }),
2081
+ __metadata("design:type", Date)
2082
+ ], ScheduledMaintenance.prototype, "publishOnStatusPageAt", void 0);
2033
2083
  __decorate([
2034
2084
  (0, ColumnAccessControl_1.default)({
2035
2085
  create: [
@@ -0,0 +1,40 @@
1
+ import { AIChatPageContext } from "./AIChatPageContext.mjs";
2
+ import { AIResourceType } from "./AIResourceContext.mjs";
3
+ export declare enum AiAffectedResourceKind {
4
+ Host = "Host",
5
+ DockerHost = "DockerHost",
6
+ PodmanHost = "PodmanHost",
7
+ KubernetesCluster = "KubernetesCluster",
8
+ DockerSwarmCluster = "DockerSwarmCluster",
9
+ ProxmoxCluster = "ProxmoxCluster",
10
+ VMwareVCenter = "VMwareVCenter",
11
+ CephCluster = "CephCluster",
12
+ StorageArray = "StorageArray",
13
+ IoTFleet = "IoTFleet",
14
+ DatabaseServer = "DatabaseServer",
15
+ CloudResource = "CloudResource",
16
+ Service = "Service"
17
+ }
18
+ export type AiAffectedResourceRelation = "hosts" | "dockerHosts" | "podmanHosts" | "kubernetesClusters" | "dockerSwarmClusters" | "proxmoxClusters" | "vmwareVCenters" | "cephClusters" | "storageArrays" | "iotFleets" | "databaseServers" | "cloudResources" | "services";
19
+ export interface AiAffectedResourceKindInfo {
20
+ kind: AiAffectedResourceKind;
21
+ relation: AiAffectedResourceRelation;
22
+ noun: string;
23
+ isFixedByOneUptimeAi: boolean;
24
+ }
25
+ export declare const AI_AFFECTED_RESOURCE_KINDS: ReadonlyArray<AiAffectedResourceKindInfo>;
26
+ export declare const AI_RESOURCE_TYPES_NOT_LINKABLE: Readonly<Partial<Record<AIResourceType, string>>>;
27
+ export declare const MAX_AI_AFFECTED_RESOURCES: number;
28
+ export interface AiAffectedResourceRef {
29
+ kind: AiAffectedResourceKind;
30
+ id: string;
31
+ }
32
+ export declare function getAiAffectedResourceKindInfo(kind: AiAffectedResourceKind): AiAffectedResourceKindInfo;
33
+ export declare function isAiAffectedResourceKind(value: unknown): value is AiAffectedResourceKind;
34
+ export declare function readAiAffectedResourceKind(value: unknown): AiAffectedResourceKind | undefined;
35
+ export declare function getPageAffectedResource(pageContext: AIChatPageContext | null | undefined): AiAffectedResourceRef | null;
36
+ export interface AiAffectedResourceArgument {
37
+ refs: Array<AiAffectedResourceRef>;
38
+ problems: Array<string>;
39
+ }
40
+ export declare function readAiAffectedResourceArgument(value: unknown): AiAffectedResourceArgument | undefined;
@@ -0,0 +1,40 @@
1
+ import { AIChatPageContext } from "./AIChatPageContext";
2
+ import { AIResourceType } from "./AIResourceContext";
3
+ export declare enum AiAffectedResourceKind {
4
+ Host = "Host",
5
+ DockerHost = "DockerHost",
6
+ PodmanHost = "PodmanHost",
7
+ KubernetesCluster = "KubernetesCluster",
8
+ DockerSwarmCluster = "DockerSwarmCluster",
9
+ ProxmoxCluster = "ProxmoxCluster",
10
+ VMwareVCenter = "VMwareVCenter",
11
+ CephCluster = "CephCluster",
12
+ StorageArray = "StorageArray",
13
+ IoTFleet = "IoTFleet",
14
+ DatabaseServer = "DatabaseServer",
15
+ CloudResource = "CloudResource",
16
+ Service = "Service"
17
+ }
18
+ export type AiAffectedResourceRelation = "hosts" | "dockerHosts" | "podmanHosts" | "kubernetesClusters" | "dockerSwarmClusters" | "proxmoxClusters" | "vmwareVCenters" | "cephClusters" | "storageArrays" | "iotFleets" | "databaseServers" | "cloudResources" | "services";
19
+ export interface AiAffectedResourceKindInfo {
20
+ kind: AiAffectedResourceKind;
21
+ relation: AiAffectedResourceRelation;
22
+ noun: string;
23
+ isFixedByOneUptimeAi: boolean;
24
+ }
25
+ export declare const AI_AFFECTED_RESOURCE_KINDS: ReadonlyArray<AiAffectedResourceKindInfo>;
26
+ export declare const AI_RESOURCE_TYPES_NOT_LINKABLE: Readonly<Partial<Record<AIResourceType, string>>>;
27
+ export declare const MAX_AI_AFFECTED_RESOURCES: number;
28
+ export interface AiAffectedResourceRef {
29
+ kind: AiAffectedResourceKind;
30
+ id: string;
31
+ }
32
+ export declare function getAiAffectedResourceKindInfo(kind: AiAffectedResourceKind): AiAffectedResourceKindInfo;
33
+ export declare function isAiAffectedResourceKind(value: unknown): value is AiAffectedResourceKind;
34
+ export declare function readAiAffectedResourceKind(value: unknown): AiAffectedResourceKind | undefined;
35
+ export declare function getPageAffectedResource(pageContext: AIChatPageContext | null | undefined): AiAffectedResourceRef | null;
36
+ export interface AiAffectedResourceArgument {
37
+ refs: Array<AiAffectedResourceRef>;
38
+ problems: Array<string>;
39
+ }
40
+ export declare function readAiAffectedResourceArgument(value: unknown): AiAffectedResourceArgument | undefined;
@@ -0,0 +1,292 @@
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.MAX_AI_AFFECTED_RESOURCES = exports.AI_RESOURCE_TYPES_NOT_LINKABLE = exports.AI_AFFECTED_RESOURCE_KINDS = exports.AiAffectedResourceKind = void 0;
7
+ exports.getAiAffectedResourceKindInfo = getAiAffectedResourceKindInfo;
8
+ exports.isAiAffectedResourceKind = isAiAffectedResourceKind;
9
+ exports.readAiAffectedResourceKind = readAiAffectedResourceKind;
10
+ exports.getPageAffectedResource = getPageAffectedResource;
11
+ exports.readAiAffectedResourceArgument = readAiAffectedResourceArgument;
12
+ const AIChatPageContext_1 = __importDefault(require("./AIChatPageContext"));
13
+ const AIResourceContext_1 = require("./AIResourceContext");
14
+ /*
15
+ * WHAT ONEUPTIME AI LINKS AN INCIDENT OR ALERT TO.
16
+ *
17
+ * Issue #5293: on a host's page, Ask AI declared an incident ("high memory
18
+ * usage") and the incident was linked to nothing. Its investigation never
19
+ * reached the host, and auto-remediation said "This incident is not linked
20
+ * to a Kubernetes cluster or an infrastructure resource, so OneUptime AI had
21
+ * nothing it could fix", although the conversation was about that host from
22
+ * its first word. create_incident took a title, a description and a
23
+ * severity, and nothing else.
24
+ *
25
+ * The resources an incident or alert is linked to are what everything after
26
+ * its creation reads: its investigation reaches them through their AI
27
+ * agents, auto-remediation fixes them, their owners and labels pass on to
28
+ * it, and their pages list it. So OneUptime AI links what it declares:
29
+ *
30
+ * - declared from a resource's page (a host, a cluster, a database, a
31
+ * service, ...), the incident is linked to that resource, as Declare
32
+ * Incident on the resource's own Incidents tab links it
33
+ * (CreateFromRecord);
34
+ * - and to the resources the model names (affectedResources), found with
35
+ * the person's own reads - query_telemetry_resources, lookup_context.
36
+ *
37
+ * This module is the vocabulary both use: the kinds of resource that can be
38
+ * linked, the incident's and the alert's list each one goes in (the two
39
+ * models declare the same lists), how a tool argument names them, and the
40
+ * resource a page is about. React-free and server-free, so the dashboard
41
+ * and any test read the same rules.
42
+ *
43
+ * Monitors are deliberately not here. A monitor linked to an incident a
44
+ * person declares stops its own checks until the incident is resolved
45
+ * (IncidentService.disableActiveMonitoringIfManualIncident), so linking
46
+ * one is the person's choice on the Declare Incident form, never a side
47
+ * effect of a conversation.
48
+ */
49
+ // The kinds of resource OneUptime AI may link an incident or alert to.
50
+ var AiAffectedResourceKind;
51
+ (function (AiAffectedResourceKind) {
52
+ AiAffectedResourceKind["Host"] = "Host";
53
+ AiAffectedResourceKind["DockerHost"] = "DockerHost";
54
+ AiAffectedResourceKind["PodmanHost"] = "PodmanHost";
55
+ AiAffectedResourceKind["KubernetesCluster"] = "KubernetesCluster";
56
+ AiAffectedResourceKind["DockerSwarmCluster"] = "DockerSwarmCluster";
57
+ AiAffectedResourceKind["ProxmoxCluster"] = "ProxmoxCluster";
58
+ AiAffectedResourceKind["VMwareVCenter"] = "VMwareVCenter";
59
+ AiAffectedResourceKind["CephCluster"] = "CephCluster";
60
+ AiAffectedResourceKind["StorageArray"] = "StorageArray";
61
+ AiAffectedResourceKind["IoTFleet"] = "IoTFleet";
62
+ AiAffectedResourceKind["DatabaseServer"] = "DatabaseServer";
63
+ // A resource a cloud connection lists (an AWS, Azure or Google Cloud one).
64
+ AiAffectedResourceKind["CloudResource"] = "CloudResource";
65
+ // A telemetry service (lookup_context's services).
66
+ AiAffectedResourceKind["Service"] = "Service";
67
+ })(AiAffectedResourceKind || (exports.AiAffectedResourceKind = AiAffectedResourceKind = {}));
68
+ /*
69
+ * Every kind, in the order the incident's Affected Resources card lists
70
+ * them (AffectedResourceNames), each with the list it goes in.
71
+ */
72
+ exports.AI_AFFECTED_RESOURCE_KINDS = [
73
+ {
74
+ kind: AiAffectedResourceKind.Host,
75
+ relation: "hosts",
76
+ noun: "host",
77
+ isFixedByOneUptimeAi: true,
78
+ },
79
+ {
80
+ kind: AiAffectedResourceKind.KubernetesCluster,
81
+ relation: "kubernetesClusters",
82
+ noun: "Kubernetes cluster",
83
+ isFixedByOneUptimeAi: true,
84
+ },
85
+ {
86
+ kind: AiAffectedResourceKind.DockerHost,
87
+ relation: "dockerHosts",
88
+ noun: "Docker host",
89
+ isFixedByOneUptimeAi: true,
90
+ },
91
+ {
92
+ kind: AiAffectedResourceKind.PodmanHost,
93
+ relation: "podmanHosts",
94
+ noun: "Podman host",
95
+ isFixedByOneUptimeAi: true,
96
+ },
97
+ {
98
+ kind: AiAffectedResourceKind.ProxmoxCluster,
99
+ relation: "proxmoxClusters",
100
+ noun: "Proxmox cluster",
101
+ isFixedByOneUptimeAi: true,
102
+ },
103
+ {
104
+ kind: AiAffectedResourceKind.VMwareVCenter,
105
+ relation: "vmwareVCenters",
106
+ noun: "VMware vCenter",
107
+ isFixedByOneUptimeAi: true,
108
+ },
109
+ {
110
+ kind: AiAffectedResourceKind.CephCluster,
111
+ relation: "cephClusters",
112
+ noun: "Ceph cluster",
113
+ isFixedByOneUptimeAi: true,
114
+ },
115
+ {
116
+ kind: AiAffectedResourceKind.StorageArray,
117
+ relation: "storageArrays",
118
+ noun: "storage array",
119
+ isFixedByOneUptimeAi: false,
120
+ },
121
+ {
122
+ kind: AiAffectedResourceKind.DockerSwarmCluster,
123
+ relation: "dockerSwarmClusters",
124
+ noun: "Docker Swarm cluster",
125
+ isFixedByOneUptimeAi: true,
126
+ },
127
+ {
128
+ kind: AiAffectedResourceKind.IoTFleet,
129
+ relation: "iotFleets",
130
+ noun: "IoT fleet",
131
+ isFixedByOneUptimeAi: false,
132
+ },
133
+ {
134
+ kind: AiAffectedResourceKind.DatabaseServer,
135
+ relation: "databaseServers",
136
+ noun: "database server",
137
+ isFixedByOneUptimeAi: true,
138
+ },
139
+ /*
140
+ * Linked for its changes, its metrics and its page's Incidents tab: no
141
+ * AI agent acts on a cloud account yet.
142
+ */
143
+ {
144
+ kind: AiAffectedResourceKind.CloudResource,
145
+ relation: "cloudResources",
146
+ noun: "cloud resource",
147
+ isFixedByOneUptimeAi: false,
148
+ },
149
+ {
150
+ kind: AiAffectedResourceKind.Service,
151
+ relation: "services",
152
+ noun: "service",
153
+ isFixedByOneUptimeAi: false,
154
+ },
155
+ ];
156
+ /*
157
+ * The resource pages Ask AI opens on whose resource an incident or alert
158
+ * cannot be linked to yet - it has no list of them - and so is never linked
159
+ * from there. Each says why; the model is told the same, and
160
+ * Tests/Types/AI/AiAffectedResources.test.ts holds every other page's
161
+ * resource to a list of both models. A model that gains the list moves its
162
+ * kind above.
163
+ */
164
+ exports.AI_RESOURCE_TYPES_NOT_LINKABLE = {
165
+ [AIResourceContext_1.AIResourceType.ServerlessFunction]: "An incident or alert has no list of serverless functions.",
166
+ [AIResourceContext_1.AIResourceType.NetworkDevice]: "An incident or alert has no list of network devices.",
167
+ };
168
+ // The most resources one call links: the most an investigation reaches.
169
+ exports.MAX_AI_AFFECTED_RESOURCES = 10;
170
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
171
+ function getAiAffectedResourceKindInfo(kind) {
172
+ const info = exports.AI_AFFECTED_RESOURCE_KINDS.find((item) => {
173
+ return item.kind === kind;
174
+ });
175
+ if (!info) {
176
+ throw new Error(`Unknown kind of affected resource: ${kind}`);
177
+ }
178
+ return info;
179
+ }
180
+ function isAiAffectedResourceKind(value) {
181
+ return exports.AI_AFFECTED_RESOURCE_KINDS.some((item) => {
182
+ return item.kind === value;
183
+ });
184
+ }
185
+ /*
186
+ * A kind as a model may spell it - "host", "kubernetescluster",
187
+ * "TelemetryService" - or undefined for anything else. Matched without
188
+ * regard to case, spaces, "-" or "_", since the value comes from a model.
189
+ */
190
+ function readAiAffectedResourceKind(value) {
191
+ if (typeof value !== "string") {
192
+ return undefined;
193
+ }
194
+ let spelled = "";
195
+ for (const character of value) {
196
+ if (character === " " || character === "-" || character === "_") {
197
+ continue;
198
+ }
199
+ spelled += character.toLowerCase();
200
+ }
201
+ if (spelled === "telemetryservice") {
202
+ return AiAffectedResourceKind.Service;
203
+ }
204
+ const info = exports.AI_AFFECTED_RESOURCE_KINDS.find((item) => {
205
+ return item.kind.toLowerCase() === spelled;
206
+ });
207
+ return info === null || info === void 0 ? void 0 : info.kind;
208
+ }
209
+ /*
210
+ * The resource of the page Ask AI was asked from, when an incident or alert
211
+ * can be linked to it: a resource's page (or one of its child pages - a
212
+ * pod's page is about its cluster) or a telemetry service's page. Null for
213
+ * every other page, and for a resource whose kind cannot be linked.
214
+ */
215
+ function getPageAffectedResource(pageContext) {
216
+ if (!(pageContext === null || pageContext === void 0 ? void 0 : pageContext.entityId) || !UUID_PATTERN.test(pageContext.entityId)) {
217
+ return null;
218
+ }
219
+ const id = pageContext.entityId.toLowerCase();
220
+ if (pageContext.type === AIChatPageContext_1.default.TelemetryService) {
221
+ return { kind: AiAffectedResourceKind.Service, id };
222
+ }
223
+ if (pageContext.type === AIChatPageContext_1.default.Resource &&
224
+ isAiAffectedResourceKind(pageContext.resourceType)) {
225
+ return {
226
+ kind: pageContext.resourceType,
227
+ id,
228
+ };
229
+ }
230
+ return null;
231
+ }
232
+ /*
233
+ * A tool's affectedResources argument: a list of { resourceType,
234
+ * resourceId }. Undefined when the call left the argument out - the tool
235
+ * then decides (create_incident links the page's resource) - and a list,
236
+ * possibly empty, when it named one: an empty list links nothing. Entries
237
+ * that name no kind, or no UUID, are left out with a problem each;
238
+ * repeated entries are kept once; past MAX_AI_AFFECTED_RESOURCES the rest
239
+ * are left out, and the problem says how many.
240
+ */
241
+ function readAiAffectedResourceArgument(value) {
242
+ var _a;
243
+ if (value === undefined || value === null) {
244
+ return undefined;
245
+ }
246
+ if (!Array.isArray(value)) {
247
+ return {
248
+ refs: [],
249
+ problems: [
250
+ "affectedResources must be a list of { resourceType, resourceId }.",
251
+ ],
252
+ };
253
+ }
254
+ const refs = [];
255
+ const problems = [];
256
+ const seen = new Set();
257
+ let leftOverCap = 0;
258
+ for (const item of value) {
259
+ if (!item || typeof item !== "object" || Array.isArray(item)) {
260
+ problems.push("An entry of affectedResources is not a { resourceType, resourceId } object.");
261
+ continue;
262
+ }
263
+ const entry = item;
264
+ const kind = readAiAffectedResourceKind(entry["resourceType"]);
265
+ const rawId = entry["resourceId"];
266
+ const id = typeof rawId === "string" ? rawId.trim() : "";
267
+ if (!kind) {
268
+ problems.push(`resourceType ${JSON.stringify((_a = entry["resourceType"]) !== null && _a !== void 0 ? _a : null).substring(0, 60)} cannot be linked. Use one of: ${exports.AI_AFFECTED_RESOURCE_KINDS.map((info) => {
269
+ return info.kind;
270
+ }).join(", ")}.`);
271
+ continue;
272
+ }
273
+ if (!UUID_PATTERN.test(id)) {
274
+ problems.push(`resourceId of a ${getAiAffectedResourceKindInfo(kind).noun} must be its OneUptime ID (a UUID).`);
275
+ continue;
276
+ }
277
+ const key = `${kind}:${id.toLowerCase()}`;
278
+ if (seen.has(key)) {
279
+ continue;
280
+ }
281
+ seen.add(key);
282
+ if (refs.length >= exports.MAX_AI_AFFECTED_RESOURCES) {
283
+ leftOverCap++;
284
+ continue;
285
+ }
286
+ refs.push({ kind, id: id.toLowerCase() });
287
+ }
288
+ if (leftOverCap > 0) {
289
+ problems.push(`Only ${exports.MAX_AI_AFFECTED_RESOURCES} resources are linked at once; ${leftOverCap} more were left out.`);
290
+ }
291
+ return { refs, problems };
292
+ }
@@ -0,0 +1,10 @@
1
+ import commonJsModule from "./AiAffectedResources.js";
2
+ export const AI_AFFECTED_RESOURCE_KINDS = commonJsModule.AI_AFFECTED_RESOURCE_KINDS;
3
+ export const AI_RESOURCE_TYPES_NOT_LINKABLE = commonJsModule.AI_RESOURCE_TYPES_NOT_LINKABLE;
4
+ export const AiAffectedResourceKind = commonJsModule.AiAffectedResourceKind;
5
+ export const MAX_AI_AFFECTED_RESOURCES = commonJsModule.MAX_AI_AFFECTED_RESOURCES;
6
+ export const getAiAffectedResourceKindInfo = commonJsModule.getAiAffectedResourceKindInfo;
7
+ export const getPageAffectedResource = commonJsModule.getPageAffectedResource;
8
+ export const isAiAffectedResourceKind = commonJsModule.isAiAffectedResourceKind;
9
+ export const readAiAffectedResourceArgument = commonJsModule.readAiAffectedResourceArgument;
10
+ export const readAiAffectedResourceKind = commonJsModule.readAiAffectedResourceKind;
@@ -0,0 +1,25 @@
1
+ export interface CloudAccountTypeCount {
2
+ type: string;
3
+ count: number;
4
+ }
5
+ export interface CloudAccountRegionCount {
6
+ region: string;
7
+ count: number;
8
+ }
9
+ export interface CloudAccountResourceSummary {
10
+ resourceCount: number;
11
+ types: Array<CloudAccountTypeCount>;
12
+ regions: Array<CloudAccountRegionCount>;
13
+ }
14
+ export declare const CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES: number;
15
+ export declare function summarizeCloudAccountResources(resources: Array<{
16
+ type: string;
17
+ region: string;
18
+ }>): CloudAccountResourceSummary;
19
+ export interface CloudAccountResourceCount {
20
+ type: string;
21
+ region: string;
22
+ count: number;
23
+ }
24
+ export declare function summarizeCloudAccountResourceCounts(counts: Array<CloudAccountResourceCount>): CloudAccountResourceSummary;
25
+ export declare function readCloudAccountResourceSummary(value: unknown): CloudAccountResourceSummary;
@@ -0,0 +1,25 @@
1
+ export interface CloudAccountTypeCount {
2
+ type: string;
3
+ count: number;
4
+ }
5
+ export interface CloudAccountRegionCount {
6
+ region: string;
7
+ count: number;
8
+ }
9
+ export interface CloudAccountResourceSummary {
10
+ resourceCount: number;
11
+ types: Array<CloudAccountTypeCount>;
12
+ regions: Array<CloudAccountRegionCount>;
13
+ }
14
+ export declare const CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES: number;
15
+ export declare function summarizeCloudAccountResources(resources: Array<{
16
+ type: string;
17
+ region: string;
18
+ }>): CloudAccountResourceSummary;
19
+ export interface CloudAccountResourceCount {
20
+ type: string;
21
+ region: string;
22
+ count: number;
23
+ }
24
+ export declare function summarizeCloudAccountResourceCounts(counts: Array<CloudAccountResourceCount>): CloudAccountResourceSummary;
25
+ export declare function readCloudAccountResourceSummary(value: unknown): CloudAccountResourceSummary;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /*
3
+ * A cloud account's resources at a glance (CloudAccount.resourceSummary):
4
+ * how many it has, by type and by region, most first. Written by the
5
+ * server whenever the account's resources change, read by its pages.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES = void 0;
9
+ exports.summarizeCloudAccountResources = summarizeCloudAccountResources;
10
+ exports.summarizeCloudAccountResourceCounts = summarizeCloudAccountResourceCounts;
11
+ exports.readCloudAccountResourceSummary = readCloudAccountResourceSummary;
12
+ // The most entries of each list kept: the rest are counted, not named.
13
+ exports.CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES = 50;
14
+ function summarizeCloudAccountResources(resources) {
15
+ return summarizeCloudAccountResourceCounts(resources.map((resource) => {
16
+ return { type: resource.type, region: resource.region, count: 1 };
17
+ }));
18
+ }
19
+ /*
20
+ * The summary from counts by type and Region (CloudAccountService counts
21
+ * them in the database, so an account of any size is one small read).
22
+ */
23
+ function summarizeCloudAccountResourceCounts(counts) {
24
+ const byType = new Map();
25
+ const byRegion = new Map();
26
+ let total = 0;
27
+ for (const entry of counts) {
28
+ const count = Number.isFinite(entry.count) && entry.count > 0
29
+ ? Math.floor(entry.count)
30
+ : 0;
31
+ if (count === 0) {
32
+ continue;
33
+ }
34
+ total += count;
35
+ const type = entry.type.trim();
36
+ const region = entry.region.trim();
37
+ if (type) {
38
+ byType.set(type, (byType.get(type) || 0) + count);
39
+ }
40
+ if (region) {
41
+ byRegion.set(region, (byRegion.get(region) || 0) + count);
42
+ }
43
+ }
44
+ return {
45
+ resourceCount: total,
46
+ types: sortCounts(byType)
47
+ .slice(0, exports.CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES)
48
+ .map((entry) => {
49
+ return { type: entry.value, count: entry.count };
50
+ }),
51
+ regions: sortCounts(byRegion)
52
+ .slice(0, exports.CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES)
53
+ .map((entry) => {
54
+ return { region: entry.value, count: entry.count };
55
+ }),
56
+ };
57
+ }
58
+ function sortCounts(counts) {
59
+ return Array.from(counts.entries())
60
+ .map(([value, count]) => {
61
+ return { value, count };
62
+ })
63
+ .sort((a, b) => {
64
+ return b.count - a.count || a.value.localeCompare(b.value);
65
+ });
66
+ }
67
+ // A stored summary, read back: anything malformed reads as empty.
68
+ function readCloudAccountResourceSummary(value) {
69
+ const empty = {
70
+ resourceCount: 0,
71
+ types: [],
72
+ regions: [],
73
+ };
74
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
75
+ return empty;
76
+ }
77
+ const record = value;
78
+ const count = Number(record["resourceCount"]);
79
+ const types = Array.isArray(record["types"])
80
+ ? record["types"]
81
+ .map((entry) => {
82
+ const item = entry && typeof entry === "object"
83
+ ? entry
84
+ : {};
85
+ return typeof item["type"] === "string" &&
86
+ Number.isFinite(Number(item["count"]))
87
+ ? { type: item["type"], count: Number(item["count"]) }
88
+ : null;
89
+ })
90
+ .filter((entry) => {
91
+ return entry !== null;
92
+ })
93
+ : [];
94
+ const regions = Array.isArray(record["regions"])
95
+ ? record["regions"]
96
+ .map((entry) => {
97
+ const item = entry && typeof entry === "object"
98
+ ? entry
99
+ : {};
100
+ return typeof item["region"] === "string" &&
101
+ Number.isFinite(Number(item["count"]))
102
+ ? { region: item["region"], count: Number(item["count"]) }
103
+ : null;
104
+ })
105
+ .filter((entry) => {
106
+ return entry !== null;
107
+ })
108
+ : [];
109
+ return {
110
+ resourceCount: Number.isFinite(count) && count > 0 ? count : 0,
111
+ types,
112
+ regions,
113
+ };
114
+ }
@@ -0,0 +1,5 @@
1
+ import commonJsModule from "./CloudAccountSummary.js";
2
+ export const CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES = commonJsModule.CLOUD_ACCOUNT_SUMMARY_MAX_ENTRIES;
3
+ export const readCloudAccountResourceSummary = commonJsModule.readCloudAccountResourceSummary;
4
+ export const summarizeCloudAccountResourceCounts = commonJsModule.summarizeCloudAccountResourceCounts;
5
+ export const summarizeCloudAccountResources = commonJsModule.summarizeCloudAccountResources;
@@ -0,0 +1,26 @@
1
+ export declare const CLOUD_ENDPOINT_MAX_MONITOR_HOSTS: number;
2
+ export interface CloudEndpointName {
3
+ name: string;
4
+ via: string;
5
+ }
6
+ export interface CloudEndpointCandidate {
7
+ id: string;
8
+ name: string;
9
+ type: string;
10
+ provider: string;
11
+ endpoints: unknown;
12
+ }
13
+ export interface CloudEndpointSuggestion {
14
+ cloudResourceId: string;
15
+ name: string;
16
+ type: string;
17
+ provider: string;
18
+ endpoint: string;
19
+ via: string;
20
+ }
21
+ export declare function getCloudEndpointComparisonNames(name: string): Array<string>;
22
+ export declare function getMonitorDestinationHosts(monitorSteps: unknown): Array<string>;
23
+ export declare function matchCloudEndpoints(data: {
24
+ names: Array<CloudEndpointName>;
25
+ candidates: Array<CloudEndpointCandidate>;
26
+ }): Array<CloudEndpointSuggestion>;
@@ -0,0 +1,26 @@
1
+ export declare const CLOUD_ENDPOINT_MAX_MONITOR_HOSTS: number;
2
+ export interface CloudEndpointName {
3
+ name: string;
4
+ via: string;
5
+ }
6
+ export interface CloudEndpointCandidate {
7
+ id: string;
8
+ name: string;
9
+ type: string;
10
+ provider: string;
11
+ endpoints: unknown;
12
+ }
13
+ export interface CloudEndpointSuggestion {
14
+ cloudResourceId: string;
15
+ name: string;
16
+ type: string;
17
+ provider: string;
18
+ endpoint: string;
19
+ via: string;
20
+ }
21
+ export declare function getCloudEndpointComparisonNames(name: string): Array<string>;
22
+ export declare function getMonitorDestinationHosts(monitorSteps: unknown): Array<string>;
23
+ export declare function matchCloudEndpoints(data: {
24
+ names: Array<CloudEndpointName>;
25
+ candidates: Array<CloudEndpointCandidate>;
26
+ }): Array<CloudEndpointSuggestion>;