@infrascan/shared-types 0.2.3 → 0.3.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,17 @@
1
1
  # @infrascan/shared-types
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#75](https://github.com/infrascan/infrascan/pull/75) [`4634235`](https://github.com/infrascan/infrascan/commit/4634235d61bd6bd817c6fb9e62add778218b69b6) Thanks [@lfarrel6](https://github.com/lfarrel6)! - Add graph model interface to shared types package
8
+
9
+ ## 0.2.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#56](https://github.com/infrascan/infrascan/pull/56) [`4b6911d`](https://github.com/infrascan/infrascan/commit/4b6911d07cfc846389c30317becdf63e95768386) Thanks [@lfarrel6](https://github.com/lfarrel6)! - Update to include support scanner level retry strategies
14
+
3
15
  ## 0.2.3
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrascan/shared-types",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Shared types for multiple infrascan packages",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/api.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AwsCredentialIdentityProvider } from "@aws-sdk/types";
1
+ import type { AwsCredentialIdentityProvider, RetryStrategy, RetryStrategyV2 } from "@aws-sdk/types";
2
2
 
3
3
  import type { GraphEdge, GraphNode } from "./graph";
4
4
  import type { BaseEdgeResolver } from "./config";
@@ -73,6 +73,7 @@ export interface Connector {
73
73
  type ClientBuilder<T, P extends Provider> = (
74
74
  credentials: AwsCredentialIdentityProvider,
75
75
  context: ProviderContextMap[P],
76
+ retryStrategy?: RetryStrategy | RetryStrategyV2
76
77
  ) => T;
77
78
 
78
79
  type GetterFn<T, P extends Provider> = (
package/src/graph.ts CHANGED
@@ -68,3 +68,38 @@ export type EdgeTarget = {
68
68
  name: string;
69
69
  target: string;
70
70
  };
71
+
72
+ export interface Node {
73
+ id: string,
74
+ name: string,
75
+ metadata: Record<string, unknown>;
76
+ service?: string,
77
+ type?: string,
78
+ parent?: string | Node,
79
+ children?: Record<string, Node>,
80
+ incomingEdges: Record<string, Edge<Node>>,
81
+ outgoingEdges: Record<string, Edge<Node>>,
82
+ }
83
+
84
+ export interface Edge<T extends string | Node> {
85
+ id: string,
86
+ name?: string,
87
+ metadata: Record<string, unknown>,
88
+ source: T,
89
+ target: T
90
+ }
91
+
92
+ export interface Graph {
93
+ nodes: Node[],
94
+ edges: Edge<Node>[],
95
+ addNode: (node: Pick<Node, "id" | "name" | "metadata" | "parent" | "service" | "type">) => void,
96
+ addEdge: (edge: Pick<Edge<string>, "name" | "source" | "target" | "metadata">) => void,
97
+ addChild: (parent: string, child: string) => void,
98
+ getNode: (id: string) => Node | undefined,
99
+ mapNodesById: (id: string, mapperFn: (node: Node) => Node[]) => void,
100
+ removeEdge: (id: string) => Edge<Node>,
101
+ removeNode: (id: string) => Node,
102
+ serialize: () => string
103
+ };
104
+
105
+ export type GraphSerializer<T> = (graph: Graph) => T;