@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.
Files changed (39) hide show
  1. package/dist/src/commands/document.js.map +1 -1
  2. package/dist/src/commands/neo4j.js +4 -2
  3. package/dist/src/commands/neo4j.js.map +1 -1
  4. package/dist/src/commands/visualize-types.js +1 -1
  5. package/dist/src/commands/visualize-types.js.map +1 -1
  6. package/dist/src/config.js +2 -1
  7. package/dist/src/config.js.map +1 -1
  8. package/dist/src/neo4j/neo4jGraphStore.js +25 -9
  9. package/dist/src/neo4j/neo4jGraphStore.js.map +1 -1
  10. package/dist/src/neo4j/neo4jUtilities.js +15 -13
  11. package/dist/src/neo4j/neo4jUtilities.js.map +1 -1
  12. package/dist/src/neo4j/uploadToNeo4j.js.map +1 -1
  13. package/dist/src/neo4j/wipeNeo4j.js.map +1 -1
  14. package/dist/src/visualization/generateVisualization.js +2 -2
  15. package/dist/src/visualization/generateVisualization.js.map +1 -1
  16. package/dist/src/visualization/retrieveIntegrationData.js.map +1 -1
  17. package/dist/src/visualization/utils.d.ts +1 -1
  18. package/dist/src/visualization/utils.js.map +1 -1
  19. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  20. package/package.json +4 -4
  21. package/src/commands/document.ts +10 -9
  22. package/src/commands/neo4j.ts +16 -10
  23. package/src/commands/visualize-types.ts +7 -9
  24. package/src/config.ts +2 -1
  25. package/src/neo4j/README.md +15 -18
  26. package/src/neo4j/__tests__/neo4jGraphStore.test.ts +55 -53
  27. package/src/neo4j/__tests__/neo4jUtilities.test.ts +65 -9
  28. package/src/neo4j/index.ts +1 -1
  29. package/src/neo4j/neo4jGraphStore.ts +64 -29
  30. package/src/neo4j/neo4jUtilities.ts +17 -16
  31. package/src/neo4j/uploadToNeo4j.ts +5 -2
  32. package/src/neo4j/wipeNeo4j.ts +15 -11
  33. package/src/visualization/__tests__/createMappedRelationshipNodesAndEdges.test.ts +35 -49
  34. package/src/visualization/generateVisualization.ts +7 -12
  35. package/src/visualization/retrieveIntegrationData.ts +3 -5
  36. package/src/visualization/types/IntegrationData.ts +5 -1
  37. package/src/visualization/utils.ts +7 -4
  38. package/tsconfig.dist.json +1 -3
  39. package/tsconfig.json +1 -3
@@ -2,16 +2,13 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- This command assumes you have three additional values stored in your
6
- local .env file:
7
- NEO4J_URI
8
- NEO4J_USER
9
- NEO4J_PASSWORD
5
+ This command assumes you have three additional values stored in your local .env
6
+ file: NEO4J_URI NEO4J_USER NEO4J_PASSWORD
10
7
 
11
- This can be used for uploading to local or remote Neo4j databases. If
12
- SSL is needed for a remote connection, specify `bolt+s` or `bolt+ssc`
13
- in the URI. For easy access to a local Neo4j instance, you can launch
14
- one via a Neo4j provided Docker image with the command:
8
+ This can be used for uploading to local or remote Neo4j databases. If SSL is
9
+ needed for a remote connection, specify `bolt+s` or `bolt+ssc` in the URI. For
10
+ easy access to a local Neo4j instance, you can launch one via a Neo4j provided
11
+ Docker image with the command:
15
12
 
16
13
  ```
17
14
  docker run \
@@ -25,18 +22,18 @@ docker run \
25
22
  neo4j:latest
26
23
  ```
27
24
 
28
- If you would like to use a different username and password, the NEO4J_AUTH
29
- value can be modified to whatever username/password you prefer.
25
+ If you would like to use a different username and password, the NEO4J_AUTH value
26
+ can be modified to whatever username/password you prefer.
30
27
 
31
- NOTE: Future updates are planned to streamline this without removing
32
- the option of pushing to an external Neo4j database.
28
+ NOTE: Future updates are planned to streamline this without removing the option
29
+ of pushing to an external Neo4j database.
33
30
 
34
31
  ## Usage
35
32
 
36
33
  Data is still collected in the same way as before with a call to `yarn start`.
37
34
 
38
- Once data has been collected, you can run `j1-integration neo4j push`. This will
39
- push data to the Neo4j server listed in the NEO4J_URI .env parameter. If
40
- running locally, you can then access data in the Neo4j database by visiting
41
- http://localhost:7474. Alternatively, you can download the full Neo4j
42
- Desktop application at https://neo4j.com/download/.
35
+ Once data has been collected, you can run `j1-integration neo4j push`. This will
36
+ push data to the Neo4j server listed in the NEO4J_URI .env parameter. If running
37
+ locally, you can then access data in the Neo4j database by visiting
38
+ http://localhost:7474. Alternatively, you can download the full Neo4j Desktop
39
+ application at https://neo4j.com/download/.
@@ -1,63 +1,66 @@
1
- import {
2
- mockDriver,
3
- mockSessionFromQuerySet,
4
- QuerySpec
5
- } from 'neo-forgery';
1
+ import { mockDriver, mockSessionFromQuerySet, QuerySpec } from 'neo-forgery';
6
2
  import * as neo4j from 'neo4j-driver';
7
3
  import { Neo4jGraphStore } from '../neo4jGraphStore';
8
4
  import { Entity, Relationship } from '@jupiterone/integration-sdk-core';
9
5
 
10
6
  const testInstanceID = 'testInstanceID';
11
- const testEntityData: Entity[] = [{
12
- _type: "testType",
13
- _class: "testClass",
14
- _key: "testKey",
15
- }];
16
- const testRelationshipData: Relationship[] = [{
17
- _fromEntityKey: "testKey1",
18
- _toEntityKey: "testKey2",
19
- _type: "testRelType",
20
- _key: "relKey",
21
- _class: "testRelationshipClass",
22
- }];
23
- const constraintCall = 'CREATE CONSTRAINT unique_testType IF NOT EXISTS ON (n:testType) ASSERT n._key IS UNIQUE;'
7
+ const testEntityData: Entity[] = [
8
+ {
9
+ _type: 'testType',
10
+ _class: 'testClass',
11
+ _key: 'testKey',
12
+ },
13
+ ];
14
+ const testRelationshipData: Relationship[] = [
15
+ {
16
+ _fromEntityKey: 'testKey1',
17
+ _toEntityKey: 'testKey2',
18
+ _type: 'testRelType',
19
+ _key: 'relKey',
20
+ _class: 'testRelationshipClass',
21
+ },
22
+ ];
23
+ const constraintCall =
24
+ 'CREATE CONSTRAINT unique_testType IF NOT EXISTS ON (n:testType) ASSERT n._key IS UNIQUE;';
24
25
  const addEntityCall = `MERGE (n:testType {_key: 'testKey', _integrationInstanceID: '${testInstanceID}'}) SET n._type = 'testType', n._class = 'testClass';`;
25
26
  const addRelationshipCall = `
26
27
  MATCH (start {_key: 'testKey1', _integrationInstanceID: '${testInstanceID}'})
27
28
  MATCH (end {_key: 'testKey2', _integrationInstanceID: '${testInstanceID}'})
28
- MERGE (start)-[relationship:testRelType]->(end);`
29
+ MERGE (start)-[relationship:testRelType]->(end);`;
29
30
  const wipeByIDCall = `MATCH (n {_integrationInstanceID: '${testInstanceID}'}) DETACH DELETE n`;
30
31
  const wipeAllCall = 'MATCH (n) DETACH DELETE n';
31
- const querySet: QuerySpec[] = [{
32
- name: 'addConstraint',
33
- query: constraintCall,
34
- params: undefined,
35
- output: {records:[]}
36
- },
37
- {
38
- name: 'addEntity',
39
- query: addEntityCall,
40
- params: undefined,
41
- output: {records:[]}
42
- },
43
- {
44
- name: 'addRelationship',
45
- query: addRelationshipCall,
46
- params: undefined,
47
- output: {records:[]}
48
- },
49
- {
50
- name: 'wipeByID',
51
- query: wipeByIDCall,
52
- params: undefined,
53
- output: {records:[]}
54
- },
55
- {
56
- name: 'wipeAll',
57
- query: wipeAllCall,
58
- params: undefined,
59
- output: {records:[]}
60
- }];
32
+ const querySet: QuerySpec[] = [
33
+ {
34
+ name: 'addConstraint',
35
+ query: constraintCall,
36
+ params: undefined,
37
+ output: { records: [] },
38
+ },
39
+ {
40
+ name: 'addEntity',
41
+ query: addEntityCall,
42
+ params: undefined,
43
+ output: { records: [] },
44
+ },
45
+ {
46
+ name: 'addRelationship',
47
+ query: addRelationshipCall,
48
+ params: undefined,
49
+ output: { records: [] },
50
+ },
51
+ {
52
+ name: 'wipeByID',
53
+ query: wipeByIDCall,
54
+ params: undefined,
55
+ output: { records: [] },
56
+ },
57
+ {
58
+ name: 'wipeAll',
59
+ query: wipeAllCall,
60
+ params: undefined,
61
+ output: { records: [] },
62
+ },
63
+ ];
61
64
 
62
65
  describe('#neo4jGraphStore', () => {
63
66
  const mockDriverResp = mockDriver();
@@ -88,12 +91,11 @@ describe('#neo4jGraphStore', () => {
88
91
  });
89
92
 
90
93
  test('should generate call to create a Relationship', () => {
91
-
92
- expect(async () => await store.addRelationships(testRelationshipData)).toReturn;
94
+ expect(async () => await store.addRelationships(testRelationshipData))
95
+ .toReturn;
93
96
  });
94
97
 
95
98
  test('should generate call to wipe by ID', () => {
96
99
  expect(async () => await store.wipeInstanceIdData()).toReturn;
97
100
  });
98
-
99
- });
101
+ });
@@ -1,5 +1,9 @@
1
- import { startsWithNumeric, sanitizePropertyName, sanitizeValue, buildPropertyParameters } from '../neo4jUtilities';
2
-
1
+ import {
2
+ startsWithNumeric,
3
+ sanitizePropertyName,
4
+ sanitizeValue,
5
+ buildPropertyParameters,
6
+ } from '../neo4jUtilities';
3
7
 
4
8
  describe('#neo4jUtilities', () => {
5
9
  test('should return true for string starting with a numeric', () => {
@@ -11,15 +15,67 @@ describe('#neo4jUtilities', () => {
11
15
  expect(testTrailingNumeric).toEqual(false);
12
16
  });
13
17
  test('should sanitize property name properly', () => {
14
- const testSanitize: string = sanitizePropertyName(`1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p'q"r;s:t/u?v.w,x>y<z\`1~2\t3\n4[5]6{7}8 90`);
15
- expect(testSanitize).toEqual('n1a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_1_2_3_4_5_6_7_8_90');
18
+ const testSanitize: string = sanitizePropertyName(
19
+ `1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p'q"r;s:t/u?v.w,x>y<z\`1~2\t3\n4[5]6{7}8 90`,
20
+ );
21
+ expect(testSanitize).toEqual(
22
+ 'n1a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_1_2_3_4_5_6_7_8_90',
23
+ );
16
24
  });
17
25
  test('should sanitize value properly', () => {
18
- const testSanitize: string = sanitizeValue('1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p\'q"r;s:t/u?v.w,x>y<z`1~2\t3\n4[5]6{7}8 90');
19
- expect(testSanitize).toEqual('1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p\'q\\"r;s:t/u?v.w,x>y<z`1~2\t3\n4[5]6{7}8 90');
26
+ const testSanitize: string = sanitizeValue(
27
+ '1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p\'q"r;s:t/u?v.w,x>y<z`1~2\t3\n4[5]6{7}8 90',
28
+ );
29
+ expect(testSanitize).toEqual(
30
+ '1a!b@c#d$e%f^g&h*i(j)k-l=m+n\\o|p\'q\\"r;s:t/u?v.w,x>y<z`1~2\t3\n4[5]6{7}8 90',
31
+ );
20
32
  });
33
+ });
34
+
35
+ describe('#buildPropertyParameters', () => {
21
36
  test('should build property string correctly including sanitization', () => {
22
- const testPropResults: Object = buildPropertyParameters({test: '123', '1sanitize1hi&$abc d': '1h"i&$abc d'});
23
- expect(testPropResults).toEqual({test:'123', n1sanitize1hi__abc_d:'1h\\"i&$abc d'});
37
+ expect(
38
+ buildPropertyParameters({
39
+ test: '123',
40
+ '1sanitize1hi&$abc d': '1h"i&$abc d',
41
+ }),
42
+ ).toEqual({
43
+ test: '123',
44
+ n1sanitize1hi__abc_d: '1h\\"i&$abc d',
45
+ });
46
+ });
47
+
48
+ test('should ignore properties with the value "undefined"', () => {
49
+ expect(
50
+ buildPropertyParameters({
51
+ test: '123',
52
+ ignore: undefined,
53
+ }),
54
+ ).toEqual({
55
+ test: '123',
56
+ });
57
+ });
58
+
59
+ test('should ignore properties with the value "null"', () => {
60
+ expect(
61
+ buildPropertyParameters({
62
+ test: '123',
63
+ ignore: null,
64
+ }),
65
+ ).toEqual({
66
+ test: '123',
67
+ });
68
+ });
69
+
70
+ test('should not ignore "false" property values', () => {
71
+ expect(
72
+ buildPropertyParameters({
73
+ test: '123',
74
+ include: false,
75
+ }),
76
+ ).toEqual({
77
+ test: '123',
78
+ include: false,
79
+ });
24
80
  });
25
- });
81
+ });
@@ -1,2 +1,2 @@
1
1
  export * from './uploadToNeo4j';
2
- export * from './wipeNeo4j';
2
+ export * from './wipeNeo4j';
@@ -1,5 +1,9 @@
1
1
  import { Entity, Relationship } from '@jupiterone/integration-sdk-core';
2
- import { sanitizeValue, buildPropertyParameters } from './neo4jUtilities';
2
+ import {
3
+ sanitizeValue,
4
+ buildPropertyParameters,
5
+ sanitizePropertyName,
6
+ } from './neo4jUtilities';
3
7
 
4
8
  import * as neo4j from 'neo4j-driver';
5
9
 
@@ -7,8 +11,8 @@ export interface Neo4jGraphObjectStoreParams {
7
11
  uri: string;
8
12
  username: string;
9
13
  password: string;
10
- integrationInstanceID: string,
11
- session?: neo4j.Session
14
+ integrationInstanceID: string;
15
+ session?: neo4j.Session;
12
16
  }
13
17
 
14
18
  export class Neo4jGraphStore {
@@ -19,10 +23,9 @@ export class Neo4jGraphStore {
19
23
  private integrationInstanceID: string;
20
24
 
21
25
  constructor(params: Neo4jGraphObjectStoreParams) {
22
- if(params.session) {
26
+ if (params.session) {
23
27
  this.persistedSession = params.session;
24
- }
25
- else {
28
+ } else {
26
29
  this.neo4jDriver = neo4j.driver(
27
30
  params.uri,
28
31
  neo4j.auth.basic(params.username, params.password),
@@ -31,12 +34,14 @@ export class Neo4jGraphStore {
31
34
  this.integrationInstanceID = params.integrationInstanceID;
32
35
  }
33
36
 
34
- private async runCypherCommand(cypherCommand: string, cypherParameters?: any): Promise<neo4j.Result> {
35
- if(this.persistedSession) {
37
+ private async runCypherCommand(
38
+ cypherCommand: string,
39
+ cypherParameters?: any,
40
+ ): Promise<neo4j.Result> {
41
+ if (this.persistedSession) {
36
42
  const result = await this.persistedSession.run(cypherCommand);
37
43
  return result;
38
- }
39
- else {
44
+ } else {
40
45
  const session = this.neo4jDriver.session({
41
46
  database: this.databaseName,
42
47
  defaultAccessMode: neo4j.session.WRITE,
@@ -50,24 +55,37 @@ export class Neo4jGraphStore {
50
55
  async addEntities(newEntities: Entity[]) {
51
56
  const nodeAlias: string = 'entityNode';
52
57
  for (const entity of newEntities) {
53
- //Add index if not already in types. This will optimize future
54
- //MATCH/MERGE calls.
58
+ let classLabels = '';
59
+ if (entity._class) {
60
+ if (typeof entity._class === 'string') {
61
+ classLabels += `:${sanitizePropertyName(entity._class)}`;
62
+ } else {
63
+ for (const className of entity._class) {
64
+ classLabels += `:${sanitizePropertyName(className)}`;
65
+ }
66
+ }
67
+ }
68
+ // I believe we currently can't use parameters for node labels, hence the use of string
69
+ // interpolation in the below commands.
70
+ // Add index if not already in types. This will optimize future
71
+ // MATCH/MERGE calls.
55
72
  if (!this.typeList.has(entity._type)) {
56
73
  await this.runCypherCommand(
57
74
  `CREATE INDEX index_${entity._type} IF NOT EXISTS FOR (n:${entity._type}) ON (n._key, n._integrationInstanceID);`,
58
75
  );
59
76
  this.typeList.add(entity._type);
60
77
  }
78
+ const sanitizedType = sanitizePropertyName(entity._type);
61
79
  const propertyParameters = buildPropertyParameters(entity);
62
80
  const finalKeyValue = sanitizeValue(entity._key.toString());
63
81
  const buildCommand = `
64
82
  MERGE (${nodeAlias} {_key: $finalKeyValue, _integrationInstanceID: $integrationInstanceID})
65
83
  SET ${nodeAlias} += $propertyParameters
66
- SET ${nodeAlias}:${entity._type};`;
84
+ SET ${nodeAlias}:${sanitizedType}${classLabels};`;
67
85
  await this.runCypherCommand(buildCommand, {
68
- propertyParameters: propertyParameters,
69
- finalKeyValue: finalKeyValue,
70
- integrationInstanceID: this.integrationInstanceID
86
+ propertyParameters: propertyParameters,
87
+ finalKeyValue: finalKeyValue,
88
+ integrationInstanceID: this.integrationInstanceID,
71
89
  });
72
90
  }
73
91
  }
@@ -84,43 +102,60 @@ export class Neo4jGraphStore {
84
102
  if (relationship._fromEntityKey) {
85
103
  startEntityKey = sanitizeValue(relationship._fromEntityKey.toString());
86
104
  }
87
- if(relationship._toEntityKey) {
105
+ if (relationship._toEntityKey) {
88
106
  endEntityKey = sanitizeValue(relationship._toEntityKey.toString());
89
107
  }
90
108
 
91
- if(relationship._mapping) { //Mapped Relationship
92
- if(relationship._mapping['skipTargetCreation'] === false) {
109
+ if (relationship._mapping) {
110
+ //Mapped Relationship
111
+ if (relationship._mapping['skipTargetCreation'] === false) {
93
112
  //Create target entity first
94
113
  const tempEntity: Entity = {
95
114
  _class: relationship._mapping['targetEntity']._class,
96
115
  //TODO, I think this key is wrong, but not sure what else to use
97
- _key: sanitizeValue(relationship._key.replace(relationship._mapping['sourceEntityKey'], '')),
116
+ _key: sanitizeValue(
117
+ relationship._key.replace(
118
+ relationship._mapping['sourceEntityKey'],
119
+ '',
120
+ ),
121
+ ),
98
122
  _type: relationship._mapping['targetEntity']._type,
99
- }
123
+ };
100
124
  await this.addEntities([tempEntity]);
101
125
  }
102
- startEntityKey = sanitizeValue(relationship._mapping['sourceEntityKey']);
126
+ startEntityKey = sanitizeValue(
127
+ relationship._mapping['sourceEntityKey'],
128
+ );
103
129
  // TODO, see above. This key might also be an issue for the same reason
104
- endEntityKey = sanitizeValue(relationship._key.replace(relationship._mapping['sourceEntityKey'], ''));
130
+ endEntityKey = sanitizeValue(
131
+ relationship._key.replace(
132
+ relationship._mapping['sourceEntityKey'],
133
+ '',
134
+ ),
135
+ );
105
136
  }
106
137
 
138
+ const sanitizedRelationshipClass = sanitizePropertyName(
139
+ relationship._class,
140
+ );
141
+
107
142
  const buildCommand = `
108
143
  MERGE (start {_key: $startEntityKey, _integrationInstanceID: $integrationInstanceID})
109
144
  MERGE (end {_key: $endEntityKey, _integrationInstanceID: $integrationInstanceID})
110
- MERGE (start)-[${relationshipAlias}:${relationship._type}]->(end)
145
+ MERGE (start)-[${relationshipAlias}:${sanitizedRelationshipClass}]->(end)
111
146
  SET ${relationshipAlias} += $propertyParameters;`;
112
147
  await this.runCypherCommand(buildCommand, {
113
- propertyParameters: propertyParameters,
114
- startEntityKey: startEntityKey,
148
+ propertyParameters: propertyParameters,
149
+ startEntityKey: startEntityKey,
115
150
  endEntityKey: endEntityKey,
116
- integrationInstanceID: this.integrationInstanceID
151
+ integrationInstanceID: this.integrationInstanceID,
117
152
  });
118
153
  }
119
154
  }
120
155
 
121
156
  // TODO, if we get to very large databases we could reach a size where
122
- // one or both both of the below wipe commands can't be easily executed
123
- // in memory. At that time, we should consider requiring/using the APOC
157
+ // one or both both of the below wipe commands can't be easily executed
158
+ // in memory. At that time, we should consider requiring/using the APOC
124
159
  // library so we can use apoc.periodic.iterate. Leaving out for now,
125
160
  // since that would further complicate the Neo4j database setup.
126
161
  async wipeInstanceIdData() {
@@ -21,28 +21,29 @@ export function sanitizeValue(value: string): string {
21
21
 
22
22
  export function buildPropertyParameters(propList: Object) {
23
23
  const propertyParameters = {};
24
+
24
25
  for (const key in propList) {
26
+ const propVal = propList[key];
27
+
25
28
  if (key === '_rawData') {
26
- //stringify JSON in rawData so we can store it.
27
- propertyParameters[key] = `"${JSON.stringify(propList[key])}"`;
29
+ // stringify JSON in rawData so we can store it.
30
+ propertyParameters[key] = `"${JSON.stringify(propVal)}"`;
28
31
  } else {
29
32
  // Sanitize out characters that aren't allowed in property names
30
33
  const propertyName = sanitizePropertyName(key);
31
34
 
32
- //If we're dealing with a number or boolean, leave alone, otherwise
33
- //wrap in single quotes to convert to a string and escape all
34
- //other single quotes so they don't terminate strings prematurely.
35
- if (propList[key]) {
36
- if (
37
- typeof propList[key] == 'number' ||
38
- typeof propList[key] == 'boolean'
39
- ) {
40
- propertyParameters[propertyName] = propList[key];
41
- } else {
42
- propertyParameters[propertyName] = sanitizeValue(
43
- propList[key].toString(),
44
- );
45
- }
35
+ if (propVal === undefined || propVal === null) {
36
+ // Ignore properties that have the value `undefined` or `null`.
37
+ continue;
38
+ }
39
+
40
+ // If we're dealing with a number or boolean, leave alone, otherwise
41
+ // wrap in single quotes to convert to a string and escape all
42
+ // other single quotes so they don't terminate strings prematurely.
43
+ if (typeof propVal == 'number' || typeof propVal == 'boolean') {
44
+ propertyParameters[propertyName] = propVal;
45
+ } else {
46
+ propertyParameters[propertyName] = sanitizeValue(propVal.toString());
46
47
  }
47
48
  }
48
49
  }
@@ -1,5 +1,8 @@
1
1
  import { Neo4jGraphStore } from './neo4jGraphStore';
2
- import { iterateParsedGraphFiles, isDirectoryPresent } from '@jupiterone/integration-sdk-runtime';
2
+ import {
3
+ iterateParsedGraphFiles,
4
+ isDirectoryPresent,
5
+ } from '@jupiterone/integration-sdk-runtime';
3
6
  import { FlushedGraphObjectData } from '@jupiterone/integration-sdk-runtime/src/storage/types';
4
7
 
5
8
  type UploadToNeo4jParams = {
@@ -44,4 +47,4 @@ export async function uploadToNeo4j({
44
47
  } finally {
45
48
  await store.close();
46
49
  }
47
- }
50
+ }
@@ -5,15 +5,17 @@ type WipeNeo4jParams = {
5
5
  neo4jUri?: string;
6
6
  neo4jUser?: string;
7
7
  neo4jPassword?: string;
8
- }
8
+ };
9
9
  export async function wipeNeo4jByID({
10
10
  integrationInstanceID,
11
11
  neo4jUri = process.env.NEO4J_URI,
12
- neo4jUser = process.env. NEO4J_USER,
13
- neo4jPassword = process.env. NEO4J_PASSWORD,
12
+ neo4jUser = process.env.NEO4J_USER,
13
+ neo4jPassword = process.env.NEO4J_PASSWORD,
14
14
  }: WipeNeo4jParams) {
15
- if(!neo4jUri || !neo4jUser || !neo4jPassword) {
16
- throw new Error('ERROR: must provide login information in function call or include NEO4J_URI, NEO4J_USER, and NEO4J_PASSWORD files in your .env file!');
15
+ if (!neo4jUri || !neo4jUser || !neo4jPassword) {
16
+ throw new Error(
17
+ 'ERROR: must provide login information in function call or include NEO4J_URI, NEO4J_USER, and NEO4J_PASSWORD files in your .env file!',
18
+ );
17
19
  }
18
20
 
19
21
  const store = new Neo4jGraphStore({
@@ -33,15 +35,17 @@ type WipeAllNeo4jParams = {
33
35
  neo4jUri?: string;
34
36
  neo4jUser?: string;
35
37
  neo4jPassword?: string;
36
- }
38
+ };
37
39
 
38
40
  export async function wipeAllNeo4j({
39
41
  neo4jUri = process.env.NEO4J_URI,
40
- neo4jUser = process.env. NEO4J_USER,
41
- neo4jPassword = process.env. NEO4J_PASSWORD,
42
+ neo4jUser = process.env.NEO4J_USER,
43
+ neo4jPassword = process.env.NEO4J_PASSWORD,
42
44
  }: WipeAllNeo4jParams) {
43
- if(!neo4jUri || !neo4jUser || !neo4jPassword) {
44
- throw new Error('ERROR: must provide login information in function call or include NEO4J_URI, NEO4J_USER, and NEO4J_PASSWORD files in your .env file!');
45
+ if (!neo4jUri || !neo4jUser || !neo4jPassword) {
46
+ throw new Error(
47
+ 'ERROR: must provide login information in function call or include NEO4J_URI, NEO4J_USER, and NEO4J_PASSWORD files in your .env file!',
48
+ );
45
49
  }
46
50
 
47
51
  const store = new Neo4jGraphStore({
@@ -55,4 +59,4 @@ export async function wipeAllNeo4j({
55
59
  } finally {
56
60
  await store.close();
57
61
  }
58
- }
62
+ }