@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
@@ -9,9 +9,11 @@ export const CLOUD_SERVICE_MODEL_LABELS = commonJsModule.CLOUD_SERVICE_MODEL_LAB
9
9
  export const CloudResourceCategory = commonJsModule.CloudResourceCategory;
10
10
  export const CloudServiceModel = commonJsModule.CloudServiceModel;
11
11
  export const GCP_MONITORED_RESOURCE_RULES = commonJsModule.GCP_MONITORED_RESOURCE_RULES;
12
+ export const INVENTORY_ONLY_RESOURCE_TYPES = commonJsModule.INVENTORY_ONLY_RESOURCE_TYPES;
12
13
  export const getAwsCloudWatchRulesForNamespace = commonJsModule.getAwsCloudWatchRulesForNamespace;
13
14
  export const getAwsPartitionForRegion = commonJsModule.getAwsPartitionForRegion;
14
15
  export const getCanonicalCloudResourceType = commonJsModule.getCanonicalCloudResourceType;
15
16
  export const getCloudResourceTypeDescriptor = commonJsModule.getCloudResourceTypeDescriptor;
16
17
  export const getCloudResourceTypeLabel = commonJsModule.getCloudResourceTypeLabel;
17
18
  export const getGcpMonitoredResourceRule = commonJsModule.getGcpMonitoredResourceRule;
19
+ export const isInventoryOnlyCloudResourceType = commonJsModule.isInventoryOnlyCloudResourceType;
@@ -0,0 +1,44 @@
1
+ import ObjectID from "../ObjectID.mjs";
2
+ import { CloudRelationshipKind, CloudResourceRelationship } from "./CloudInventory.mjs";
3
+ export interface CloudIndexedResource {
4
+ id: ObjectID;
5
+ name: string;
6
+ providerResourceId: string;
7
+ type: string;
8
+ }
9
+ export interface CloudIndexEntry {
10
+ id: ObjectID;
11
+ name: string;
12
+ }
13
+ export interface CloudLinkedResource extends CloudIndexedResource {
14
+ relationships: Array<CloudResourceRelationship>;
15
+ }
16
+ export declare class CloudResourceIndex {
17
+ private byKey;
18
+ private ambiguous;
19
+ constructor(rows: Array<CloudIndexedResource>);
20
+ private add;
21
+ find(resource: {
22
+ id: string;
23
+ type?: string | undefined;
24
+ }): CloudIndexEntry | null;
25
+ }
26
+ export type CloudRelationshipDirection = "out" | "in";
27
+ export interface CloudResolvedRelationship {
28
+ kind: CloudRelationshipKind;
29
+ direction: CloudRelationshipDirection;
30
+ other: CloudLinkedResource | null;
31
+ otherName: string;
32
+ otherType: string;
33
+ }
34
+ export declare function resolveCloudRelationships(data: {
35
+ resource: Omit<CloudIndexedResource, "name">;
36
+ relationships: Array<CloudResourceRelationship>;
37
+ neighbours: Array<CloudLinkedResource>;
38
+ }): Array<CloudResolvedRelationship>;
39
+ export interface CloudResourceLink {
40
+ fromId: string;
41
+ toId: string;
42
+ kind: CloudRelationshipKind;
43
+ }
44
+ export declare function getCloudResourceLinks(resources: Array<CloudLinkedResource>): Array<CloudResourceLink>;
@@ -0,0 +1,44 @@
1
+ import ObjectID from "../ObjectID";
2
+ import { CloudRelationshipKind, CloudResourceRelationship } from "./CloudInventory";
3
+ export interface CloudIndexedResource {
4
+ id: ObjectID;
5
+ name: string;
6
+ providerResourceId: string;
7
+ type: string;
8
+ }
9
+ export interface CloudIndexEntry {
10
+ id: ObjectID;
11
+ name: string;
12
+ }
13
+ export interface CloudLinkedResource extends CloudIndexedResource {
14
+ relationships: Array<CloudResourceRelationship>;
15
+ }
16
+ export declare class CloudResourceIndex {
17
+ private byKey;
18
+ private ambiguous;
19
+ constructor(rows: Array<CloudIndexedResource>);
20
+ private add;
21
+ find(resource: {
22
+ id: string;
23
+ type?: string | undefined;
24
+ }): CloudIndexEntry | null;
25
+ }
26
+ export type CloudRelationshipDirection = "out" | "in";
27
+ export interface CloudResolvedRelationship {
28
+ kind: CloudRelationshipKind;
29
+ direction: CloudRelationshipDirection;
30
+ other: CloudLinkedResource | null;
31
+ otherName: string;
32
+ otherType: string;
33
+ }
34
+ export declare function resolveCloudRelationships(data: {
35
+ resource: Omit<CloudIndexedResource, "name">;
36
+ relationships: Array<CloudResourceRelationship>;
37
+ neighbours: Array<CloudLinkedResource>;
38
+ }): Array<CloudResolvedRelationship>;
39
+ export interface CloudResourceLink {
40
+ fromId: string;
41
+ toId: string;
42
+ kind: CloudRelationshipKind;
43
+ }
44
+ export declare function getCloudResourceLinks(resources: Array<CloudLinkedResource>): Array<CloudResourceLink>;
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudResourceIndex = void 0;
4
+ exports.resolveCloudRelationships = resolveCloudRelationships;
5
+ exports.getCloudResourceLinks = getCloudResourceLinks;
6
+ const CloudInventory_1 = require("./CloudInventory");
7
+ // The last segment of an ARN, an ARM id or a resource name: its own name or id.
8
+ function lastSegment(value) {
9
+ const slash = value.lastIndexOf("/");
10
+ const colon = value.lastIndexOf(":");
11
+ const cut = Math.max(slash, colon);
12
+ return cut >= 0 && cut < value.length - 1 ? value.slice(cut + 1) : value;
13
+ }
14
+ /*
15
+ * The Cloud Resources of one account, by every name a change may give
16
+ * them: the provider id whole, its last segment with its type, its last
17
+ * segment alone, and - for Google Cloud, whose audit log writes
18
+ * "projects/p/zones/z/instances/web-1" for
19
+ * "//compute.googleapis.com/projects/p/zones/z/instances/web-1" - the full
20
+ * name without its service.
21
+ */
22
+ class CloudResourceIndex {
23
+ constructor(rows) {
24
+ this.byKey = new Map();
25
+ // Short names two resources answer to: neither is guessed.
26
+ this.ambiguous = new Set();
27
+ for (const row of rows) {
28
+ const id = row.providerResourceId.trim().toLowerCase();
29
+ if (!id) {
30
+ continue;
31
+ }
32
+ const entry = {
33
+ id: row.id,
34
+ name: row.name,
35
+ };
36
+ this.add(id, entry);
37
+ this.add(`${row.type.toLowerCase()}|${lastSegment(id)}`, entry);
38
+ this.add(`|${lastSegment(id)}`, entry);
39
+ if (id.startsWith("//")) {
40
+ const serviceEnd = id.indexOf("/", 2);
41
+ if (serviceEnd > 0) {
42
+ this.add(id.slice(serviceEnd + 1), entry);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ add(key, entry) {
48
+ const existing = this.byKey.get(key);
49
+ if (existing && existing.id.toString() !== entry.id.toString()) {
50
+ this.ambiguous.add(key);
51
+ return;
52
+ }
53
+ this.byKey.set(key, entry);
54
+ }
55
+ // The resource a change's resource names, or null.
56
+ find(resource) {
57
+ const id = resource.id.trim().toLowerCase();
58
+ if (!id) {
59
+ return null;
60
+ }
61
+ const keys = [
62
+ id,
63
+ ...(resource.type
64
+ ? [`${resource.type.toLowerCase()}|${lastSegment(id)}`]
65
+ : []),
66
+ `|${lastSegment(id)}`,
67
+ ];
68
+ for (const key of keys) {
69
+ if (this.ambiguous.has(key)) {
70
+ continue;
71
+ }
72
+ const found = this.byKey.get(key);
73
+ if (found) {
74
+ return found;
75
+ }
76
+ }
77
+ return null;
78
+ }
79
+ }
80
+ exports.CloudResourceIndex = CloudResourceIndex;
81
+ /*
82
+ * The resource a relationship points at, among `resources`: found by the
83
+ * index, and of the type the relationship names when it names one.
84
+ */
85
+ function makeTargetFinder(resources) {
86
+ const index = new CloudResourceIndex(resources);
87
+ const byId = new Map();
88
+ for (const resource of resources) {
89
+ byId.set(resource.id.toString(), resource);
90
+ }
91
+ return (relationship) => {
92
+ const found = index.find({
93
+ id: relationship.target,
94
+ type: relationship.targetType,
95
+ });
96
+ const resource = found
97
+ ? byId.get(found.id.toString())
98
+ : undefined;
99
+ if (!resource) {
100
+ return null;
101
+ }
102
+ // Two resources of different types are never the same one.
103
+ if (relationship.targetType &&
104
+ resource.type.toLowerCase() !== relationship.targetType.toLowerCase()) {
105
+ return null;
106
+ }
107
+ return resource;
108
+ };
109
+ }
110
+ /*
111
+ * One resource's relationships, both ways, named after the resources the
112
+ * account holds: what it points at (its own relationships) and what points
113
+ * at it (theirs, naming it). Out first, in the order listed, then in.
114
+ */
115
+ function resolveCloudRelationships(data) {
116
+ const findTarget = makeTargetFinder(data.neighbours);
117
+ const resolved = [];
118
+ for (const relationship of data.relationships) {
119
+ if (!(0, CloudInventory_1.isCloudRelationshipKind)(relationship.kind)) {
120
+ continue;
121
+ }
122
+ const other = findTarget(relationship);
123
+ resolved.push({
124
+ kind: relationship.kind,
125
+ direction: "out",
126
+ other: other,
127
+ otherName: (other === null || other === void 0 ? void 0 : other.name) || relationship.target,
128
+ otherType: relationship.targetType || (other === null || other === void 0 ? void 0 : other.type) || "",
129
+ });
130
+ }
131
+ // What names this resource: its id whole, or its own name with its type.
132
+ const self = new CloudResourceIndex([
133
+ Object.assign(Object.assign({}, data.resource), { name: "" }),
134
+ ]);
135
+ const selfId = data.resource.id.toString();
136
+ for (const neighbour of data.neighbours) {
137
+ if (neighbour.id.toString() === selfId) {
138
+ continue;
139
+ }
140
+ for (const relationship of neighbour.relationships) {
141
+ if (!(0, CloudInventory_1.isCloudRelationshipKind)(relationship.kind) ||
142
+ (relationship.targetType &&
143
+ relationship.targetType.toLowerCase() !==
144
+ data.resource.type.toLowerCase()) ||
145
+ !self.find({ id: relationship.target, type: relationship.targetType })) {
146
+ continue;
147
+ }
148
+ resolved.push({
149
+ kind: relationship.kind,
150
+ direction: "in",
151
+ other: neighbour,
152
+ otherName: neighbour.name || neighbour.providerResourceId,
153
+ otherType: neighbour.type,
154
+ });
155
+ }
156
+ }
157
+ return resolved;
158
+ }
159
+ /*
160
+ * Every relationship between the resources given that both ends of are
161
+ * among them: what an account's topology draws. A resource is never linked
162
+ * to itself, and one relationship is one link however often it is listed.
163
+ */
164
+ function getCloudResourceLinks(resources) {
165
+ const findTarget = makeTargetFinder(resources);
166
+ const links = [];
167
+ const seen = new Set();
168
+ for (const resource of resources) {
169
+ const fromId = resource.id.toString();
170
+ for (const relationship of resource.relationships) {
171
+ if (!(0, CloudInventory_1.isCloudRelationshipKind)(relationship.kind)) {
172
+ continue;
173
+ }
174
+ const target = findTarget(relationship);
175
+ if (!target) {
176
+ continue;
177
+ }
178
+ const toId = target.id.toString();
179
+ if (toId === fromId) {
180
+ continue;
181
+ }
182
+ const key = `${fromId}|${relationship.kind}|${toId}`;
183
+ if (seen.has(key)) {
184
+ continue;
185
+ }
186
+ seen.add(key);
187
+ links.push({ fromId, toId, kind: relationship.kind });
188
+ }
189
+ }
190
+ return links;
191
+ }
@@ -0,0 +1,4 @@
1
+ import commonJsModule from "./CloudResourceIndex.js";
2
+ export const CloudResourceIndex = commonJsModule.CloudResourceIndex;
3
+ export const getCloudResourceLinks = commonJsModule.getCloudResourceLinks;
4
+ export const resolveCloudRelationships = commonJsModule.resolveCloudRelationships;
@@ -21,6 +21,7 @@ export interface CloudConnectionField {
21
21
  options?: Array<CloudConnectionFieldOption> | undefined;
22
22
  defaultValue?: string | undefined;
23
23
  isAdvanced?: boolean | undefined;
24
+ isHidden?: boolean | undefined;
24
25
  authMethods?: Array<CloudConnectionAuthMethod> | undefined;
25
26
  }
26
27
  export interface CloudConnectionAuthMethodDefinition {
@@ -46,6 +47,8 @@ export interface CloudConnectionDefinition {
46
47
  defaultReadIntervalInMinutes: number;
47
48
  }
48
49
  export declare const READ_INTERVAL_FIELD_KEY: string;
50
+ export declare const READ_SCOPE_FIELD_KEY: string;
51
+ export declare const AZURE_SECRET_EXPIRES_AT_KEY: string;
49
52
  export declare const CLOUD_CONNECTION_READ_INTERVALS: Array<number>;
50
53
  export declare const CloudConnectionCatalog: Array<CloudConnectionDefinition>;
51
54
  export declare const CLOUD_CONNECTION_DERIVED_CONFIG_KEYS: Array<string>;
@@ -21,6 +21,7 @@ export interface CloudConnectionField {
21
21
  options?: Array<CloudConnectionFieldOption> | undefined;
22
22
  defaultValue?: string | undefined;
23
23
  isAdvanced?: boolean | undefined;
24
+ isHidden?: boolean | undefined;
24
25
  authMethods?: Array<CloudConnectionAuthMethod> | undefined;
25
26
  }
26
27
  export interface CloudConnectionAuthMethodDefinition {
@@ -46,6 +47,8 @@ export interface CloudConnectionDefinition {
46
47
  defaultReadIntervalInMinutes: number;
47
48
  }
48
49
  export declare const READ_INTERVAL_FIELD_KEY: string;
50
+ export declare const READ_SCOPE_FIELD_KEY: string;
51
+ export declare const AZURE_SECRET_EXPIRES_AT_KEY: string;
49
52
  export declare const CLOUD_CONNECTION_READ_INTERVALS: Array<number>;
50
53
  export declare const CloudConnectionCatalog: Array<CloudConnectionDefinition>;
51
54
  export declare const CLOUD_CONNECTION_DERIVED_CONFIG_KEYS: Array<string>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CLOUD_CONNECTION_DERIVED_CONFIG_KEYS = exports.CloudConnectionCatalog = exports.CLOUD_CONNECTION_READ_INTERVALS = exports.READ_INTERVAL_FIELD_KEY = exports.CloudConnectionAuthMethod = void 0;
6
+ exports.CLOUD_CONNECTION_DERIVED_CONFIG_KEYS = exports.CloudConnectionCatalog = exports.CLOUD_CONNECTION_READ_INTERVALS = exports.AZURE_SECRET_EXPIRES_AT_KEY = exports.READ_SCOPE_FIELD_KEY = exports.READ_INTERVAL_FIELD_KEY = exports.CloudConnectionAuthMethod = void 0;
7
7
  exports.isCloudConnectionProvider = isCloudConnectionProvider;
8
8
  exports.getCloudConnectionDefinition = getCloudConnectionDefinition;
9
9
  exports.getCloudConnectionTitle = getCloudConnectionTitle;
@@ -62,6 +62,18 @@ var CloudConnectionAuthMethod;
62
62
  })(CloudConnectionAuthMethod || (exports.CloudConnectionAuthMethod = CloudConnectionAuthMethod = {}));
63
63
  // The setting that says how often a connection's metrics are read.
64
64
  exports.READ_INTERVAL_FIELD_KEY = "readIntervalInMinutes";
65
+ /*
66
+ * The setting that says whether a connection reads the one account its
67
+ * command was run in, or every account of the organization
68
+ * (CloudConnectionSetupScope). Chosen on the form's first step, where it
69
+ * decides which command is shown.
70
+ */
71
+ exports.READ_SCOPE_FIELD_KEY = "readScope";
72
+ /*
73
+ * Where an Azure connection keeps when its client secret expires, read from
74
+ * the endDateTime its setup command prints with the secret.
75
+ */
76
+ exports.AZURE_SECRET_EXPIRES_AT_KEY = "clientSecretExpiresAt";
65
77
  // The intervals a connection may be read at, in minutes.
66
78
  exports.CLOUD_CONNECTION_READ_INTERVALS = [
67
79
  5, 10, 15, 30, 60,
@@ -84,13 +96,35 @@ function readIntervalField(defaultMinutes) {
84
96
  isAdvanced: true,
85
97
  };
86
98
  }
99
+ /*
100
+ * The two choices, and the line under the title, in the cloud's own words:
101
+ * an AWS account of an organization, an Azure subscription of a tenant, a
102
+ * Google Cloud project of an organization. Each choice is written as a
103
+ * label, so the Dashboard's string extraction finds it and the form shows
104
+ * it in the reader's language.
105
+ */
106
+ function readScopeField(data) {
107
+ return {
108
+ key: exports.READ_SCOPE_FIELD_KEY,
109
+ title: "What to read",
110
+ description: data.description,
111
+ type: "dropdown",
112
+ required: false,
113
+ options: [
114
+ { label: data.one.label, value: "account" },
115
+ { label: data.every.label, value: "organization" },
116
+ ],
117
+ defaultValue: "account",
118
+ authMethods: data.authMethods,
119
+ };
120
+ }
87
121
  exports.CloudConnectionCatalog = [
88
122
  {
89
123
  provider: CloudPlatform_1.CloudProvider.AWS,
90
124
  title: "Amazon Web Services",
91
125
  description: "EC2, RDS, Lambda, load balancers and more, read from CloudWatch.",
92
- summary: "Every resource that reports to CloudWatch, in every region you use, with its key metrics.",
93
- explanation: "OneUptime can only read metrics and tags.",
126
+ summary: "Every resource in every region you use, with its key metrics and what changed.",
127
+ explanation: "OneUptime can only read: metrics, resources and how they are set up, changes and health events. Never data or secrets.",
94
128
  icon: IconProp_1.default.Cloud,
95
129
  docsPath: "/docs/telemetry/cloud-accounts#amazon-web-services",
96
130
  shellTitle: "AWS CloudShell",
@@ -100,13 +134,13 @@ exports.CloudConnectionCatalog = [
100
134
  method: CloudConnectionAuthMethod.AwsRole,
101
135
  title: "IAM role",
102
136
  description: "Recommended. Nothing secret is stored: OneUptime signs in with a role you can delete at any time.",
103
- hint: "Run this in AWS CloudShell. It creates a role that can only read metrics and tags, and prints the role's ARN.",
137
+ hint: "Run this in AWS CloudShell. It creates a role that can only read, and prints the role's ARN.",
104
138
  },
105
139
  {
106
140
  method: CloudConnectionAuthMethod.AwsAccessKey,
107
141
  title: "Access key",
108
142
  description: "An IAM user's access key. Use it when a role is not possible.",
109
- hint: "Run this in AWS CloudShell. It creates a user that can only read metrics and tags, and prints its access key.",
143
+ hint: "Run this in AWS CloudShell. It creates a user that can only read, and prints its access key.",
110
144
  },
111
145
  ],
112
146
  configFields: [
@@ -128,6 +162,12 @@ exports.CloudConnectionCatalog = [
128
162
  placeholder: "AKIA...",
129
163
  authMethods: [CloudConnectionAuthMethod.AwsAccessKey],
130
164
  },
165
+ readScopeField({
166
+ one: { label: "This account" },
167
+ every: { label: "Every account in the organization" },
168
+ description: "One account, or every account of the organization. The command changes with it.",
169
+ authMethods: [CloudConnectionAuthMethod.AwsRole],
170
+ }),
131
171
  {
132
172
  key: "regions",
133
173
  title: "Regions",
@@ -156,8 +196,8 @@ exports.CloudConnectionCatalog = [
156
196
  provider: CloudPlatform_1.CloudProvider.Azure,
157
197
  title: "Microsoft Azure",
158
198
  description: "Virtual machines, App Service, SQL, storage and more, read from Azure Monitor.",
159
- summary: "Every resource in the subscriptions the app can read, with its key metrics.",
160
- explanation: "OneUptime can only read resources and metrics.",
199
+ summary: "Every resource in the subscriptions the app can read, with its key metrics and what changed.",
200
+ explanation: "OneUptime can only read: resources, metrics and the activity log. Never data or secrets.",
161
201
  icon: IconProp_1.default.Cloud,
162
202
  docsPath: "/docs/telemetry/cloud-accounts#microsoft-azure",
163
203
  shellTitle: "Azure Cloud Shell",
@@ -167,7 +207,7 @@ exports.CloudConnectionCatalog = [
167
207
  method: CloudConnectionAuthMethod.AzureClientSecret,
168
208
  title: "App registration",
169
209
  description: "An app with the Monitoring Reader role.",
170
- hint: "Run this in Azure Cloud Shell. It creates an app with the Monitoring Reader role on your subscription, and prints its details.",
210
+ hint: "Run this in Azure Cloud Shell. It creates an app that can only read, and prints its details.",
171
211
  },
172
212
  ],
173
213
  configFields: [
@@ -187,6 +227,11 @@ exports.CloudConnectionCatalog = [
187
227
  required: true,
188
228
  placeholder: "00000000-0000-0000-0000-000000000000",
189
229
  },
230
+ readScopeField({
231
+ one: { label: "This subscription" },
232
+ every: { label: "Every subscription in the tenant" },
233
+ description: "One subscription, or every subscription of the tenant. The command changes with it.",
234
+ }),
190
235
  {
191
236
  key: "subscriptionIds",
192
237
  title: "Subscriptions",
@@ -210,6 +255,14 @@ exports.CloudConnectionCatalog = [
210
255
  isAdvanced: true,
211
256
  },
212
257
  readIntervalField(5),
258
+ {
259
+ key: exports.AZURE_SECRET_EXPIRES_AT_KEY,
260
+ title: "Client secret expires",
261
+ description: "When the client secret stops working, as the setup command printed it.",
262
+ type: "text",
263
+ required: false,
264
+ isHidden: true,
265
+ },
213
266
  ],
214
267
  secretFields: [
215
268
  {
@@ -227,8 +280,8 @@ exports.CloudConnectionCatalog = [
227
280
  provider: CloudPlatform_1.CloudProvider.GCP,
228
281
  title: "Google Cloud",
229
282
  description: "Compute Engine, Cloud SQL, Cloud Run, buckets and more, read from Cloud Monitoring.",
230
- summary: "Every resource that reports to Cloud Monitoring in your projects, with its key metrics.",
231
- explanation: "OneUptime can only read metrics.",
283
+ summary: "Every resource in your projects, with its key metrics and what changed.",
284
+ explanation: "OneUptime can only read: metrics, resources and the audit log. Never data or secrets.",
232
285
  icon: IconProp_1.default.Cloud,
233
286
  docsPath: "/docs/telemetry/cloud-accounts#google-cloud",
234
287
  shellTitle: "Google Cloud Shell",
@@ -237,11 +290,16 @@ exports.CloudConnectionCatalog = [
237
290
  {
238
291
  method: CloudConnectionAuthMethod.GcpServiceAccountKey,
239
292
  title: "Service account",
240
- description: "A service account with the Monitoring Viewer role.",
241
- hint: "Run this in Cloud Shell, in the project to monitor. It creates a service account with the Monitoring Viewer role, and prints its key.",
293
+ description: "A service account with the Monitoring Viewer, Cloud Asset Viewer and Logs Viewer roles.",
294
+ hint: "Run this in Cloud Shell, in the project to monitor. It creates a service account that can only read, and prints its key.",
242
295
  },
243
296
  ],
244
297
  configFields: [
298
+ readScopeField({
299
+ one: { label: "This project" },
300
+ every: { label: "Every project in the organization" },
301
+ description: "One project, or every project of the organization. The command changes with it.",
302
+ }),
245
303
  {
246
304
  key: "projectIds",
247
305
  title: "Projects",
@@ -1,9 +1,11 @@
1
1
  import commonJsModule from "./CloudConnectionCatalog.js";
2
+ export const AZURE_SECRET_EXPIRES_AT_KEY = commonJsModule.AZURE_SECRET_EXPIRES_AT_KEY;
2
3
  export const CLOUD_CONNECTION_DERIVED_CONFIG_KEYS = commonJsModule.CLOUD_CONNECTION_DERIVED_CONFIG_KEYS;
3
4
  export const CLOUD_CONNECTION_READ_INTERVALS = commonJsModule.CLOUD_CONNECTION_READ_INTERVALS;
4
5
  export const CloudConnectionAuthMethod = commonJsModule.CloudConnectionAuthMethod;
5
6
  export const CloudConnectionCatalog = commonJsModule.CloudConnectionCatalog;
6
7
  export const READ_INTERVAL_FIELD_KEY = commonJsModule.READ_INTERVAL_FIELD_KEY;
8
+ export const READ_SCOPE_FIELD_KEY = commonJsModule.READ_SCOPE_FIELD_KEY;
7
9
  export const getCloudConnectionAuthMethod = commonJsModule.getCloudConnectionAuthMethod;
8
10
  export const getCloudConnectionAuthMethodDefinition = commonJsModule.getCloudConnectionAuthMethodDefinition;
9
11
  export const getCloudConnectionDefinition = commonJsModule.getCloudConnectionDefinition;
@@ -18,7 +18,8 @@ const CloudConnectionCatalog_1 = require("./CloudConnectionCatalog");
18
18
  * - AWS, IAM role: the role's ARN;
19
19
  * - AWS, access key: the AccessKey JSON create-access-key prints, or the
20
20
  * two values on their own;
21
- * - Azure: the appId, password and tenant JSON create-for-rbac prints;
21
+ * - Azure: the appId, password and tenant JSON create-for-rbac prints,
22
+ * and the endDateTime the setup command adds to it;
22
23
  * - Google Cloud: the service account key JSON.
23
24
  *
24
25
  * Every reader runs in time linear in the text, which is held to
@@ -229,6 +230,11 @@ function readAzure(text) {
229
230
  if (clientId) {
230
231
  config["clientId"] = clientId;
231
232
  }
233
+ // When the password stops working, as the setup command adds it.
234
+ const expiresAt = Date.parse(readString(object["endDateTime"]));
235
+ if (Number.isFinite(expiresAt)) {
236
+ config[CloudConnectionCatalog_1.AZURE_SECRET_EXPIRES_AT_KEY] = new Date(expiresAt).toISOString();
237
+ }
232
238
  return {
233
239
  config,
234
240
  secrets: clientSecret ? { clientSecret } : {},
@@ -2,12 +2,41 @@ import { CloudProvider } from "../Cloud/CloudPlatform.mjs";
2
2
  import { CloudConnectionAuthMethod } from "./CloudConnectionCatalog.mjs";
3
3
  export declare const CLOUD_CONNECTION_READ_ONLY_NAME: string;
4
4
  export declare const GCP_SERVICE_ACCOUNT_ID: string;
5
+ export declare enum CloudConnectionSetupScope {
6
+ Account = "account",
7
+ Organization = "organization"
8
+ }
9
+ export interface AwsReadOnlyActionGroup {
10
+ purpose: string;
11
+ actions: Array<string>;
12
+ }
13
+ export declare const AWS_READ_ONLY_ACTION_GROUPS: Array<AwsReadOnlyActionGroup>;
14
+ export declare const AWS_ORGANIZATION_ACTION_GROUP: AwsReadOnlyActionGroup;
5
15
  export declare const AWS_READ_ONLY_ACTIONS: Array<string>;
16
+ export declare const AWS_SCOPED_READ_RESOURCES: Record<string, Array<string>>;
6
17
  export declare const AZURE_READ_ONLY_ROLE: string;
7
18
  export declare const GCP_READ_ONLY_ROLE: string;
19
+ export declare const GCP_INVENTORY_ROLE: string;
20
+ export declare const GCP_AUDIT_LOG_ROLE: string;
21
+ export declare const GCP_SERVICE_HEALTH_ROLE: string;
22
+ export declare const GCP_READ_ONLY_ROLES: Array<string>;
23
+ export declare const GCP_SERVICES: Array<string>;
8
24
  export declare function getAwsExternalIdForProject(projectId: string): string;
9
25
  export declare function getAwsRoleNameForExternalId(externalId: string): string;
10
- export declare function getAwsReadOnlyPolicyDocument(): string;
26
+ export declare function getAwsOrganizationStackSetName(externalId: string): string;
27
+ export declare function getAwsReadOnlyPolicy(options?: {
28
+ organization?: boolean | undefined;
29
+ }): {
30
+ Version: string;
31
+ Statement: Array<{
32
+ Effect: string;
33
+ Action: Array<string>;
34
+ Resource: string | Array<string>;
35
+ }>;
36
+ };
37
+ export declare function getAwsReadOnlyPolicyDocument(options?: {
38
+ organization?: boolean | undefined;
39
+ }): string;
11
40
  export declare function getAwsTrustPolicyDocument(data: {
12
41
  trustedPrincipalArn: string;
13
42
  externalId: string;
@@ -15,15 +44,26 @@ export declare function getAwsTrustPolicyDocument(data: {
15
44
  export declare function getAwsRoleSetupCommand(data: {
16
45
  trustedPrincipalArn: string;
17
46
  externalId: string;
47
+ organization?: boolean | undefined;
48
+ }): string;
49
+ export declare function getAwsReadOnlyRoleTemplate(data: {
50
+ trustedPrincipalArn: string;
51
+ externalId: string;
52
+ }): string;
53
+ export declare function getAwsOrganizationSetupCommand(data: {
54
+ trustedPrincipalArn: string;
55
+ externalId: string;
18
56
  }): string;
19
57
  export declare function getAwsAccessKeySetupCommand(): string;
20
- export declare function getAzureSetupCommand(): string;
21
- export declare function getGcpSetupCommand(): string;
58
+ export declare function getAzureSetupCommand(scope?: CloudConnectionSetupScope): string;
59
+ export declare function getGcpSetupCommand(scope?: CloudConnectionSetupScope): string;
22
60
  export interface CloudConnectionCommandContext {
23
61
  trustedPrincipalArn?: string | undefined;
24
62
  externalId?: string | undefined;
63
+ scope?: CloudConnectionSetupScope | undefined;
25
64
  }
26
65
  export declare function getCloudConnectionSetupCommand(provider: CloudProvider, method: CloudConnectionAuthMethod, context?: CloudConnectionCommandContext): string | undefined;
66
+ export declare function canSetUpOrganization(provider: CloudProvider, method: CloudConnectionAuthMethod): boolean;
27
67
  export interface CloudConnectionAwsRoleSetup {
28
68
  isAvailable: boolean;
29
69
  trustedPrincipalArn?: string | undefined;