@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
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLOUD_ENDPOINT_MAX_MONITOR_HOSTS = void 0;
4
+ exports.getCloudEndpointComparisonNames = getCloudEndpointComparisonNames;
5
+ exports.getMonitorDestinationHosts = getMonitorDestinationHosts;
6
+ exports.matchCloudEndpoints = matchCloudEndpoints;
7
+ const CloudInventory_1 = require("./CloudInventory");
8
+ /*
9
+ * WHICH CLOUD RESOURCE A MONITOR CHECKS, BY THE HOST IT CHECKS.
10
+ *
11
+ * A website, API, SSL, ping or port monitor names a host; a cloud
12
+ * account's inventory says which host names and addresses each resource
13
+ * answers on (CloudResource.cloudEndpoints): a load balancer's DNS name, a
14
+ * CloudFront distribution's, an API Gateway stage's, an App Service's, a
15
+ * Cloud Run service's, an instance's public address. The monitor's host is
16
+ * rarely one of those itself - "shop.example.com" is a CNAME to the load
17
+ * balancer - so the server follows the host's CNAME chain and resolves its
18
+ * addresses (CloudEndpointSuggestions), and every name met on the way is
19
+ * compared here.
20
+ *
21
+ * A match is a suggestion, never a link: the monitor's Linked Resources
22
+ * card offers it, and a person links it.
23
+ */
24
+ // The hosts of a monitor read, at most: a monitor has a few steps.
25
+ exports.CLOUD_ENDPOINT_MAX_MONITOR_HOSTS = 10;
26
+ /*
27
+ * How AWS writes a load balancer's name in an alias or a CNAME:
28
+ * "dualstack." before the name the load balancer itself reports.
29
+ */
30
+ const DUALSTACK_PREFIX = "dualstack.";
31
+ // The spellings a name is compared under: as written, and without "dualstack.".
32
+ function getCloudEndpointComparisonNames(name) {
33
+ const host = (0, CloudInventory_1.normalizeCloudHost)(name);
34
+ if (!host) {
35
+ return [];
36
+ }
37
+ return host.startsWith(DUALSTACK_PREFIX) &&
38
+ host.length > DUALSTACK_PREFIX.length
39
+ ? [host, host.slice(DUALSTACK_PREFIX.length)]
40
+ : [host];
41
+ }
42
+ // A destination as written: a string, or a URL, Hostname or IP (or their JSON).
43
+ function destinationText(destination) {
44
+ if (typeof destination === "string") {
45
+ return destination;
46
+ }
47
+ if (!destination || typeof destination !== "object") {
48
+ return "";
49
+ }
50
+ const record = destination;
51
+ // The JSON form: { _type: "URL", value: "https://..." }.
52
+ if (typeof record["value"] === "string") {
53
+ return record["value"];
54
+ }
55
+ const text = String(destination);
56
+ return text === "[object Object]" ? "" : text;
57
+ }
58
+ // The steps of a monitor's monitorSteps, in either its class or its JSON form.
59
+ function readSteps(monitorSteps) {
60
+ if (!monitorSteps || typeof monitorSteps !== "object") {
61
+ return [];
62
+ }
63
+ const record = monitorSteps;
64
+ const holder = record["data"] || record["value"];
65
+ const steps = holder && typeof holder === "object"
66
+ ? holder["monitorStepsInstanceArray"]
67
+ : undefined;
68
+ return Array.isArray(steps) ? steps : [];
69
+ }
70
+ /*
71
+ * The hosts a monitor checks: each step's destination, normalized (a URL's
72
+ * host, a host name, an address), without repeats, at most
73
+ * CLOUD_ENDPOINT_MAX_MONITOR_HOSTS.
74
+ */
75
+ function getMonitorDestinationHosts(monitorSteps) {
76
+ const hosts = [];
77
+ for (const step of readSteps(monitorSteps)) {
78
+ if (hosts.length >= exports.CLOUD_ENDPOINT_MAX_MONITOR_HOSTS) {
79
+ break;
80
+ }
81
+ if (!step || typeof step !== "object") {
82
+ continue;
83
+ }
84
+ const stepRecord = step;
85
+ const data = stepRecord["data"] || stepRecord["value"];
86
+ if (!data || typeof data !== "object") {
87
+ continue;
88
+ }
89
+ const host = (0, CloudInventory_1.normalizeCloudHost)(destinationText(data["monitorDestination"]));
90
+ if (host && !hosts.includes(host)) {
91
+ hosts.push(host);
92
+ }
93
+ }
94
+ return hosts;
95
+ }
96
+ /*
97
+ * The resources that answer on one of the names, each once, by the first
98
+ * name that matches (the monitor's own host before its CNAMEs, those
99
+ * before its addresses), sorted by name.
100
+ */
101
+ function matchCloudEndpoints(data) {
102
+ const suggestions = [];
103
+ const seen = new Set();
104
+ for (const candidate of data.candidates) {
105
+ if (!candidate.id || seen.has(candidate.id)) {
106
+ continue;
107
+ }
108
+ const endpoints = new Set((0, CloudInventory_1.readCloudEndpoints)(candidate.endpoints).flatMap((endpoint) => {
109
+ return getCloudEndpointComparisonNames(endpoint);
110
+ }));
111
+ for (const name of data.names) {
112
+ const matched = getCloudEndpointComparisonNames(name.name).find((spelling) => {
113
+ return endpoints.has(spelling);
114
+ });
115
+ if (!matched) {
116
+ continue;
117
+ }
118
+ seen.add(candidate.id);
119
+ suggestions.push({
120
+ cloudResourceId: candidate.id,
121
+ name: candidate.name,
122
+ type: candidate.type,
123
+ provider: candidate.provider,
124
+ endpoint: matched,
125
+ via: name.via,
126
+ });
127
+ break;
128
+ }
129
+ }
130
+ return suggestions.sort((a, b) => {
131
+ return (a.name.localeCompare(b.name) ||
132
+ a.cloudResourceId.localeCompare(b.cloudResourceId));
133
+ });
134
+ }
@@ -0,0 +1,5 @@
1
+ import commonJsModule from "./CloudEndpointMatch.js";
2
+ export const CLOUD_ENDPOINT_MAX_MONITOR_HOSTS = commonJsModule.CLOUD_ENDPOINT_MAX_MONITOR_HOSTS;
3
+ export const getCloudEndpointComparisonNames = commonJsModule.getCloudEndpointComparisonNames;
4
+ export const getMonitorDestinationHosts = commonJsModule.getMonitorDestinationHosts;
5
+ export const matchCloudEndpoints = commonJsModule.matchCloudEndpoints;
@@ -0,0 +1,34 @@
1
+ import { JSONObject } from "../JSON.mjs";
2
+ export declare const CLOUD_TAGS_MAX: number;
3
+ export declare const CLOUD_TAG_KEY_MAX_LENGTH: number;
4
+ export declare const CLOUD_TAG_VALUE_MAX_LENGTH: number;
5
+ export declare const CLOUD_PROPERTIES_MAX_BYTES: number;
6
+ export declare const CLOUD_PROPERTY_VALUE_MAX_LENGTH: number;
7
+ export declare const CLOUD_RELATIONSHIPS_MAX: number;
8
+ export declare const CLOUD_ENDPOINTS_MAX: number;
9
+ export declare enum CloudRelationshipKind {
10
+ RunsIn = "runs-in",
11
+ PartOf = "part-of",
12
+ RoutesTo = "routes-to",
13
+ ProtectedBy = "protected-by",
14
+ AttachedTo = "attached-to",
15
+ DeadLettersTo = "dead-letters-to"
16
+ }
17
+ export declare const CLOUD_RELATIONSHIP_LABELS: Readonly<Record<CloudRelationshipKind, string>>;
18
+ export interface CloudResourceRelationship {
19
+ kind: CloudRelationshipKind;
20
+ target: string;
21
+ targetType?: string | undefined;
22
+ }
23
+ export declare function isCloudRelationshipKind(value: unknown): value is CloudRelationshipKind;
24
+ export declare function normalizeCloudTags(raw: unknown): Record<string, string>;
25
+ export declare function readCloudPath(source: unknown, path: string): unknown;
26
+ export declare function pickCloudProperties(source: unknown, paths: ReadonlyArray<string>): JSONObject;
27
+ export declare function boundCloudRelationships(relationships: ReadonlyArray<CloudResourceRelationship>): Array<CloudResourceRelationship>;
28
+ export declare function readCloudRelationships(value: unknown): Array<CloudResourceRelationship>;
29
+ export declare function normalizeCloudHost(value: unknown): string;
30
+ export declare function normalizeCloudEndpoints(values: ReadonlyArray<unknown>): Array<string>;
31
+ export declare function readCloudEndpoints(value: unknown): Array<string>;
32
+ export declare function readCloudTags(value: unknown): Record<string, string>;
33
+ export declare function flattenCloudProperties(properties: unknown): Record<string, string>;
34
+ export declare function getCloudTagRuleMatchValues(tags: unknown): Array<string>;
@@ -0,0 +1,34 @@
1
+ import { JSONObject } from "../JSON";
2
+ export declare const CLOUD_TAGS_MAX: number;
3
+ export declare const CLOUD_TAG_KEY_MAX_LENGTH: number;
4
+ export declare const CLOUD_TAG_VALUE_MAX_LENGTH: number;
5
+ export declare const CLOUD_PROPERTIES_MAX_BYTES: number;
6
+ export declare const CLOUD_PROPERTY_VALUE_MAX_LENGTH: number;
7
+ export declare const CLOUD_RELATIONSHIPS_MAX: number;
8
+ export declare const CLOUD_ENDPOINTS_MAX: number;
9
+ export declare enum CloudRelationshipKind {
10
+ RunsIn = "runs-in",
11
+ PartOf = "part-of",
12
+ RoutesTo = "routes-to",
13
+ ProtectedBy = "protected-by",
14
+ AttachedTo = "attached-to",
15
+ DeadLettersTo = "dead-letters-to"
16
+ }
17
+ export declare const CLOUD_RELATIONSHIP_LABELS: Readonly<Record<CloudRelationshipKind, string>>;
18
+ export interface CloudResourceRelationship {
19
+ kind: CloudRelationshipKind;
20
+ target: string;
21
+ targetType?: string | undefined;
22
+ }
23
+ export declare function isCloudRelationshipKind(value: unknown): value is CloudRelationshipKind;
24
+ export declare function normalizeCloudTags(raw: unknown): Record<string, string>;
25
+ export declare function readCloudPath(source: unknown, path: string): unknown;
26
+ export declare function pickCloudProperties(source: unknown, paths: ReadonlyArray<string>): JSONObject;
27
+ export declare function boundCloudRelationships(relationships: ReadonlyArray<CloudResourceRelationship>): Array<CloudResourceRelationship>;
28
+ export declare function readCloudRelationships(value: unknown): Array<CloudResourceRelationship>;
29
+ export declare function normalizeCloudHost(value: unknown): string;
30
+ export declare function normalizeCloudEndpoints(values: ReadonlyArray<unknown>): Array<string>;
31
+ export declare function readCloudEndpoints(value: unknown): Array<string>;
32
+ export declare function readCloudTags(value: unknown): Record<string, string>;
33
+ export declare function flattenCloudProperties(properties: unknown): Record<string, string>;
34
+ export declare function getCloudTagRuleMatchValues(tags: unknown): Array<string>;
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLOUD_RELATIONSHIP_LABELS = exports.CloudRelationshipKind = exports.CLOUD_ENDPOINTS_MAX = exports.CLOUD_RELATIONSHIPS_MAX = exports.CLOUD_PROPERTY_VALUE_MAX_LENGTH = exports.CLOUD_PROPERTIES_MAX_BYTES = exports.CLOUD_TAG_VALUE_MAX_LENGTH = exports.CLOUD_TAG_KEY_MAX_LENGTH = exports.CLOUD_TAGS_MAX = void 0;
4
+ exports.isCloudRelationshipKind = isCloudRelationshipKind;
5
+ exports.normalizeCloudTags = normalizeCloudTags;
6
+ exports.readCloudPath = readCloudPath;
7
+ exports.pickCloudProperties = pickCloudProperties;
8
+ exports.boundCloudRelationships = boundCloudRelationships;
9
+ exports.readCloudRelationships = readCloudRelationships;
10
+ exports.normalizeCloudHost = normalizeCloudHost;
11
+ exports.normalizeCloudEndpoints = normalizeCloudEndpoints;
12
+ exports.readCloudEndpoints = readCloudEndpoints;
13
+ exports.readCloudTags = readCloudTags;
14
+ exports.flattenCloudProperties = flattenCloudProperties;
15
+ exports.getCloudTagRuleMatchValues = getCloudTagRuleMatchValues;
16
+ /*
17
+ * WHAT A CLOUD ACCOUNT'S INVENTORY SAYS ABOUT A RESOURCE, BEYOND ITS METRICS.
18
+ *
19
+ * A cloud connection's inventory lists every resource of an account the way
20
+ * the cloud's own index lists it - AWS Cloud Control, Azure Resource Graph,
21
+ * Google Cloud Asset Inventory - and keeps four things on each Cloud
22
+ * Resource besides what its metrics say:
23
+ *
24
+ * - its tags (AWS tags, Azure tags, Google Cloud labels), which the label
25
+ * and owner rules can match;
26
+ * - a few properties: the ones a person reads first (an instance's type,
27
+ * a database's engine and version, a function's runtime) and never
28
+ * anything that can hold a secret - a Lambda function's environment, an
29
+ * instance's user data, a connection string;
30
+ * - its relationships: what it runs in, what it is part of, what traffic it
31
+ * sends on to - the edges of the account's topology;
32
+ * - its endpoints: the host names and addresses it answers on, which is
33
+ * how a website monitor is linked to the load balancer behind it.
34
+ *
35
+ * Everything is bounded as it is written (normalizeCloudTags,
36
+ * pickCloudProperties, boundCloudRelationships, normalizeCloudEndpoints): a
37
+ * resource with a thousand tags or a megabyte of configuration costs a row
38
+ * no more than one with a few.
39
+ */
40
+ exports.CLOUD_TAGS_MAX = 50;
41
+ exports.CLOUD_TAG_KEY_MAX_LENGTH = 128;
42
+ exports.CLOUD_TAG_VALUE_MAX_LENGTH = 256;
43
+ exports.CLOUD_PROPERTIES_MAX_BYTES = 8 * 1024;
44
+ exports.CLOUD_PROPERTY_VALUE_MAX_LENGTH = 512;
45
+ exports.CLOUD_RELATIONSHIPS_MAX = 100;
46
+ exports.CLOUD_ENDPOINTS_MAX = 50;
47
+ var CloudRelationshipKind;
48
+ (function (CloudRelationshipKind) {
49
+ // A resource runs in a network: an instance in a subnet or a VPC.
50
+ CloudRelationshipKind["RunsIn"] = "runs-in";
51
+ /*
52
+ * A resource is part of a larger one: an instance of a scaling group, a
53
+ * database instance of its cluster, a service of its ECS cluster.
54
+ */
55
+ CloudRelationshipKind["PartOf"] = "part-of";
56
+ /*
57
+ * Traffic goes on to it: a load balancer to its targets, a CDN to its
58
+ * origin, a topic to its subscribers.
59
+ */
60
+ CloudRelationshipKind["RoutesTo"] = "routes-to";
61
+ // A firewall or security group guards it.
62
+ CloudRelationshipKind["ProtectedBy"] = "protected-by";
63
+ // It is attached to another resource: a disk to a VM, an interface to it.
64
+ CloudRelationshipKind["AttachedTo"] = "attached-to";
65
+ // Messages it cannot process go there: a queue's dead-letter queue.
66
+ CloudRelationshipKind["DeadLettersTo"] = "dead-letters-to";
67
+ })(CloudRelationshipKind || (exports.CloudRelationshipKind = CloudRelationshipKind = {}));
68
+ exports.CLOUD_RELATIONSHIP_LABELS = {
69
+ [CloudRelationshipKind.RunsIn]: "Runs in",
70
+ [CloudRelationshipKind.PartOf]: "Part of",
71
+ [CloudRelationshipKind.RoutesTo]: "Sends traffic to",
72
+ [CloudRelationshipKind.ProtectedBy]: "Protected by",
73
+ [CloudRelationshipKind.AttachedTo]: "Attached to",
74
+ [CloudRelationshipKind.DeadLettersTo]: "Dead letters go to",
75
+ };
76
+ function isCloudRelationshipKind(value) {
77
+ return (typeof value === "string" &&
78
+ Object.values(CloudRelationshipKind).includes(value));
79
+ }
80
+ // A value as text: strings trimmed, numbers and booleans as written.
81
+ function asText(value) {
82
+ if (typeof value === "string") {
83
+ return value.trim();
84
+ }
85
+ if (typeof value === "number" || typeof value === "boolean") {
86
+ return String(value);
87
+ }
88
+ return "";
89
+ }
90
+ function clamp(value, maxLength) {
91
+ return value.length <= maxLength ? value : value.slice(0, maxLength);
92
+ }
93
+ /*
94
+ * Tags as one flat map, whichever shape the cloud wrote them in - AWS's
95
+ * [{ Key, Value }] list, Azure's and Google Cloud's { key: value } map -
96
+ * with at most CLOUD_TAGS_MAX entries, keys and values clamped, empty keys
97
+ * dropped and the first spelling of a repeated key kept. AWS's own
98
+ * `aws:` tags (aws:cloudformation:stack-name) are kept: they say which
99
+ * stack declares the resource.
100
+ */
101
+ function normalizeCloudTags(raw) {
102
+ var _a, _b;
103
+ const tags = {};
104
+ let count = 0;
105
+ const add = (key, value) => {
106
+ if (count >= exports.CLOUD_TAGS_MAX) {
107
+ return;
108
+ }
109
+ const name = clamp(asText(key), exports.CLOUD_TAG_KEY_MAX_LENGTH);
110
+ if (!name || Object.prototype.hasOwnProperty.call(tags, name)) {
111
+ return;
112
+ }
113
+ tags[name] = clamp(asText(value), exports.CLOUD_TAG_VALUE_MAX_LENGTH);
114
+ count++;
115
+ };
116
+ if (Array.isArray(raw)) {
117
+ for (const entry of raw) {
118
+ if (entry && typeof entry === "object" && !Array.isArray(entry)) {
119
+ const record = entry;
120
+ add((_a = record["Key"]) !== null && _a !== void 0 ? _a : record["key"], (_b = record["Value"]) !== null && _b !== void 0 ? _b : record["value"]);
121
+ }
122
+ }
123
+ return tags;
124
+ }
125
+ if (raw && typeof raw === "object") {
126
+ for (const key of Object.keys(raw)) {
127
+ add(key, raw[key]);
128
+ }
129
+ }
130
+ return tags;
131
+ }
132
+ // The value at a dotted path ("Endpoint.Address"), or undefined.
133
+ function readCloudPath(source, path) {
134
+ let current = source;
135
+ for (const part of path.split(".")) {
136
+ if (!current || typeof current !== "object" || Array.isArray(current)) {
137
+ return undefined;
138
+ }
139
+ current = current[part];
140
+ }
141
+ return current;
142
+ }
143
+ /*
144
+ * A property value fit to keep: text clamped, numbers and booleans as they
145
+ * are, a list of short values kept (clamped to twenty), anything else - an
146
+ * object, a long list of objects - left out.
147
+ */
148
+ function keepableValue(value) {
149
+ if (typeof value === "string") {
150
+ const text = value.trim();
151
+ return text ? clamp(text, exports.CLOUD_PROPERTY_VALUE_MAX_LENGTH) : undefined;
152
+ }
153
+ if (typeof value === "number" && Number.isFinite(value)) {
154
+ return value;
155
+ }
156
+ if (typeof value === "boolean") {
157
+ return value;
158
+ }
159
+ if (Array.isArray(value)) {
160
+ const items = [];
161
+ for (const item of value.slice(0, 20)) {
162
+ const kept = typeof item === "object" ? undefined : keepableValue(item);
163
+ if (kept !== undefined) {
164
+ items.push(kept);
165
+ }
166
+ }
167
+ return items.length > 0 ? items : undefined;
168
+ }
169
+ return undefined;
170
+ }
171
+ /*
172
+ * The properties a resource keeps: only the dotted paths its type names,
173
+ * each written under its path ("Endpoint.Address": "db.example.com"), and
174
+ * only while the whole stays under CLOUD_PROPERTIES_MAX_BYTES. A type names
175
+ * no path that can hold a secret, so nothing else of what the cloud
176
+ * returned is stored.
177
+ */
178
+ function pickCloudProperties(source, paths) {
179
+ const kept = {};
180
+ let size = 2;
181
+ for (const path of paths) {
182
+ const value = keepableValue(readCloudPath(source, path));
183
+ if (value === undefined) {
184
+ continue;
185
+ }
186
+ const entrySize = path.length + JSON.stringify(value).length + 4;
187
+ if (size + entrySize > exports.CLOUD_PROPERTIES_MAX_BYTES) {
188
+ break;
189
+ }
190
+ kept[path] = value;
191
+ size += entrySize;
192
+ }
193
+ return kept;
194
+ }
195
+ /*
196
+ * Relationships as they are kept: known kinds only, a target each, no two
197
+ * alike, at most CLOUD_RELATIONSHIPS_MAX.
198
+ */
199
+ function boundCloudRelationships(relationships) {
200
+ const kept = [];
201
+ const seen = new Set();
202
+ for (const relationship of relationships) {
203
+ if (kept.length >= exports.CLOUD_RELATIONSHIPS_MAX) {
204
+ break;
205
+ }
206
+ const target = clamp(asText(relationship.target), exports.CLOUD_PROPERTY_VALUE_MAX_LENGTH);
207
+ if (!target || !isCloudRelationshipKind(relationship.kind)) {
208
+ continue;
209
+ }
210
+ const key = `${relationship.kind}|${target.toLowerCase()}`;
211
+ if (seen.has(key)) {
212
+ continue;
213
+ }
214
+ seen.add(key);
215
+ const entry = {
216
+ kind: relationship.kind,
217
+ target,
218
+ };
219
+ const targetType = asText(relationship.targetType);
220
+ if (targetType) {
221
+ entry.targetType = clamp(targetType, 128);
222
+ }
223
+ kept.push(entry);
224
+ }
225
+ return kept;
226
+ }
227
+ // The relationships kept on a row, read back: anything malformed is skipped.
228
+ function readCloudRelationships(value) {
229
+ if (!Array.isArray(value)) {
230
+ return [];
231
+ }
232
+ const relationships = [];
233
+ for (const entry of value) {
234
+ if (entry && typeof entry === "object" && !Array.isArray(entry)) {
235
+ const record = entry;
236
+ const target = asText(record["target"]);
237
+ if (target && isCloudRelationshipKind(record["kind"])) {
238
+ relationships.push({
239
+ kind: record["kind"],
240
+ target,
241
+ targetType: asText(record["targetType"]) || undefined,
242
+ });
243
+ }
244
+ }
245
+ }
246
+ return relationships;
247
+ }
248
+ /*
249
+ * A host name as it is compared: lower case, without a scheme, a path, a
250
+ * port or the root's trailing dot ("https://Shop.example.com:443/x" ->
251
+ * "shop.example.com"). An IPv6 address keeps its brackets' contents. "" for
252
+ * anything that is not a host.
253
+ */
254
+ function normalizeCloudHost(value) {
255
+ let text = asText(value).toLowerCase();
256
+ if (!text) {
257
+ return "";
258
+ }
259
+ const scheme = text.indexOf("://");
260
+ if (scheme >= 0) {
261
+ text = text.slice(scheme + 3);
262
+ }
263
+ for (const separator of ["/", "?", "#"]) {
264
+ const index = text.indexOf(separator);
265
+ if (index >= 0) {
266
+ text = text.slice(0, index);
267
+ }
268
+ }
269
+ const at = text.lastIndexOf("@");
270
+ if (at >= 0) {
271
+ text = text.slice(at + 1);
272
+ }
273
+ if (text.startsWith("[")) {
274
+ const close = text.indexOf("]");
275
+ return close > 1 ? text.slice(1, close) : "";
276
+ }
277
+ const colon = text.indexOf(":");
278
+ // One colon is a port; more is an IPv6 address written bare.
279
+ if (colon >= 0 && text.indexOf(":", colon + 1) < 0) {
280
+ text = text.slice(0, colon);
281
+ }
282
+ while (text.endsWith(".")) {
283
+ text = text.slice(0, -1);
284
+ }
285
+ if (text.length > 253 || hasWhitespace(text)) {
286
+ return "";
287
+ }
288
+ return text;
289
+ }
290
+ function hasWhitespace(value) {
291
+ for (const character of value) {
292
+ if (character.trim() === "") {
293
+ return true;
294
+ }
295
+ }
296
+ return false;
297
+ }
298
+ // Endpoints as they are kept: normalized hosts, no repeats, at most the limit.
299
+ function normalizeCloudEndpoints(values) {
300
+ const endpoints = [];
301
+ for (const value of values) {
302
+ if (endpoints.length >= exports.CLOUD_ENDPOINTS_MAX) {
303
+ break;
304
+ }
305
+ const host = normalizeCloudHost(value);
306
+ if (host && !endpoints.includes(host)) {
307
+ endpoints.push(host);
308
+ }
309
+ }
310
+ return endpoints;
311
+ }
312
+ // The endpoints kept on a row, read back.
313
+ function readCloudEndpoints(value) {
314
+ return Array.isArray(value) ? normalizeCloudEndpoints(value) : [];
315
+ }
316
+ // The tags kept on a row, read back.
317
+ function readCloudTags(value) {
318
+ return value && typeof value === "object" && !Array.isArray(value)
319
+ ? normalizeCloudTags(value)
320
+ : {};
321
+ }
322
+ // A properties object as "path=value" pairs, one level of nesting deep.
323
+ function flattenCloudProperties(properties) {
324
+ const flat = {};
325
+ if (!properties ||
326
+ typeof properties !== "object" ||
327
+ Array.isArray(properties)) {
328
+ return flat;
329
+ }
330
+ const visit = (value, path) => {
331
+ if (value === null || value === undefined || value === "") {
332
+ return;
333
+ }
334
+ if (typeof value === "object" && !Array.isArray(value)) {
335
+ for (const [key, child] of Object.entries(value)) {
336
+ visit(child, path ? `${path}.${key}` : key);
337
+ }
338
+ return;
339
+ }
340
+ flat[path] = Array.isArray(value)
341
+ ? value
342
+ .map((item) => {
343
+ return typeof item === "object"
344
+ ? JSON.stringify(item)
345
+ : String(item);
346
+ })
347
+ .join(", ")
348
+ : String(value);
349
+ };
350
+ visit(properties, "");
351
+ return flat;
352
+ }
353
+ /*
354
+ * A resource's tags as label and owner rules match them: each written key=value ("team=payments"), so one pattern can say a key, a value or
355
+ * both (^team=payments$, ^env=, =production$).
356
+ */
357
+ function getCloudTagRuleMatchValues(tags) {
358
+ const normalized = readCloudTags(tags);
359
+ return Object.keys(normalized).map((key) => {
360
+ return `${key}=${normalized[key]}`;
361
+ });
362
+ }
@@ -0,0 +1,22 @@
1
+ import commonJsModule from "./CloudInventory.js";
2
+ export const CLOUD_ENDPOINTS_MAX = commonJsModule.CLOUD_ENDPOINTS_MAX;
3
+ export const CLOUD_PROPERTIES_MAX_BYTES = commonJsModule.CLOUD_PROPERTIES_MAX_BYTES;
4
+ export const CLOUD_PROPERTY_VALUE_MAX_LENGTH = commonJsModule.CLOUD_PROPERTY_VALUE_MAX_LENGTH;
5
+ export const CLOUD_RELATIONSHIPS_MAX = commonJsModule.CLOUD_RELATIONSHIPS_MAX;
6
+ export const CLOUD_RELATIONSHIP_LABELS = commonJsModule.CLOUD_RELATIONSHIP_LABELS;
7
+ export const CLOUD_TAGS_MAX = commonJsModule.CLOUD_TAGS_MAX;
8
+ export const CLOUD_TAG_KEY_MAX_LENGTH = commonJsModule.CLOUD_TAG_KEY_MAX_LENGTH;
9
+ export const CLOUD_TAG_VALUE_MAX_LENGTH = commonJsModule.CLOUD_TAG_VALUE_MAX_LENGTH;
10
+ export const CloudRelationshipKind = commonJsModule.CloudRelationshipKind;
11
+ export const boundCloudRelationships = commonJsModule.boundCloudRelationships;
12
+ export const flattenCloudProperties = commonJsModule.flattenCloudProperties;
13
+ export const getCloudTagRuleMatchValues = commonJsModule.getCloudTagRuleMatchValues;
14
+ export const isCloudRelationshipKind = commonJsModule.isCloudRelationshipKind;
15
+ export const normalizeCloudEndpoints = commonJsModule.normalizeCloudEndpoints;
16
+ export const normalizeCloudHost = commonJsModule.normalizeCloudHost;
17
+ export const normalizeCloudTags = commonJsModule.normalizeCloudTags;
18
+ export const pickCloudProperties = commonJsModule.pickCloudProperties;
19
+ export const readCloudEndpoints = commonJsModule.readCloudEndpoints;
20
+ export const readCloudPath = commonJsModule.readCloudPath;
21
+ export const readCloudRelationships = commonJsModule.readCloudRelationships;
22
+ export const readCloudTags = commonJsModule.readCloudTags;
@@ -56,8 +56,10 @@ export interface GcpMonitoredResourceRule extends CloudResourceTypeDescriptor {
56
56
  getFullResourceName?: (labels: Readonly<Record<string, string>>) => string | null;
57
57
  }
58
58
  export declare const GCP_MONITORED_RESOURCE_RULES: ReadonlyArray<GcpMonitoredResourceRule>;
59
+ export declare const INVENTORY_ONLY_RESOURCE_TYPES: ReadonlyArray<CloudResourceTypeDescriptor>;
59
60
  export declare const CLOUD_RESOURCE_TYPES: ReadonlyArray<CloudResourceTypeDescriptor>;
60
61
  export declare function getCloudResourceTypeDescriptor(provider: string | null | undefined, type: string | null | undefined): CloudResourceTypeDescriptor | null;
62
+ export declare function isInventoryOnlyCloudResourceType(provider: string | null | undefined, type: string | null | undefined): boolean;
61
63
  export declare function getCloudResourceTypeLabel(provider: string | null | undefined, type: string | null | undefined): string;
62
64
  export declare function getCanonicalCloudResourceType(provider: string, type: string): string;
63
65
  export declare function getAwsCloudWatchRulesForNamespace(namespace: string): ReadonlyArray<AwsCloudWatchResourceRule>;
@@ -56,8 +56,10 @@ export interface GcpMonitoredResourceRule extends CloudResourceTypeDescriptor {
56
56
  getFullResourceName?: (labels: Readonly<Record<string, string>>) => string | null;
57
57
  }
58
58
  export declare const GCP_MONITORED_RESOURCE_RULES: ReadonlyArray<GcpMonitoredResourceRule>;
59
+ export declare const INVENTORY_ONLY_RESOURCE_TYPES: ReadonlyArray<CloudResourceTypeDescriptor>;
59
60
  export declare const CLOUD_RESOURCE_TYPES: ReadonlyArray<CloudResourceTypeDescriptor>;
60
61
  export declare function getCloudResourceTypeDescriptor(provider: string | null | undefined, type: string | null | undefined): CloudResourceTypeDescriptor | null;
62
+ export declare function isInventoryOnlyCloudResourceType(provider: string | null | undefined, type: string | null | undefined): boolean;
61
63
  export declare function getCloudResourceTypeLabel(provider: string | null | undefined, type: string | null | undefined): string;
62
64
  export declare function getCanonicalCloudResourceType(provider: string, type: string): string;
63
65
  export declare function getAwsCloudWatchRulesForNamespace(namespace: string): ReadonlyArray<AwsCloudWatchResourceRule>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AWS_CLOUDWATCH_DISCOVERY_NAMESPACES = exports.CLOUD_RESOURCE_TYPES = exports.GCP_MONITORED_RESOURCE_RULES = exports.AWS_CLOUDWATCH_RESOURCE_RULES = exports.AWS_RESOURCE_TYPES = exports.AZURE_RESOURCE_TYPES = exports.CLOUD_RESOURCE_CATEGORY_LABELS = exports.CLOUD_SERVICE_MODEL_LABELS = exports.CloudResourceCategory = exports.CloudServiceModel = void 0;
3
+ exports.AWS_CLOUDWATCH_DISCOVERY_NAMESPACES = exports.CLOUD_RESOURCE_TYPES = exports.INVENTORY_ONLY_RESOURCE_TYPES = exports.GCP_MONITORED_RESOURCE_RULES = exports.AWS_CLOUDWATCH_RESOURCE_RULES = exports.AWS_RESOURCE_TYPES = exports.AZURE_RESOURCE_TYPES = exports.CLOUD_RESOURCE_CATEGORY_LABELS = exports.CLOUD_SERVICE_MODEL_LABELS = exports.CloudResourceCategory = exports.CloudServiceModel = void 0;
4
4
  exports.getAwsPartitionForRegion = getAwsPartitionForRegion;
5
5
  exports.getCloudResourceTypeDescriptor = getCloudResourceTypeDescriptor;
6
+ exports.isInventoryOnlyCloudResourceType = isInventoryOnlyCloudResourceType;
6
7
  exports.getCloudResourceTypeLabel = getCloudResourceTypeLabel;
7
8
  exports.getCanonicalCloudResourceType = getCanonicalCloudResourceType;
8
9
  exports.getAwsCloudWatchRulesForNamespace = getAwsCloudWatchRulesForNamespace;
@@ -1110,10 +1111,23 @@ exports.GCP_MONITORED_RESOURCE_RULES = [
1110
1111
  /*
1111
1112
  * ---- Lookups -------------------------------------------------------------
1112
1113
  */
1114
+ /*
1115
+ * ---- Listed only ---------------------------------------------------------
1116
+ *
1117
+ * Types a cloud connection's inventory lists (CloudInventory) that publish
1118
+ * no metrics of their own - the networks other resources run in, which an
1119
+ * account's topology draws them inside. No metric rule finds them, so they
1120
+ * are kept apart from the lists above, which every rule is held to.
1121
+ */
1122
+ exports.INVENTORY_ONLY_RESOURCE_TYPES = [
1123
+ descriptorOf(CloudPlatform_1.CloudProvider.AWS, "AWS::EC2::VPC", "VPC", IAAS, C.Networking),
1124
+ descriptorOf(CloudPlatform_1.CloudProvider.GCP, "compute.googleapis.com/Network", "VPC Network", IAAS, C.Networking),
1125
+ ];
1113
1126
  exports.CLOUD_RESOURCE_TYPES = [
1114
1127
  ...exports.AZURE_RESOURCE_TYPES,
1115
1128
  ...exports.AWS_RESOURCE_TYPES,
1116
1129
  ...exports.GCP_MONITORED_RESOURCE_RULES,
1130
+ ...exports.INVENTORY_ONLY_RESOURCE_TYPES,
1117
1131
  ];
1118
1132
  function typeLookupKey(provider, type) {
1119
1133
  return `${provider.trim().toLowerCase()}|${type.trim().toLowerCase()}`;
@@ -1135,6 +1149,20 @@ function getCloudResourceTypeDescriptor(provider, type) {
1135
1149
  }
1136
1150
  return DESCRIPTORS_BY_TYPE.get(typeLookupKey(provider, type)) || null;
1137
1151
  }
1152
+ const INVENTORY_ONLY_TYPE_KEYS = new Set(exports.INVENTORY_ONLY_RESOURCE_TYPES.map((descriptor) => {
1153
+ return typeLookupKey(descriptor.provider, descriptor.type);
1154
+ }));
1155
+ /*
1156
+ * Whether resources of this type publish no metrics of their own (a
1157
+ * network: INVENTORY_ONLY_RESOURCE_TYPES), whatever case it is spelled in:
1158
+ * a resource's page has none to list, and says nothing about them.
1159
+ */
1160
+ function isInventoryOnlyCloudResourceType(provider, type) {
1161
+ if (!provider || !type) {
1162
+ return false;
1163
+ }
1164
+ return INVENTORY_ONLY_TYPE_KEYS.has(typeLookupKey(provider, type));
1165
+ }
1138
1166
  /*
1139
1167
  * What to call a resource of this type: the catalog's label, or - for a
1140
1168
  * type the catalog does not list - the type itself, so nothing renders