@@ -15,8 +15,6 @@ module.exports = {
1515 } ,
1616
1717 disconnect : function ( connectionInfo , logger , cb , app ) {
18- const sshService = app . require ( '@hackolade/ssh-service' ) ;
19- gremlinHelper . close ( sshService ) ;
2018 cb ( ) ;
2119 } ,
2220
@@ -54,7 +52,6 @@ module.exports = {
5452 } ,
5553
5654 getDbCollectionsNames : async function ( connectionInfo , logger , cb , app ) {
57- const sshService = app . require ( '@hackolade/ssh-service' ) ;
5855 try {
5956 client = setUpDocumentClient ( connectionInfo ) ;
6057 logger . log ( 'info' , connectionInfo , 'Reverse-Engineering connection settings' , connectionInfo . hiddenKeys ) ;
@@ -74,7 +71,7 @@ module.exports = {
7471 ) ;
7572 const result = await collections . reduce ( async ( acc , collection ) => {
7673 const res = await acc ;
77- await gremlinHelper . connect ( { ...connectionInfo , collection : collection . id } , sshService ) ;
74+ await gremlinHelper . connect ( { ...connectionInfo , collection : collection . id } ) ;
7875 logger . log ( 'info' , '' , 'Connected to the Gremlin API' , connectionInfo . hiddenKeys ) ;
7976 let collectionLabels ;
8077 try {
@@ -85,7 +82,7 @@ module.exports = {
8582 'Collection labels list' ,
8683 connectionInfo . hiddenKeys ,
8784 ) ;
88- gremlinHelper . close ( sshService ) ;
85+ gremlinHelper . close ( ) ;
8986 } catch ( err ) {
9087 if ( err . message ?. includes ( 'NullReferenceException' ) ) {
9188 logger . log (
@@ -94,7 +91,7 @@ module.exports = {
9491 'Skipping document collection' ,
9592 connectionInfo . hiddenKeys ,
9693 ) ;
97- gremlinHelper . close ( sshService ) ;
94+ gremlinHelper . close ( ) ;
9895 return res ;
9996 } else {
10097 throw err ;
@@ -118,8 +115,6 @@ module.exports = {
118115 } ,
119116
120117 getDbCollectionsData : async function ( data , logger , cb , app ) {
121- const sshService = app . require ( '@hackolade/ssh-service' ) ;
122-
123118 try {
124119 logger . clear ( ) ;
125120 logger . log ( 'info' , data , 'connectionInfo' , data . hiddenKeys ) ;
@@ -171,7 +166,7 @@ module.exports = {
171166 } ;
172167
173168 logger . log ( 'info' , { collection : collectionName } , 'Getting container nodes data' , data . hiddenKeys ) ;
174- await gremlinHelper . connect ( { collection : collectionName } , sshService ) ;
169+ await gremlinHelper . connect ( { collection : collectionName } ) ;
175170 const nodesData = await getNodesData ( collectionName , labels , logger , {
176171 recordSamplingSettings,
177172 fieldInference,
@@ -202,7 +197,7 @@ module.exports = {
202197 fieldInference ,
203198 ) ;
204199 packages . relationships . push ( relationshipData ) ;
205- gremlinHelper . close ( sshService ) ;
200+ gremlinHelper . close ( ) ;
206201
207202 return packages ;
208203 } ,
@@ -214,7 +209,7 @@ module.exports = {
214209
215210 cb ( null , packages . labels , modelInfo , [ ] . concat ( ...packages . relationships ) ) ;
216211 } catch ( err ) {
217- gremlinHelper . close ( sshService ) ;
212+ gremlinHelper . close ( ) ;
218213 logger . log ( 'error' , mapError ( err ) , 'Error' ) ;
219214 cb ( mapError ( err ) ) ;
220215 }
@@ -447,12 +442,12 @@ function createSchemaByPartitionKeyPath(path, documents = []) {
447442}
448443
449444const setUpDocumentClient = connectionInfo => {
450- const dbNameRegExp = / w s s : \/ \/ ( \S * ) .g r e m l i n \. c o s m o s \. / i;
445+ const dbNameRegExp = / ( \S * ) .g r e m l i n \. c o s m o s \. a z u r e . c o m / i;
451446 const dbName = dbNameRegExp . exec ( connectionInfo . gremlinEndpoint ) ;
452447 if ( ! dbName ?. [ 1 ] ) {
453- throw new Error ( 'Incorrect endpoint provided. Expected format: wss:// <account name>.gremlin.cosmos.' ) ;
448+ throw new Error ( 'Incorrect endpoint provided. Expected format: <account name>.gremlin.cosmos.azurecom ' ) ;
454449 }
455- const endpoint = `https://${ dbName [ 1 ] } .documents.azure.com:443 /` ;
450+ const endpoint = `https://${ dbName [ 1 ] } .documents.azure.com/` ;
456451 const key = connectionInfo . accountKey ;
457452
458453 return new CosmosClient ( { endpoint, key } ) ;
0 commit comments