@infrascan/shared-types 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @infrascan/shared-types
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#123](https://github.com/infrascan/infrascan/pull/123) [`d05dc6ffe36f6b219964407b63b002520cf89795`](https://github.com/infrascan/infrascan/commit/d05dc6ffe36f6b219964407b63b002520cf89795) Thanks [@lfarrel6](https://github.com/lfarrel6)! - Introduce informational node support
8
+
3
9
  ## 0.6.2
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrascan/shared-types",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Shared types for multiple infrascan packages",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/graph.ts CHANGED
@@ -56,18 +56,6 @@ export interface Node extends BaseState<unknown> {
56
56
  outgoingEdges: ElementRecord<string, Edge, string>;
57
57
  }
58
58
 
59
- export interface NodeOld {
60
- id: string;
61
- name: string;
62
- metadata: Record<string, unknown>;
63
- service?: string;
64
- type?: string;
65
- parent?: ElementType<Node, string>;
66
- children?: ElementRecord<string, Node, string>;
67
- incomingEdges: ElementRecord<string, Edge, string>;
68
- outgoingEdges: ElementRecord<string, Edge, string>;
69
- }
70
-
71
59
  export interface Edge {
72
60
  id: string;
73
61
  name?: string;
package/src/scan.ts CHANGED
@@ -35,22 +35,36 @@ export interface Coordinates {
35
35
  z?: number;
36
36
  }
37
37
 
38
+ /**
39
+ * Indicates how the node should be consumed.
40
+ *
41
+ * - Informational nodes are not likely to be useful when rendered, but may include useful insights for infrastructure comprehension. Informational nodes are unlikely to have edges.
42
+ * - Visual nodes should be considered a superset of informational nodes - they convey information and can be rendered in an obvious way.
43
+ */
44
+ export type NodeClass = "informational" | "visual";
45
+
38
46
  /**
39
47
  * Details about the nodes position in the graph and how it relates to other components
40
48
  */
41
49
  export interface GraphInfo {
42
50
  /**
43
51
  * The unique ID of the node in the graph
52
+ * @deprecated Use Resource.id instead
44
53
  */
45
54
  id: string;
46
55
  /**
47
56
  * The human readable name of the node in the graph
57
+ * @deprecated Use Resource.name instead
48
58
  */
49
59
  label: string;
50
60
  /**
51
61
  * The type of the node, used for assigning an icon in the graph
52
62
  */
53
63
  nodeType: string;
64
+ /**
65
+ * Indicates if the node is intended to be rendered or used for infrastructure comprehension.
66
+ */
67
+ nodeClass: NodeClass;
54
68
  /**
55
69
  * The ID of the parent node, optional.
56
70
  */
@@ -155,6 +169,57 @@ export interface DNS {
155
169
 
156
170
  export type PublicIpStatus = "enabled" | "disabled";
157
171
 
172
+ export type AddressFamily = "ipv4" | "ipv6";
173
+
174
+ export interface ReservedAddresses {
175
+ family: AddressFamily;
176
+ cidrBlock: string;
177
+ cidrBlockAssociationSets?: [
178
+ {
179
+ associationId: string;
180
+ cidrBlock: string;
181
+ state: string;
182
+ stateMessage: string;
183
+ },
184
+ ];
185
+ firstAddress?: string;
186
+ lastAddress?: string;
187
+ }
188
+
189
+ export interface IpRange {
190
+ family?: AddressFamily;
191
+ cidrBlock?: string;
192
+ description?: string;
193
+ }
194
+
195
+ export interface ReferencedAwsSecurityGroup {
196
+ description?: string;
197
+ securityGroupId?: string;
198
+ securityGroupName?: string;
199
+ referencedAccountId?: string;
200
+ referencedVpcId?: string;
201
+ vpcPeeringStatus?: string;
202
+ vpcPeeringConnectionId?: string;
203
+ }
204
+
205
+ export interface PrefixLists {
206
+ description?: string;
207
+ prefixListId?: string;
208
+ }
209
+
210
+ export interface AwsNetworkingRules {
211
+ referencedSecurityGroups?: ReferencedAwsSecurityGroup[];
212
+ prefixLists?: PrefixLists[];
213
+ }
214
+
215
+ export interface NetworkRule {
216
+ fromPort?: number;
217
+ toPort?: number;
218
+ protocol?: string;
219
+ permittedIpRanges?: IpRange[];
220
+ awsConfig?: AwsNetworkingRules;
221
+ }
222
+
158
223
  /**
159
224
  * The network information for a scanned resource which aims to cover both resources being assigned an address
160
225
  * and the networking resource itself (VPC, subnet)
@@ -185,26 +250,12 @@ export interface Network {
185
250
  /**
186
251
  * The IP ranges reserved for a networking resource (VPC, subnet)
187
252
  */
188
- reservedAddresses?: [
189
- {
190
- family: "ipv4" | "ipv6";
191
- cidrBlock: string;
192
- cidrBlockAssociationSets?: [
193
- {
194
- associationId: string;
195
- cidrBlock: string;
196
- state: string;
197
- stateMessage: string;
198
- },
199
- ];
200
- firstAddress: string;
201
- lastAddress: string;
202
- },
203
- ];
253
+ reservedAddresses?: ReservedAddresses[];
204
254
  /**
205
255
  * The information relating to a specific subnet
206
256
  */
207
257
  subnet?: {
258
+ state?: string;
208
259
  ipv6Only?: boolean;
209
260
  availableAddressCount?: number;
210
261
  };
@@ -223,6 +274,7 @@ export interface Network {
223
274
  interfaceId?: string;
224
275
  macAddress?: string;
225
276
  };
277
+ rules?: NetworkRule[];
226
278
  }
227
279
 
228
280
  /**