@jupiterone/integration-sdk-cli 8.4.1 → 8.4.4
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/dist/src/commands/document.js.map +1 -1
- package/dist/src/commands/neo4j.js +4 -2
- package/dist/src/commands/neo4j.js.map +1 -1
- package/dist/src/commands/visualize-types.js +1 -1
- package/dist/src/commands/visualize-types.js.map +1 -1
- package/dist/src/config.js +2 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/neo4j/neo4jGraphStore.js +25 -9
- package/dist/src/neo4j/neo4jGraphStore.js.map +1 -1
- package/dist/src/neo4j/neo4jUtilities.js +15 -13
- package/dist/src/neo4j/neo4jUtilities.js.map +1 -1
- package/dist/src/neo4j/uploadToNeo4j.js.map +1 -1
- package/dist/src/neo4j/wipeNeo4j.js.map +1 -1
- package/dist/src/visualization/generateVisualization.js +2 -2
- package/dist/src/visualization/generateVisualization.js.map +1 -1
- package/dist/src/visualization/retrieveIntegrationData.js.map +1 -1
- package/dist/src/visualization/utils.d.ts +1 -1
- package/dist/src/visualization/utils.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/commands/document.ts +10 -9
- package/src/commands/neo4j.ts +16 -10
- package/src/commands/visualize-types.ts +7 -9
- package/src/config.ts +2 -1
- package/src/neo4j/README.md +15 -18
- package/src/neo4j/__tests__/neo4jGraphStore.test.ts +55 -53
- package/src/neo4j/__tests__/neo4jUtilities.test.ts +65 -9
- package/src/neo4j/index.ts +1 -1
- package/src/neo4j/neo4jGraphStore.ts +64 -29
- package/src/neo4j/neo4jUtilities.ts +17 -16
- package/src/neo4j/uploadToNeo4j.ts +5 -2
- package/src/neo4j/wipeNeo4j.ts +15 -11
- package/src/visualization/__tests__/createMappedRelationshipNodesAndEdges.test.ts +35 -49
- package/src/visualization/generateVisualization.ts +7 -12
- package/src/visualization/retrieveIntegrationData.ts +3 -5
- package/src/visualization/types/IntegrationData.ts +5 -1
- package/src/visualization/utils.ts +7 -4
- package/tsconfig.dist.json +1 -3
- package/tsconfig.json +1 -3
|
@@ -42,13 +42,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
42
42
|
},
|
|
43
43
|
];
|
|
44
44
|
|
|
45
|
-
const {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
explicitEntities,
|
|
51
|
-
});
|
|
45
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
46
|
+
createMappedRelationshipNodesAndEdges({
|
|
47
|
+
mappedRelationships,
|
|
48
|
+
explicitEntities,
|
|
49
|
+
});
|
|
52
50
|
|
|
53
51
|
expect(mappedRelationshipEdges).toEqual([
|
|
54
52
|
{
|
|
@@ -71,13 +69,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
71
69
|
},
|
|
72
70
|
];
|
|
73
71
|
|
|
74
|
-
const {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
explicitEntities,
|
|
80
|
-
});
|
|
72
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
73
|
+
createMappedRelationshipNodesAndEdges({
|
|
74
|
+
mappedRelationships,
|
|
75
|
+
explicitEntities,
|
|
76
|
+
});
|
|
81
77
|
|
|
82
78
|
expect(mappedRelationshipEdges).toEqual([
|
|
83
79
|
{
|
|
@@ -110,13 +106,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
110
106
|
},
|
|
111
107
|
];
|
|
112
108
|
|
|
113
|
-
const {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
explicitEntities,
|
|
119
|
-
});
|
|
109
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
110
|
+
createMappedRelationshipNodesAndEdges({
|
|
111
|
+
mappedRelationships,
|
|
112
|
+
explicitEntities,
|
|
113
|
+
});
|
|
120
114
|
|
|
121
115
|
expect(mappedRelationshipEdges).toEqual([
|
|
122
116
|
{
|
|
@@ -184,13 +178,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
184
178
|
},
|
|
185
179
|
];
|
|
186
180
|
|
|
187
|
-
const {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
explicitEntities,
|
|
193
|
-
});
|
|
181
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
182
|
+
createMappedRelationshipNodesAndEdges({
|
|
183
|
+
mappedRelationships,
|
|
184
|
+
explicitEntities,
|
|
185
|
+
});
|
|
194
186
|
|
|
195
187
|
expect(mappedRelationshipEdges).toEqual([
|
|
196
188
|
{
|
|
@@ -264,13 +256,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
264
256
|
},
|
|
265
257
|
];
|
|
266
258
|
|
|
267
|
-
const {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
explicitEntities,
|
|
273
|
-
});
|
|
259
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
260
|
+
createMappedRelationshipNodesAndEdges({
|
|
261
|
+
mappedRelationships,
|
|
262
|
+
explicitEntities,
|
|
263
|
+
});
|
|
274
264
|
|
|
275
265
|
expect(mappedRelationshipEdges).toEqual([
|
|
276
266
|
{
|
|
@@ -328,13 +318,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
328
318
|
},
|
|
329
319
|
];
|
|
330
320
|
|
|
331
|
-
const {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
explicitEntities,
|
|
337
|
-
});
|
|
321
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
322
|
+
createMappedRelationshipNodesAndEdges({
|
|
323
|
+
mappedRelationships,
|
|
324
|
+
explicitEntities,
|
|
325
|
+
});
|
|
338
326
|
|
|
339
327
|
expect(mappedRelationshipEdges).toEqual([
|
|
340
328
|
{
|
|
@@ -389,13 +377,11 @@ describe('#createMappedRelationshipNodesAndEdges', () => {
|
|
|
389
377
|
},
|
|
390
378
|
];
|
|
391
379
|
|
|
392
|
-
const {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
explicitEntities,
|
|
398
|
-
});
|
|
380
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
381
|
+
createMappedRelationshipNodesAndEdges({
|
|
382
|
+
mappedRelationships,
|
|
383
|
+
explicitEntities,
|
|
384
|
+
});
|
|
399
385
|
|
|
400
386
|
expect(mappedRelationshipEdges).toEqual([
|
|
401
387
|
{
|
|
@@ -28,11 +28,8 @@ export async function generateVisualization(
|
|
|
28
28
|
log.warn(`Unable to find any files under path: ${graphDataPath}`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
relationships,
|
|
34
|
-
mappedRelationships,
|
|
35
|
-
} = await retrieveIntegrationData(entitiesAndRelationshipPaths);
|
|
31
|
+
const { entities, relationships, mappedRelationships } =
|
|
32
|
+
await retrieveIntegrationData(entitiesAndRelationshipPaths);
|
|
36
33
|
|
|
37
34
|
const nodeDataSets = entities.map((entity) => ({
|
|
38
35
|
id: getNodeIdFromEntity(entity, []),
|
|
@@ -47,13 +44,11 @@ export async function generateVisualization(
|
|
|
47
44
|
}),
|
|
48
45
|
);
|
|
49
46
|
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
explicitEntities: entities,
|
|
56
|
-
});
|
|
47
|
+
const { mappedRelationshipEdges, mappedRelationshipNodes } =
|
|
48
|
+
createMappedRelationshipNodesAndEdges({
|
|
49
|
+
mappedRelationships,
|
|
50
|
+
explicitEntities: entities,
|
|
51
|
+
});
|
|
57
52
|
|
|
58
53
|
await writeFileToPath({
|
|
59
54
|
path: visualizationOutputPath,
|
|
@@ -18,11 +18,9 @@ export async function retrieveIntegrationData(
|
|
|
18
18
|
const mappedRelationships: MappedRelationship[] = [];
|
|
19
19
|
|
|
20
20
|
const entitiesAndRelationships = await Promise.all(
|
|
21
|
-
entitiesAndRelationshipPaths.map(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
),
|
|
21
|
+
entitiesAndRelationshipPaths.map(async (path): Promise<any> => {
|
|
22
|
+
return await readJsonFromPath<any>(path);
|
|
23
|
+
}),
|
|
26
24
|
);
|
|
27
25
|
|
|
28
26
|
for (const item of entitiesAndRelationships) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
ExplicitRelationship,
|
|
4
|
+
MappedRelationship,
|
|
5
|
+
} from '@jupiterone/integration-sdk-core';
|
|
2
6
|
|
|
3
7
|
export interface IntegrationData {
|
|
4
8
|
entities: Entity[];
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { v4 as uuid } from 'uuid';
|
|
2
|
-
import { Entity } from
|
|
2
|
+
import { Entity } from '@jupiterone/integration-sdk-core';
|
|
3
3
|
|
|
4
4
|
export type NodeEntity = Partial<Entity> & { nodeId: string };
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The nodeId should map back to _key, which ought to be globally unique.
|
|
8
8
|
* Entities set their node ID once, and return if available.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* If nodeId is not set, first check that the _key isn't already a nodeId for another entity.
|
|
11
11
|
* Duplicates will break vis.js, so we will set nodeId to a UUID (this makes isNodeDuplicate(nodeEntity) === true)
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* If node is not a duplicate, return either the entity _key, or, if unavailable, return a new UUID.
|
|
14
14
|
*/
|
|
15
|
-
export function getNodeIdFromEntity(
|
|
15
|
+
export function getNodeIdFromEntity(
|
|
16
|
+
entity: Partial<NodeEntity>,
|
|
17
|
+
existingEntities: NodeEntity[],
|
|
18
|
+
): string {
|
|
16
19
|
if (entity.nodeId !== undefined) {
|
|
17
20
|
return entity.nodeId;
|
|
18
21
|
}
|
package/tsconfig.dist.json
CHANGED